Skip to content

Commit db5a31d

Browse files
committed
fix: remove eslint-plugin-import-x
Consider we don't really use a lot feature from import-x, while it's rather heavy and recently introduced some binary package. I think it's better to avoid using it and keep this config lightweight and more portable. - `import/consistent-type-specifier-style` -> `ts/consistent-type-imports` - `import/no-duplicates` -> `antfu/import-dedupe` - `import/newline-after-import` -> `style/padding-line-between-statements` for the other rules, I found their are not always strictly necessary. I am trying to remove them and see how it would affect the DX, and might bring back some of them if needed.
1 parent dad9a58 commit db5a31d

File tree

8 files changed

+13
-385
lines changed

8 files changed

+13
-385
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ Since flat config requires us to explicitly provide the plugin names (instead of
384384

385385
| New Prefix | Original Prefix | Source Plugin |
386386
| ---------- | ---------------------- | ------------------------------------------------------------------------------------------ |
387-
| `import/*` | `import-x/*` | [eslint-plugin-import-x](https://github.com/un-es/eslint-plugin-import-x) |
388387
| `node/*` | `n/*` | [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) |
389388
| `yaml/*` | `yml/*` | [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml) |
390389
| `ts/*` | `@typescript-eslint/*` | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) |

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@
119119
"eslint-merge-processors": "catalog:prod",
120120
"eslint-plugin-antfu": "catalog:prod",
121121
"eslint-plugin-command": "catalog:prod",
122-
"eslint-plugin-import-x": "catalog:prod",
123122
"eslint-plugin-jsdoc": "catalog:prod",
124123
"eslint-plugin-jsonc": "catalog:prod",
125124
"eslint-plugin-n": "catalog:prod",

pnpm-lock.yaml

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

pnpm-workspace.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ catalogs:
5656
eslint-merge-processors: ^2.0.0
5757
eslint-plugin-antfu: ^3.1.1
5858
eslint-plugin-command: ^3.2.1
59-
eslint-plugin-import-x: ^4.15.1
6059
eslint-plugin-jsdoc: ^50.7.1
6160
eslint-plugin-jsonc: ^2.20.1
6261
eslint-plugin-n: ^17.19.0

src/configs/imports.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,18 @@
11
import type { OptionsStylistic, TypedFlatConfigItem } from '../types'
22

3-
import { pluginAntfu, pluginImport } from '../plugins'
4-
5-
export async function imports(options: OptionsStylistic = {}): Promise<TypedFlatConfigItem[]> {
6-
const {
7-
stylistic = true,
8-
} = options
3+
import { pluginAntfu } from '../plugins'
94

5+
export async function imports(_options: OptionsStylistic = {}): Promise<TypedFlatConfigItem[]> {
106
return [
117
{
128
name: 'antfu/imports/rules',
139
plugins: {
1410
antfu: pluginAntfu,
15-
import: pluginImport,
1611
},
1712
rules: {
1813
'antfu/import-dedupe': 'error',
1914
'antfu/no-import-dist': 'error',
2015
'antfu/no-import-node-modules-by-path': 'error',
21-
22-
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
23-
'import/first': 'error',
24-
'import/no-duplicates': 'error',
25-
'import/no-mutable-exports': 'error',
26-
'import/no-named-default': 'error',
27-
'import/no-self-import': 'error',
28-
'import/no-webpack-loader-syntax': 'error',
29-
30-
...stylistic
31-
? {
32-
'import/newline-after-import': ['error', { count: 1 }],
33-
}
34-
: {},
3516
},
3617
},
3718
]

src/configs/stylistic.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { OptionsOverrides, StylisticConfig, TypedFlatConfigItem } from '../types'
2-
32
import { pluginAntfu } from '../plugins'
43
import { interopDefault } from '../utils'
54

@@ -64,6 +63,11 @@ export async function stylistic(
6463
),
6564

6665
'style/generator-star-spacing': ['error', { after: true, before: false }],
66+
'style/padding-line-between-statements': [
67+
'error',
68+
{ blankLine: 'always', next: '*', prev: 'import' },
69+
{ blankLine: 'any', next: 'import', prev: 'import' },
70+
],
6771
'style/yield-star-spacing': ['error', { after: true, before: false }],
6872

6973
...overrides,

src/factory.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export const defaultPluginRenaming = {
6262

6363
'@stylistic': 'style',
6464
'@typescript-eslint': 'ts',
65-
'import-x': 'import',
6665
'n': 'node',
6766
'vitest': 'test',
6867
'yml': 'yaml',

src/plugins.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
export { default as pluginComments } from '@eslint-community/eslint-plugin-eslint-comments'
55
export { default as pluginAntfu } from 'eslint-plugin-antfu'
6-
export * as pluginImport from 'eslint-plugin-import-x'
76
export { default as pluginNode } from 'eslint-plugin-n'
87
export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist'
98
export { default as pluginUnicorn } from 'eslint-plugin-unicorn'

0 commit comments

Comments
 (0)