Skip to content

Commit b84c3f1

Browse files
ahennrdnlkoch
authored andcommitted
chore: homogenize / sort imports using simple-sort-plugin
1 parent 399c375 commit b84c3f1

File tree

135 files changed

+754
-952
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+754
-952
lines changed

.eslintrc

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": [
3+
"@terrestris/eslint-config-typescript",
4+
"plugin:testing-library/react",
5+
"plugin:jest-dom/recommended"
6+
],
7+
"plugins": [
8+
"testing-library",
9+
"jest-dom",
10+
"simple-import-sort"
11+
],
12+
"rules": {
13+
"@typescript-eslint/member-ordering": "off",
14+
"no-underscore-dangle": "off",
15+
"simple-import-sort/exports": "warn",
16+
"simple-import-sort/imports": "warn"
17+
}
18+
}

.eslintrc.js

-17
This file was deleted.

package-lock.json

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@
5454
"clean:dist": "rimraf ./dist/*",
5555
"clean:test": "rimraf ./coverage/*",
5656
"coveralls": "cat coverage/lcov.info | coveralls",
57-
"prepare": "husky install",
5857
"lint": "npm run lint:styleguide && npm run lint:src",
59-
"lint:fix": "npm run lint:styleguide -- --fix && npm run lint:src -- --fix",
60-
"lint:src": "eslint -c .eslintrc.js --ext ts,tsx src/",
58+
"lint:fix": "eslint -c .eslintrc --ext .tsx,.ts src/ --fix",
59+
"lint:src": "eslint -c .eslintrc --ext .tsx,.ts src/",
6160
"lint:styleguide": "eslint -c .eslintrc.styleguide.js src/",
62-
"start:styleguide": "styleguidist server",
61+
"lint:styleguide-fix": "eslint -c .eslintrc.styleguide.js src/ --fix",
62+
"prepare": "husky install",
6363
"pretest": "npm run typecheck && npm run lint",
64+
"start:styleguide": "styleguidist server",
6465
"test": "npm run test:jest",
6566
"test:jest": "jest --maxWorkers=4 --coverage",
6667
"test:watch": "jest --watchAll",
@@ -91,7 +92,6 @@
9192
"@babel/cli": "^7.22.15",
9293
"@babel/core": "^7.22.15",
9394
"@babel/eslint-parser": "^7.22.15",
94-
"@babel/plugin-transform-class-properties": "^7.22.5",
9595
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
9696
"@babel/plugin-transform-modules-commonjs": "^7.23.0",
9797
"@babel/preset-env": "^7.22.15",
@@ -131,6 +131,7 @@
131131
"eslint-plugin-markdown": "^3.0.1",
132132
"eslint-plugin-react": "^7.33.2",
133133
"eslint-plugin-react-hooks": "^4.6.0",
134+
"eslint-plugin-simple-import-sort": "^10.0.0",
134135
"eslint-plugin-testing-library": "^6.0.1",
135136
"file-loader": "^6.2.0",
136137
"fork-ts-checker-webpack-plugin": "^9.0.0",

src/BackgroundLayerChooser/BackgroundLayerChooser.example.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
The BackgroundLayerChooser
22

