Skip to content

Commit

Permalink
build: add plugin to sort imports automatically
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Espiau <[email protected]>
  • Loading branch information
Frederic Espiau committed Apr 27, 2020
1 parent 280e81a commit 1cb39a1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
13 changes: 6 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@ const path = require('path');
module.exports = {
root: true,
parser: 'babel-eslint',
plugins: [
'angular',
'markdown',
'prettier',
],
extends: ['airbnb-base', 'prettier'],
plugins: ['angular', 'markdown', 'prettier', 'simple-import-sort'],
extends: ['airbnb-base', 'prettier', 'plugin:import/recommended'],
env: {
'angular/mocks': true,
browser: true,
Expand All @@ -17,7 +13,10 @@ module.exports = {
rules: {
'no-bitwise': ['error', { allow: ['~'] }],
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'import/no-unresolved': 0,
'import/no-unresolved': 'off',
'simple-import-sort/sort': 'error', // sorts imports automatically
'sort-imports': 'off', // must be turned off for 'simple-import-sort/sort' to work fine
'import/order': 'off', // must be turned off for 'simple-import-sort/sort' to work fine
'prettier/prettier': 'error',
},
settings: {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-markdown": "^1.0.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-simple-import-sort": "^5.0.2",
"esm": "^3.2.25",
"execa": "^2.0.5",
"find-free-port": "^2.0.0",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7153,6 +7153,11 @@ eslint-plugin-prettier@^3.1.1:
dependencies:
prettier-linter-helpers "^1.0.0"

eslint-plugin-simple-import-sort@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-5.0.2.tgz#43b5c4ab5affa2dd8481ef40216c71723becd2e2"
integrity sha512-YPEGo7DbMANQ01d2OXlREcaHRszsW8LoUQ9mIjI7gXSdwpnWKfogtzL6FiBfDf1teCBx+AdcjcfDXSKpmhTWeA==

eslint-rule-docs@^1.1.5:
version "1.1.167"
resolved "https://registry.yarnpkg.com/eslint-rule-docs/-/eslint-rule-docs-1.1.167.tgz#c569599c05d3f4a337d05907ea0ce525803e3d14"
Expand Down

0 comments on commit 1cb39a1

Please sign in to comment.