-
-
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
[order] How to force React at the top and other issues #1874
Comments
There needs to be a newline between each group - so, one after react, and one after the node modules (path), and one after the material UI ones. |
But if you look at the
Why? It's not part of the built-in group is it? |
hmm, i see what you mean. if you comment out the pathGroups setting, what happens? |
Removing the
|
@angrybacon you need
That works on groups, not regexes. By default it includes also "external", to which |
@kalvisk-blockvis Thanks 👍 that works. Regarding the newlines however, am I wrong to assume that my above setup should require a newline only between the two groups? {
"import/order": ["warn", {
"alphabetize": {"order": "asc"},
"groups": [
["builtin", "external", "internal"], // <- First group
["parent", "sibling", "index"] // <- Second group
],
"newlines-between": "always",
"pathGroups": [
{"group": "builtin", "pattern": "react", "position": "before"},
{"group": "external", "pattern": "@material-ui/**", "position": "after"},
{"group": "external", "pattern": "@reach/**", "position": "after"},
{"group": "external", "pattern": "@saeris/**", "position": "after"}
],
"pathGroupsExcludedImportTypes": ["builtin"]
}]
} Currently it treats all custom ordered subgroups as groups requiring a newline between them. Just to be clear, what I wish to accomplish is like in the above screenshot, except with a newline between my |
@angrybacon I also assumed that newlines would be only between groups, not subgroups, but apparently it puts newlines between both groups and subgroups. I also wish for a nice-to-have feature request that separates this behavior and have two unambiguous config values instead, e.g. {
"import/order": ["warn", {
- "newlines-between": "always",
+ "newlines-between-groups": "always",
+ "newlines-between-subgroups": "never",
}]
} |
@kalvisk-blockvis Oh I see. Thanks for the clarification :-) |
I have several issues that I can't fix even with some of the understanding I had from #1665.
The following configuration:
With the following code:
Still gives me the following warnings:
What am I missing here? Also, why is it expecting more newlines since I've set 2 groups?
The text was updated successfully, but these errors were encountered: