Skip to content

Commit

Permalink
Merge pull request #373 from Vizzuality/feat/order-imports
Browse files Browse the repository at this point in the history
feat: order imports eslint configs
  • Loading branch information
mbarrenechea authored Jul 28, 2021
2 parents 2dc03e7 + e36dd48 commit 43105f5
Show file tree
Hide file tree
Showing 3 changed files with 259 additions and 70 deletions.
73 changes: 72 additions & 1 deletion app/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
'plugin:react/recommended', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:cypress/recommended',
],
plugins: ['cypress'],
plugins: ['cypress', 'import'],
rules: {
// Place to specify ESLint rules.
// Can be used to overwrite rules specified from the extended configs
Expand All @@ -31,5 +31,76 @@ module.exports = {
'import/no-named-as-default': 0,
'import/prefer-default-export': 0,
'no-param-reassign': ['error', { props: false }],
'import/order': [
'warn',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
pathGroups: [
{
pattern: 'react',
group: 'builtin',
position: 'before',
},
{
pattern: 'react**',
group: 'builtin',
},
{
pattern: '@react**',
group: 'builtin',
},
{
pattern: 'next/**',
group: 'builtin',
position: 'after',
},
{
pattern: 'node_modules/**',
group: 'builtin',
},
{
pattern: 'hooks/**',
group: 'builtin',
position: 'after',
},
{
pattern: 'hoc/**',
group: 'external',
position: 'before',
},
{
pattern: 'store/**',
group: 'external',
},
{
pattern: 'layout/**',
group: 'internal',
position: 'before',
},
{
pattern: 'components/**',
group: 'internal',
},
{
pattern: 'images/**',
group: 'internal',
position: 'after',
},
{
pattern: 'svgs/**',
group: 'internal',
position: 'after',
},
],
pathGroupsExcludedImportTypes: [
'react',
],
},
],
},
};
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"eslint": "^7.14.0",
"eslint-config-airbnb-typescript": "^12.0.0",
"eslint-plugin-cypress": "^2.11.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
Expand Down
Loading

0 comments on commit 43105f5

Please sign in to comment.