Skip to content

Commit 6323a1b

Browse files
authored
Merge pull request #392 from Commencis/fix/direct-style-imports
fix(eslint-config): side-effect css imports
2 parents f695d55 + 5c7df7b commit 6323a1b

File tree

4 files changed

+42
-260
lines changed

4 files changed

+42
-260
lines changed

.changeset/crazy-monkeys-boil.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@commencis/eslint-config': minor
3+
---
4+
5+
feat: include side-effect scss imports to sorting

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
},
4848
"devDependencies": {
4949
"@changesets/cli": "2.29.7",
50-
"@commencis/commitlint-config": "1.1.4",
51-
"@commencis/eslint-config": "2.1.1",
52-
"@commencis/lint-staged-config": "1.1.0",
50+
"@commencis/commitlint-config": "1.2.0",
51+
"@commencis/eslint-config": "2.2.0",
52+
"@commencis/lint-staged-config": "1.2.0",
5353
"@commencis/prettier-config": "2.0.0",
5454
"@commencis/ts-config": "0.0.2",
5555
"@commitlint/cli": "20.0.0",

packages/eslint-config/src/rules/importSortRules.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,23 @@ const GROUPS: Record<string, string[]> = {
7575
RELATIVE_PARENT: ['^\\.\\.(?!/?$)', '^\\.\\./?$'],
7676
RELATIVE_SAME: ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
7777

78-
// Styles
79-
STYLES: ['^@/.+\\.s?css$', '^\\./.+\\.s?css$'],
80-
8178
// Assets
8279
ASSETS: [
8380
'(asset(s?)|public|static|images)(/.*|$)',
8481
'^@/.+\\.(svg|png)$',
8582
'^.+\\.svg$',
8683
'^.+\\.png$',
8784
],
85+
86+
// Styles
87+
STYLES: [
88+
// side-effect - virtual css imports
89+
'^\\u0000.+\\.s?css$',
90+
// root alias css imports
91+
'^@/.+\\.s?css$',
92+
// relative css imports
93+
'^(\\.{1,2}/).+\\.s?css$',
94+
],
8895
};
8996

9097
export const importSortRules: Linter.RulesRecord = {
@@ -100,8 +107,8 @@ export const importSortRules: Linter.RulesRecord = {
100107
withTypeFirst(GROUPS.INTERNAL_ROOT),
101108
withTypeFirst(GROUPS.RELATIVE_PARENT),
102109
withTypeFirst(GROUPS.RELATIVE_SAME),
103-
GROUPS.STYLES,
104110
GROUPS.ASSETS,
111+
GROUPS.STYLES,
105112
],
106113
},
107114
],

0 commit comments

Comments
 (0)