Skip to content

Commit

Permalink
build: make in sort that imports sort automatically for web projects
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Espiau <frederic.espiau@corp.ovh.com>
  • Loading branch information
Frederic Espiau committed Mar 2, 2020
1 parent 0afcd1b commit d9d1918
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 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', '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 @@ -49,6 +49,7 @@
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-markdown": "^1.0.2",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-simple-import-sort": "^5.0.1",
"execa": "^2.0.5",
"find-free-port": "^2.0.0",
"get-monorepo-packages": "^1.2.0",
Expand Down
27 changes: 16 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -515,20 +515,15 @@
esutils "^2.0.2"
js-tokens "^4.0.0"

"@babel/parser@^7.7.0", "@babel/parser@^7.8.6":
version "7.8.6"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.6.tgz#ba5c9910cddb77685a008e3c587af8d27b67962c"
integrity sha512-trGNYSfwq5s0SgM1BMEB8hX3NDmO7EP2wsDGDexiaKMB92BaRpS+qZfpkMqUBhcsOTBwNy9B/jieo4ad/t/z2g==

"@babel/parser@^7.7.4", "@babel/parser@^7.7.5":
"@babel/parser@^7.7.0", "@babel/parser@^7.7.4", "@babel/parser@^7.7.5":
version "7.7.5"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71"
integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig==

"@babel/parser@^7.7.7":
version "7.7.7"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.7.tgz#1b886595419cf92d811316d5b715a53ff38b4937"
integrity sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==
"@babel/parser@^7.7.7", "@babel/parser@^7.8.6":
version "7.8.6"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.6.tgz#ba5c9910cddb77685a008e3c587af8d27b67962c"
integrity sha512-trGNYSfwq5s0SgM1BMEB8hX3NDmO7EP2wsDGDexiaKMB92BaRpS+qZfpkMqUBhcsOTBwNy9B/jieo4ad/t/z2g==

"@babel/plugin-proposal-async-generator-functions@^7.2.0":
version "7.7.4"
Expand Down Expand Up @@ -3778,6 +3773,11 @@ ansi-regex@^2.0.0:
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8=

ansi-regex@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998"
integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=

ansi-regex@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997"
Expand Down Expand Up @@ -7759,7 +7759,7 @@ eslint-plugin-angular@^4.0.1:
resolved "https://registry.yarnpkg.com/eslint-plugin-angular/-/eslint-plugin-angular-4.0.1.tgz#f6c01d2a1e549d603e29eceb8615b5a989863a5e"
integrity sha512-OaW5G461C2lIkOG+/bhnBoXB9UQm/r0Dj2Qf9uiIN0/ncvf2Llp30L0q1tqWkN8/CxyBwQKh1v0hpCLLDjaIKQ==

eslint-plugin-import@^2.20.0, eslint-plugin-import@^2.20.1:
eslint-plugin-import@^2.20.1:
version "2.20.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz#802423196dcb11d9ce8435a5fc02a6d3b46939b3"
integrity sha512-qQHgFOTjguR+LnYRoToeZWT62XM55MBVXObHM6SKFd1VzDcX/vqT1kAz8ssqigh5eMj8qXcRoXXGZpPP6RfdCw==
Expand Down Expand Up @@ -7793,6 +7793,11 @@ eslint-plugin-prettier@^3.1.2:
dependencies:
prettier-linter-helpers "^1.0.0"

eslint-plugin-simple-import-sort@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-5.0.1.tgz#fd47d3ed2af30db3dd2cadaed285ad510dde479b"
integrity sha512-s6Hjp9rcIDYT1h7tuTulblbY7+XQNZK+014uUkNJSKRXEHZO2i7CTr16HOpfgD9HDnUOpl0fwphPsr0oxZqgGg==

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 d9d1918

Please sign in to comment.