From 2772e76a62f28b48e23e4153e735d9edb561d791 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Fri, 17 Apr 2020 00:39:09 -0500 Subject: [PATCH] clean up import order --- .eslintrc.js | 10 +++++++++- package.json | 1 + src/components/App.tsx | 2 +- src/components/BluetoothButton.tsx | 6 +++--- src/components/Terminal.tsx | 2 +- src/components/Toolbar.tsx | 2 +- src/epics/ble.ts | 2 +- src/epics/terminal.ts | 2 +- src/index.tsx | 4 ++-- yarn.lock | 18 ++++++++++++++++++ 10 files changed, 38 insertions(+), 11 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 92edda55..0c0dd7e0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,13 +1,21 @@ module.exports = { parser: '@typescript-eslint/parser', extends: [ + "eslint:recommended", 'plugin:react/recommended', - 'plugin:@typescript-eslint/recommended', + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", 'prettier/@typescript-eslint', 'plugin:prettier/recommended', + 'plugin:import/errors', + 'plugin:import/warnings', + 'plugin:import/typescript', ], parserOptions: { ecmaVersion: 2018, sourceType: 'module', }, + rules: { + "import/order": ["error", {}] + } }; diff --git a/package.json b/package.json index 5292af06..eaaf7a83 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "@typescript-eslint/parser": "^2.27.0", "eslint": "^6.8.0", "eslint-config-prettier": "^6.10.1", + "eslint-plugin-import": "^2.20.2", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.19.0", "prettier": "^2.0.4" diff --git a/src/components/App.tsx b/src/components/App.tsx index c1660450..29e25b5f 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -1,9 +1,9 @@ import React from 'react'; +import Container from 'react-bootstrap/Container'; import Editor from './Editor'; import Toolbar from './Toolbar'; import Terminal from './Terminal'; import StatusBar from './Statusbar'; -import Container from 'react-bootstrap/Container'; function App(): JSX.Element { return ( diff --git a/src/components/BluetoothButton.tsx b/src/components/BluetoothButton.tsx index adbc62bf..81f1cb2e 100644 --- a/src/components/BluetoothButton.tsx +++ b/src/components/BluetoothButton.tsx @@ -1,10 +1,10 @@ -import ActionButton from './ActionButton'; import { connect } from 'react-redux'; +import { ThunkDispatch } from 'redux-thunk'; +import { AnyAction } from 'redux'; import { connect as bleConnect, disconnect as bleDisconnect } from '../actions/ble'; import { RootState } from '../reducers'; import { BLEConnectionState } from '../reducers/ble'; -import { ThunkDispatch } from 'redux-thunk'; -import { AnyAction } from 'redux'; +import ActionButton from './ActionButton'; type Dispatch = ThunkDispatch<{}, {}, AnyAction>; diff --git a/src/components/Terminal.tsx b/src/components/Terminal.tsx index 477aaa91..72918028 100644 --- a/src/components/Terminal.tsx +++ b/src/components/Terminal.tsx @@ -4,9 +4,9 @@ import Row from 'react-bootstrap/Row'; import Col from 'react-bootstrap/Col'; import { connect } from 'react-redux'; import { Dispatch } from 'redux'; +import { Subscription } from 'rxjs'; import { receiveData } from '../actions/terminal'; import { terminalOutput } from '../epics/terminal'; -import { Subscription } from 'rxjs'; import 'xterm/css/xterm.css'; diff --git a/src/components/Toolbar.tsx b/src/components/Toolbar.tsx index d61c772b..1aeac128 100644 --- a/src/components/Toolbar.tsx +++ b/src/components/Toolbar.tsx @@ -3,8 +3,8 @@ import Col from 'react-bootstrap/Col'; import ButtonGroup from 'react-bootstrap/ButtonGroup'; import ButtonToolbar from 'react-bootstrap/ButtonToolbar'; import React from 'react'; -import ActionButton from './ActionButton'; import { BLEConnectionState } from '../reducers/ble'; +import ActionButton from './ActionButton'; import BluetoothButton from './BluetoothButton'; interface ToolbarState { diff --git a/src/epics/ble.ts b/src/epics/ble.ts index 2837851a..322c79e2 100644 --- a/src/epics/ble.ts +++ b/src/epics/ble.ts @@ -1,6 +1,6 @@ import { combineEpics, Epic, ofType } from 'redux-observable'; -import { BLEDataActionType, BLEDataAction } from '../actions/ble'; import { map } from 'rxjs/operators'; +import { BLEDataActionType, BLEDataAction } from '../actions/ble'; import { TerminalDataAction, sendData } from '../actions/terminal'; const decoder = new TextDecoder(); diff --git a/src/epics/terminal.ts b/src/epics/terminal.ts index fae0f805..88af9926 100644 --- a/src/epics/terminal.ts +++ b/src/epics/terminal.ts @@ -1,7 +1,7 @@ import { combineEpics, Epic, ofType } from 'redux-observable'; -import { write, BLEThunkAction } from '../actions/ble'; import { Subject } from 'rxjs'; import { map, tap, ignoreElements } from 'rxjs/operators'; +import { write, BLEThunkAction } from '../actions/ble'; import { TerminalDataAction, TerminalDataActionType } from '../actions/terminal'; const encoder = new TextEncoder(); diff --git a/src/index.tsx b/src/index.tsx index ee96de27..3f8910d9 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2,11 +2,11 @@ import thunkMiddleware from 'redux-thunk'; import { createLogger } from 'redux-logger'; import { createEpicMiddleware } from 'redux-observable'; import { createStore, applyMiddleware } from 'redux'; -import rootReducer from './reducers'; -import rootEpic from './epics'; import React from 'react'; import { Provider } from 'react-redux'; import ReactDOM from 'react-dom'; +import rootEpic from './epics'; +import rootReducer from './reducers'; import './index.scss'; import App from './components/App'; import * as serviceWorker from './serviceWorker'; diff --git a/yarn.lock b/yarn.lock index a52c74fd..d971d3a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4906,6 +4906,24 @@ eslint-plugin-import@2.20.1: read-pkg-up "^2.0.0" resolve "^1.12.0" +eslint-plugin-import@^2.20.2: + version "2.20.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.20.2.tgz#91fc3807ce08be4837141272c8b99073906e588d" + integrity sha512-FObidqpXrR8OnCh4iNsxy+WACztJLXAHBO5hK79T1Hc77PgQZkyDGA5Ag9xAvRpglvLNxhH/zSmZ70/pZ31dHg== + dependencies: + array-includes "^3.0.3" + array.prototype.flat "^1.2.1" + contains-path "^0.1.0" + debug "^2.6.9" + doctrine "1.5.0" + eslint-import-resolver-node "^0.3.2" + eslint-module-utils "^2.4.1" + has "^1.0.3" + minimatch "^3.0.4" + object.values "^1.1.0" + read-pkg-up "^2.0.0" + resolve "^1.12.0" + eslint-plugin-jsx-a11y@6.2.3: version "6.2.3" resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.2.3.tgz#b872a09d5de51af70a97db1eea7dc933043708aa"