Skip to content

Commit d8d11dc

Browse files
committed
feat: enforce consistent imports with import/order
1 parent d665151 commit d8d11dc

File tree

3 files changed

+133
-0
lines changed

3 files changed

+133
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"common-tags": "^1.8.2",
3838
"eslint": "^9.5.0",
3939
"eslint-config-prettier": "^9.1.0",
40+
"eslint-plugin-import-x": "^3.0.1",
4041
"eslint-plugin-jsonc": "^2.16.0",
4142
"eslint-plugin-prettier": "^5.1.3",
4243
"globals": "^15.6.0",

pnpm-lock.yaml

Lines changed: 122 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/configs/recommended.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import stylisticTS from '@stylistic/eslint-plugin-ts';
22
import * as tsParser from '@typescript-eslint/parser';
33
import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
4+
import pluginImport from 'eslint-plugin-import-x';
45
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
56
import tseslint from 'typescript-eslint';
67
import { rules as blitzRules } from '../rules';
@@ -56,5 +57,14 @@ export function recommended(extenions?: RuleExtensions): FlatConfig.ConfigArray
5657
...tsRules(extenions?.ts),
5758
},
5859
},
60+
{
61+
plugins: {
62+
import: pluginImport,
63+
},
64+
rules: {
65+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/order.md
66+
'import/order': ['error', { alphabetize: { order: 'asc' } }],
67+
},
68+
},
5969
];
6070
}

0 commit comments

Comments
 (0)