Skip to content

Commit e934b69

Browse files
committed
chore(eslint): add simple-import-sort and consistent-type-imports rules
1 parent d5561ef commit e934b69

3 files changed

Lines changed: 50 additions & 4 deletions

File tree

eslint.config.mjs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import packageJson from 'eslint-plugin-package-json';
1212
import typescriptEslintEslintPlugin from '@typescript-eslint/eslint-plugin';
1313
import nxEslintPlugin from '@nx/eslint-plugin';
1414
import eslintPluginImport from 'eslint-plugin-import';
15+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
1516
import typescriptEslintParser from '@typescript-eslint/parser';
1617

1718
const compat = new FlatCompat({
@@ -39,6 +40,38 @@ export default [
3940
'@typescript-eslint': typescriptEslintEslintPlugin,
4041
'@nx': nxEslintPlugin,
4142
import: eslintPluginImport,
43+
'simple-import-sort': simpleImportSort,
44+
},
45+
},
46+
{
47+
rules: {
48+
'simple-import-sort/imports': [
49+
'warn',
50+
{
51+
groups: [
52+
// value imports from packages
53+
['^\\u0000[^.$]', '^[^.$]'],
54+
// value imports from relative paths
55+
['^\\u0000\\.', '^\\.'],
56+
// type-only imports from packages
57+
['^[^.$].*\\u0000$'],
58+
// type-only imports from relative paths
59+
['^(\\.).*\\u0000$'],
60+
],
61+
},
62+
],
63+
},
64+
},
65+
{
66+
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
67+
rules: {
68+
'@typescript-eslint/consistent-type-imports': [
69+
'warn',
70+
{
71+
prefer: 'type-imports',
72+
fixStyle: 'separate-type-imports',
73+
},
74+
],
4275
},
4376
},
4477
{

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"nx": "nx",
3636
"prepare": "lefthook install",
3737
"serve": "nx serve",
38-
"syncpack:lint": "syncpack lint --source 'package.json' --source 'packages/*/package.json' --source 'packages/sdk-effects/*/package.json' --source 'packages/utils/*/package.json' --source 'e2e/*/package.json' --source 'tools/*/package.json' --source 'scratchpad/package.json'",
3938
"syncpack:fix": "syncpack fix --source 'package.json' --source 'packages/*/package.json' --source 'packages/sdk-effects/*/package.json' --source 'packages/utils/*/package.json' --source 'e2e/*/package.json' --source 'tools/*/package.json' --source 'scratchpad/package.json'",
39+
"syncpack:lint": "syncpack lint --source 'package.json' --source 'packages/*/package.json' --source 'packages/sdk-effects/*/package.json' --source 'packages/utils/*/package.json' --source 'e2e/*/package.json' --source 'tools/*/package.json' --source 'scratchpad/package.json'",
4040
"test": "CI=true nx affected:test",
4141
"test:e2e": "CI=true nx affected:e2e",
4242
"verdaccio": "nx local-registry",
@@ -93,6 +93,7 @@
9393
"eslint-plugin-package-json": "0.91.1",
9494
"eslint-plugin-playwright": "^2.0.0",
9595
"eslint-plugin-prettier": "^5.2.3",
96+
"eslint-plugin-simple-import-sort": "^13.0.0",
9697
"fast-check": "^4.0.0",
9798
"jiti": "2.6.1",
9899
"jsdom": "27.4.0",

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)