33
```jsx
4-
import * as React from 'react';
5-
6-
import OlMap from 'ol/Map';
7-
import OlView from 'ol/View';
8-
import OlLayerTile from 'ol/layer/Tile';
9-
import OlSourceTileWMS from 'ol/source/TileWMS';
10-
import OlSourceOsm from 'ol/source/OSM';
11-
124
import BackgroundLayerChooser from '@terrestris/react-geo/dist/BackgroundLayerChooser/BackgroundLayerChooser';
13-
import MapComponent from '@terrestris/react-geo/dist/Map/MapComponent/MapComponent';
145
import MapContext from '@terrestris/react-geo/dist/Context/MapContext/MapContext';
156
import { useMap } from '@terrestris/react-geo/dist/Hook/useMap';
7+
import MapComponent from '@terrestris/react-geo/dist/Map/MapComponent/MapComponent';
8+
import OlLayerTile from 'ol/layer/Tile';
9+
import OlMap from 'ol/Map';
10+
import OlSourceOsm from 'ol/source/OSM';
11+
import OlSourceTileWMS from 'ol/source/TileWMS';
12+
import OlView from 'ol/View';
13+
import * as React from 'react';
1614

1715
const layers = [
1816
new OlLayerTile({

src/BackgroundLayerChooser/BackgroundLayerChooser.tsx

+14-18
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
1-
import React, {
2-
useState,
3-
useEffect,
4-
useRef
5-
} from 'react';
1+
import './BackgroundLayerChooser.less';
62

3+
import {
4+
faChevronLeft,
5+
faChevronRight,
6+
faBan
7+
} from '@fortawesome/free-solid-svg-icons';
8+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
79
import OlOverviewMap from 'ol/control/OverviewMap';
810
import OlLayerBase from 'ol/layer/Base';
11+
import OlLayerImage from 'ol/layer/Image';
912
import OlLayer from 'ol/layer/Layer';
10-
import OlView from 'ol/View';
1113
import OlLayerTile from 'ol/layer/Tile';
12-
import OlLayerImage from 'ol/layer/Image';
1314
import { ObjectEvent } from 'ol/Object';
1415
import { getUid } from 'ol/util';
16+
import OlView from 'ol/View';
17+
import React, {
18+
useEffect,
19+
useRef,
20+
useState} from 'react';
1521

1622
import BackgroundLayerPreview from '../BackgroundLayerPreview/BackgroundLayerPreview';
17-
18-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
19-
import {
20-
faChevronLeft,
21-
faChevronRight,
22-
faBan
23-
} from '@fortawesome/free-solid-svg-icons';
24-
25-
import useMap from '../Hook/useMap';
2623
import SimpleButton from '../Button/SimpleButton/SimpleButton';
27-
28-
import './BackgroundLayerChooser.less';
24+
import useMap from '../Hook/useMap';
2925

3026
export type BackgroundLayerChooserProps = {
3127
/**

src/BackgroundLayerPreview/BackgroundLayerPreview.tsx

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import React, { useState, useEffect } from 'react';
1+
import './BackgroundLayerPreview.less';
22

3+
import { Spin } from 'antd';
4+
import { Coordinate } from 'ol/coordinate';
35
import OlLayerBase from 'ol/layer/Base';
6+
import OlLayerImage from 'ol/layer/Image';
47
import OlLayer from 'ol/layer/Layer';
5-
import OlMap from 'ol/Map';
6-
import OlView from 'ol/View';
78
import OlLayerTile from 'ol/layer/Tile';
8-
import OlLayerImage from 'ol/layer/Image';
9+
import OlMap from 'ol/Map';
910
import { getUid } from 'ol/util';
11+
import OlView from 'ol/View';
12+
import React, { useEffect,useState } from 'react';
1013

11-
import { Spin } from 'antd';
12-
13-
import './BackgroundLayerPreview.less';
14-
import { Coordinate } from 'ol/coordinate';
1514
import useMap from '../Hook/useMap';
1615
import MapComponent from '../Map/MapComponent/MapComponent';
1716

src/Button/CopyButton/CopyButton.example.md

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
This demonstrates the use of the CopyButton.
22

33
```jsx
4-
import {useEffect, useState} from 'react';
5-
6-
import OlMap from 'ol/Map';
7-
import OlView from 'ol/View';
8-
import OlLayerTile from 'ol/layer/Tile';
9-
import OlSourceOsm from 'ol/source/OSM';
10-
import OlFormatGeoJSON from 'ol/format/GeoJSON';
11-
import {fromLonLat} from 'ol/proj';
12-
4+
import CopyButton from '@terrestris/react-geo/dist/Button/CopyButton/CopyButton';
135
import MapContext from '@terrestris/react-geo/dist/Context/MapContext/MapContext'
146
import MapComponent from '@terrestris/react-geo/dist/Map/MapComponent/MapComponent';
15-
import CopyButton from '@terrestris/react-geo/dist/Button/CopyButton/CopyButton';
167
import {DigitizeUtil} from '@terrestris/react-geo/dist/Util/DigitizeUtil';
8+
import OlFormatGeoJSON from 'ol/format/GeoJSON';
9+
import OlLayerTile from 'ol/layer/Tile';
10+
import OlMap from 'ol/Map';
11+
import {fromLonLat} from 'ol/proj';
12+
import OlSourceOsm from 'ol/source/OSM';
13+
import OlView from 'ol/View';
14+
import {useEffect, useState} from 'react';
1715

1816
import featuresJson from '../../../assets/simple-geometries.json';
1917

