Last active
January 3, 2023 08:27
-
-
Save jimmyhoran/fc0c1d8e910ef292d87a83425b57df27 to your computer and use it in GitHub Desktop.
ESLint rc config with rules for import sorting and grouping. Requires `npm i -D eslint-plugin-import` to be installed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"extends": ["prettier", "plugin:prettier/recommended"], | |
"plugins": ["prettier", "import"], | |
"rules": { | |
"import/order": [ | |
"error", | |
{ | |
"groups": ["builtin", "external", "parent", "sibling", "index"], | |
"pathGroups": [ | |
{ | |
"pattern": "@custom-lib/**", | |
"group": "external", | |
"position": "after" | |
} | |
], | |
"pathGroupsExcludedImportTypes": ["builtin"], | |
"alphabetize": { | |
"order": "asc" | |
}, | |
"newlines-between": "always" | |
} | |
], | |
"sort-imports": [ | |
"error", | |
{ | |
"allowSeparatedGroups": true, | |
"ignoreDeclarationSort": true | |
} | |
], | |
"no-duplicate-imports": "error", | |
"no-multiple-empty-lines": [ | |
"error", | |
{ | |
"max": 1, | |
"maxEOF": 0, | |
"maxBOF": 0 | |
} | |
], | |
"import/first": "error", | |
"import/newline-after-import": "error", | |
"import/no-duplicates": "error", | |
"import/no-unassigned-import": "error", | |
"prettier/prettier": [ | |
"error", | |
{ | |
"singleQuote": false, | |
"semi": false, | |
"jsxSingleQuote": true | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment