Skip to content

Commit 458f4d2

Browse files
committed
feat(eslint): enforce specific order for import statements
Enabled and configured the `import/order` rule with custom settings to alphabetize imports, organize them into specific groups, and enforce newlines between groups. This aims to improve the readability and consistency of import statements within the codebase.
1 parent 84f1a80 commit 458f4d2

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

packages/config-eslint/rules/common.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,32 @@ module.exports = {
2222
'import/no-default-export': 'off',
2323

2424
/** Enforces a specific order for import statements */
25-
'import/order': 'off',
25+
'import/order': [
26+
'error',
27+
{
28+
alphabetize: {
29+
order: 'asc',
30+
caseInsensitive: true,
31+
},
32+
groups: [
33+
'builtin',
34+
'external',
35+
'internal',
36+
'parent',
37+
'sibling',
38+
'index',
39+
],
40+
'newlines-between': 'always',
41+
pathGroups: [
42+
{
43+
pattern: '@/**',
44+
group: 'internal',
45+
position: 'before',
46+
},
47+
],
48+
pathGroupsExcludedImportTypes: ['builtin'],
49+
},
50+
],
2651

2752
/** Prevents fallthrough in switch statements but allows empty cases */
2853
'no-fallthrough': [

0 commit comments

Comments
 (0)