src/Button/CopyButton/CopyButton.spec.tsx

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import { screen, within } from '@testing-library/react';
2-
import * as React from 'react';
32
import userEvent from '@testing-library/user-event';
4-
5-
import OlView from 'ol/View';
6-
import OlMap from 'ol/Map';
7-
import OlPoint from 'ol/geom/Point';
83
import OlFeature from 'ol/Feature';
9-
import OlStyleStyle from 'ol/style/Style';
10-
import OlStyleStroke from 'ol/style/Stroke';
4+
import OlPoint from 'ol/geom/Point';
5+
import OlMap from 'ol/Map';
116
import OlStyleFill from 'ol/style/Fill';
7+
import OlStyleStroke from 'ol/style/Stroke';
8+
import OlStyleStyle from 'ol/style/Style';
9+
import OlView from 'ol/View';
10+
import * as React from 'react';
1211

13-
import { clickMap, mockForEachFeatureAtPixel, renderInMapContext } from '../../Util/rtlTestUtils';
1412
import { DigitizeUtil } from '../../Util/DigitizeUtil';
13+
import { clickMap, mockForEachFeatureAtPixel, renderInMapContext } from '../../Util/rtlTestUtils';
1514
import CopyButton from './CopyButton';
1615

1716
describe('<CopyButton />', () => {

src/Button/CopyButton/CopyButton.tsx

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1+
import AnimateUtil from '@terrestris/ol-util/dist/AnimateUtil/AnimateUtil';
2+
import OlGeometry from 'ol/geom/Geometry';
3+
import { SelectEvent as OlSelectEvent } from 'ol/interaction/Select';
4+
import OlVectorLayer from 'ol/layer/Vector';
5+
import OlVectorSource from 'ol/source/Vector';
6+
import OlStyle from 'ol/style/Style';
17
import React, {
28
useEffect,
39
useState
410
} from 'react';
511

6-
import OlVectorSource from 'ol/source/Vector';
7-
import OlGeometry from 'ol/geom/Geometry';
8-
import OlVectorLayer from 'ol/layer/Vector';
9-
import { SelectEvent as OlSelectEvent } from 'ol/interaction/Select';
10-
import OlStyle from 'ol/style/Style';
11-
12-
import AnimateUtil from '@terrestris/ol-util/dist/AnimateUtil/AnimateUtil';
13-
1412
import { CSS_PREFIX } from '../../constants';
1513
import { useMap } from '../../Hook/useMap';
1614
import { DigitizeUtil } from '../../Util/DigitizeUtil';

src/Button/DeleteButton/DeleteButton.example.md

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
This demonstrates the use of the DeleteButton.
22

33
```jsx
4-
import { useEffect, useState } from 'react';
5-
6-
import OlMap from 'ol/Map';
7-
import OlView from 'ol/View';
8-
import OlLayerTile from 'ol/layer/Tile';
9-
import OlSourceOsm from 'ol/source/OSM';
10-
import OlFormatGeoJSON from 'ol/format/GeoJSON';
11-
import { fromLonLat } from 'ol/proj';
12-
4+
import { DeleteButton } from '@terrestris/react-geo/dist/Button/DeleteButton/DeleteButton';
135
import MapContext from '@terrestris/react-geo/dist/Context/MapContext/MapContext'
146
import MapComponent from '@terrestris/react-geo/dist/Map/MapComponent/MapComponent';
15-
import { DeleteButton } from '@terrestris/react-geo/dist/Button/DeleteButton/DeleteButton';
167
import { DigitizeUtil } from '@terrestris/react-geo/dist/Util/DigitizeUtil';
8+
import OlFormatGeoJSON from 'ol/format/GeoJSON';
9+
import OlLayerTile from 'ol/layer/Tile';
10+
import OlMap from 'ol/Map';
11+
import { fromLonLat } from 'ol/proj';
12+
import OlSourceOsm from 'ol/source/OSM';
13+
import OlView from 'ol/View';
14+
import { useEffect, useState } from 'react';
1715

1816
import federalStates from '../../../assets/federal-states-ger.json';
1917

src/Button/DeleteButton/DeleteButton.spec.tsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { screen, within } from '@testing-library/react';
2-
import * as React from 'react';
32
import userEvent from '@testing-library/user-event';
4-
5-
import OlView from 'ol/View';
6-
import OlMap from 'ol/Map';
7-
import OlPoint from 'ol/geom/Point';
83
import OlFeature from 'ol/Feature';
4+
import OlPoint from 'ol/geom/Point';
5+
import OlMap from 'ol/Map';
6+
import OlView from 'ol/View';
7+
import * as React from 'react';
98

10-
import { clickMap, mockForEachFeatureAtPixel, renderInMapContext } from '../../Util/rtlTestUtils';
119
import { DigitizeUtil } from '../../Util/DigitizeUtil';
10+
import { clickMap, mockForEachFeatureAtPixel, renderInMapContext } from '../../Util/rtlTestUtils';
1211
import { DeleteButton } from './DeleteButton';
1312

1413
describe('<DeleteButton />', () => {

src/Button/DeleteButton/DeleteButton.tsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import * as React from 'react';
2-
import { useEffect, useState } from 'react';
3-
1+
import OlGeometry from 'ol/geom/Geometry';
2+
import { SelectEvent as OlSelectEvent } from 'ol/interaction/Select';
43
import OlVectorLayer from 'ol/layer/Vector';
54
import OlVectorSource from 'ol/source/Vector';
6-
import OlGeometry from 'ol/geom/Geometry';
5+
import * as React from 'react';
6+
import { useEffect, useState } from 'react';
77

88
import { CSS_PREFIX } from '../../constants';
99
import { useMap } from '../../Hook/useMap';
10-
import SelectFeaturesButton, { SelectFeaturesButtonProps } from '../SelectFeaturesButton/SelectFeaturesButton';
1110
import { DigitizeUtil } from '../../Util/DigitizeUtil';
12-
import { SelectEvent as OlSelectEvent } from 'ol/interaction/Select';
11+
import SelectFeaturesButton, { SelectFeaturesButtonProps } from '../SelectFeaturesButton/SelectFeaturesButton';
1312

1413
interface OwnProps {
1514
/**

src/Button/DrawButton/DrawButton.example.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
This demonstrates the use of the DrawButton.
22

33
```jsx
4-
import { useEffect, useState } from 'react';
5-
6-
import OlMap from 'ol/Map';
7-
import OlView from 'ol/View';
8-
import OlLayerTile from 'ol/layer/Tile';
9-
import OlSourceOsm from 'ol/source/OSM';
10-
import { fromLonLat } from 'ol/proj';
11-
12-
import MapContext from '@terrestris/react-geo/dist/Context/MapContext/MapContext'
134
import DrawButton from '@terrestris/react-geo/dist/Button/DrawButton/DrawButton';
145
import ToggleGroup from '@terrestris/react-geo/dist/Button/ToggleGroup/ToggleGroup';
6+
import MapContext from '@terrestris/react-geo/dist/Context/MapContext/MapContext'
157
import MapComponent from '@terrestris/react-geo/dist/Map/MapComponent/MapComponent';
8+
import OlLayerTile from 'ol/layer/Tile';
9+
import OlMap from 'ol/Map';
10+
import { fromLonLat } from 'ol/proj';
11+
import OlSourceOsm from 'ol/source/OSM';
12+
import OlView from 'ol/View';
13+
import { useEffect, useState } from 'react';
1614

1715
const DrawButtonExample = () => {
1816

src/Button/DrawButton/DrawButton.spec.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import DrawButton from './DrawButton';
21
import { screen, within } from '@testing-library/react';
3-
import * as React from 'react';
42
import userEvent from '@testing-library/user-event';
5-
6-
import OlView from 'ol/View';
7-
import OlMap from 'ol/Map';
8-
import { clickMap, doubleClickMap, renderInMapContext } from '../../Util/rtlTestUtils';
93
import LineString from 'ol/geom/LineString';
104
import Polygon from 'ol/geom/Polygon';
115
import VectorLayer from 'ol/layer/Vector';
6+
import OlMap from 'ol/Map';
127
import VectorSource from 'ol/source/Vector';
8+
import OlView from 'ol/View';
9+
import * as React from 'react';
10+
1311
import { DigitizeUtil } from '../../Util/DigitizeUtil';
12+
import { clickMap, doubleClickMap, renderInMapContext } from '../../Util/rtlTestUtils';
13+
import DrawButton from './DrawButton';
1414

1515
describe('<DrawButton />', () => {
1616

0 commit comments

Comments
 (0)