-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import/order ignores pathGroups order #1982
Comments
Your config has Can you make a repro repo? |
I think there is a bug when ESLint load the config, so config-validator.js : Configuration for rule "import/order" is invalid:
Value {"newlines-between":"always","groups":[["builtin","external"],["internal","index","sibling","parent"]],"alphabetize":{"order":"asc","caseInsensitive":true},"pathGroups":[{"pattern":"~/**","group":"internal"}],"pathGroupsExcludedImportTypes":[]} should NOT have additional properties. |
maybe related to #1682 |
Doesn't work
result is still same
Any ideas? |
look at the ESLint output in vscode if there is any mistake with your config. for me, autofix works again after cleaning extends / plugins (there are conflits somethings) |
@ludwig-pro thank you for response and looks like there is issues with it #1239 |
Try this:
and include |
in one of the answers on stackoverflow it was written: "After some research, it seems that eslint community does not want to add auto-sorting for unassigned imports due to the fact, that they might depend on import order. That is the reason, why your snippet of pathGroups does not work" original: anyway you can use css-modules for fix that problem: |
If anyone expires the same error with custom d.ts files for react-select, here is the solution: 'import/order': [
'error',
{
pathGroups: [
{
pattern: 'react-select',
patternOptions: { matchBase: true },
group: 'external'
}
],
groups: [
'builtin',
'external',
'internal',
'parent',
'index',
'sibling',
],
},
], Note the |
eslint ignores the order in which imports are listed
example imports:
eslint must throw an error saying that import from "pages/api" must be over "components/Test" and also be separated with a new line but it ignores this
eslint-plugin-import and eslint-import-resolver-typescript are already installed so I'm sure that I made a mistake somewhere, but where?
eslint rule:
Project structure:
The text was updated successfully, but these errors were encountered: