I have large eslint file in my project which satisfies all my needs. Also, I have an import/order
rule which lints the order of imports, but I need one specific, maybe even custom rule to make import s from './style.module.scss
to be ALWAYS come after all imports.
So now with my current linter this case:
import s from './asset-manager.module.scss';
import { AssetsList } from './components';
won’t occur any warning or error, but it should. So in this case it should mark it as an error, and put ANY style file AFTER all imports with one empty line on top so it will be:
import { AssetsList } from './components';
import s from './asset-manager.module.scss';
I already tried to implement it but it still doesn’t mark it is incorrect.
Rules
"rules": {
"arrow-body-style": "off",
"prefer-arrow-callback": "off",
"import/prefer-default-export": "off",
"react-hooks/exhaustive-deps": "off",
"no-plusplus": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"prefer-const": "warn",
"function-paren-newline": "off",
"object-shorthand": "warn",
"no-multi-spaces": "error",
"no-restricted-imports": "warn",
"quotes": [
"error",
"single"
],
"max-len": [
"error",
{
"code": 110,
"ignorePattern": "d="([\s\S]*?)""
}
],
"max-lines": [
"error",
{
"max": 600,
"skipBlankLines": true,
"skipComments": true
}
],
"no-console": [
"warn",
{
"allow": [
"warn",
"error"
]
}
],
"import/order": [
"error",
{
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"newlines-between": "always",
"groups": [
[
"builtin",
"external"
],
[
"internal"
],
[
"parent",
"sibling",
"index"
]
],
"pathGroups": [
{
"pattern": "**/*.css",
"group": "index",
"position": "after"
},
{
"pattern": "**/*.scss",
"group": "index",
"position": "after"
}
],
"pathGroupsExcludedImportTypes": [
"builtin",
"external"
]
}
]
}
namely, here is import/order
section:
"import/order": [
"error",
{
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"newlines-between": "always",
"groups": [
[
"builtin",
"external"
],
[
"internal"
],
[
"parent",
"sibling",
"index"
]
],
"pathGroups": [
{
"pattern": "**/*.css",
"group": "index",
"position": "after"
},
{
"pattern": "**/*.scss",
"group": "index",
"position": "after"
}
],
"pathGroupsExcludedImportTypes": [
"builtin",
"external"
]
}
]