import/order ignores pathGroups order
See original GitHub issueeslint ignores the order in which imports are listed
example imports:
import React from 'react';
import Test from "components/Test";
import Api from "pages/api";
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:
"import/order": ["error", {
"newlines-between": "always-and-inside-groups",
"groups": ["builtin", "external", "internal"],
"pathGroups": [
{
"pattern": "react",
"group": "external",
"position": "before"
},
{
"pattern": "~/**",
"group": "external",
"position": "before"
},
{
"pattern": "~/pages/**",
"group": "internal"
},
{
"pattern": "~/components/**",
"group": "internal"
},
{
"pattern": "~/startup/**",
"group": "internal"
},
{
"pattern": "~/hooks/**",
"group": "internal"
},
{
"pattern": "~/helpers/**",
"group": "internal"
},
{
"pattern": "~/generated/**",
"group": "internal"
},
{
"pattern": "~/styles/**",
"group": "internal"
}
],
"pathGroupsExcludedImportTypes": ["react"],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}]
Project structure:
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (1 by maintainers)
Top Results From Across the Web
import/order ignores pathGroups order · Issue #1982 - GitHub
eslint ignores the order in which imports are listed example imports: import React from 'react'; import Test from "components/Test"; ...
Read more >eslint import/order breaks down when using typescript aliases
As you can see, I'm using the pathGroups to tell eslint that the proper position of any import that starts with ~/ is...
Read more >How to quickly configure ESLint for import sorting
How to quickly configure ESlint for import sorting using sort-imports and eslint-plugin-import with the import/orders rule.
Read more >node_modules/eslint-plugin-import/docs/rules/order.md
import/order : Enforce a convention in module import order ... Unassigned imports are ignored, as the order they are imported in may be ......
Read more >Rule: ordered-imports - Palantir Open Source
Requires that import statements be alphabetized and grouped. Enforce a consistent ordering for ES6 imports: Named imports must be alphabetized (i.e. “import {A, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Try this:
and include
warnOnUnassignedImports: true,
since thosescss
(and more) are treated as unassigned files@ludwig-pro thank you for response and looks like there is issues with it #1239