is any options to add `exclude pathGroup` in `import/order`?
Hi. I have a question for using import/order
I have import ordering dependency in code, so I want to set pathGroup to exclude.
is any options to add exclude pathGroup in import/order?
Can you elaborate? Example code and what you want it to do, and what it currently does, would be helpful.
Hi @ljharb! Thanks for your reply!
In some reasons, I have to set css, scss file to buttom of import area. Here's example.
import React from 'react';
import ComponentA from 'client/component/A';
...
import Style from 'client/common/style/a.css'. //have to be buttom
import StyleA from './styleA.scss'; //have to be bottom
I use alphabetize option in import/order, so when eslint --fix, Style import codes goes up.
To prevent it, I set the parent, sibling group to bottom, but it only works for 'relative path'.
Here's my rules.
"import/order": [
"error",
{
"groups": [
"builtin",
"external",
"internal",
"index",
"object",
"type",
["parent", "sibling"]
],
"pathGroups": [
{
"pattern": "react*",
"group": "builtin",
"position": "before"
},
],
"pathGroupsExcludedImportTypes": ["react"],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"newlines-between": "never"
}
]
I want to make style import codes with using absolute path exclude for import/order rules
Why do they have to be at the bottom?
(also note that it's an absolute path only when it starts with /; it's a package specifier when it starts with something that's not . or /)