File tree Expand file tree Collapse file tree 8 files changed +195
-69
lines changed Expand file tree Collapse file tree 8 files changed +195
-69
lines changed Original file line number Diff line number Diff line change 88
88
"eslint-config-prettier" : " ^9.1.0" ,
89
89
"eslint-plugin-antfu" : " ^2.1.2" ,
90
90
"eslint-plugin-eslint-comments" : " ^3.2.0" ,
91
- "eslint-plugin-i " : " ^2.29 .1" ,
91
+ "eslint-plugin-import-x " : " ^0.4 .1" ,
92
92
"eslint-plugin-jsdoc" : " ^48.2.1" ,
93
93
"eslint-plugin-jsonc" : " ^2.13.0" ,
94
94
"eslint-plugin-n" : " ^16.6.2" ,
Original file line number Diff line number Diff line change @@ -107,14 +107,11 @@ export async function typescript(
107
107
rules : {
108
108
...renameRules (
109
109
pluginTs . configs [ 'eslint-recommended' ] . overrides ! [ 0 ] . rules ! ,
110
- '@typescript-eslint/' ,
111
- 'ts/' ,
112
- ) ,
113
- ...renameRules (
114
- pluginTs . configs . strict . rules ! ,
115
- '@typescript-eslint/' ,
116
- 'ts/' ,
110
+ { '@typescript-eslint' : 'ts' } ,
117
111
) ,
112
+ ...renameRules ( pluginTs . configs . strict . rules ! , {
113
+ '@typescript-eslint' : 'ts' ,
114
+ } ) ,
118
115
'no-dupe-class-members' : 'off' ,
119
116
'no-loss-of-precision' : 'off' ,
120
117
'no-redeclare' : 'off' ,
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
28
28
getOverrides ,
29
29
interopDefault ,
30
30
loadPrettierConfig ,
31
+ renamePluginInConfigs ,
31
32
resolveSubOptions ,
32
33
} from './shared'
33
34
import {
@@ -55,6 +56,14 @@ const flatConfigProps: (keyof FlatConfigItem)[] = [
55
56
'settings' ,
56
57
]
57
58
59
+ export const defaultPluginRenaming = {
60
+ '@typescript-eslint' : 'ts' ,
61
+ 'import-x' : 'import' ,
62
+ n : 'node' ,
63
+ vitest : 'test' ,
64
+ yml : 'yaml' ,
65
+ }
66
+
58
67
/**
59
68
* Construct an array of ESLint flat config items.
60
69
*
@@ -70,6 +79,7 @@ export async function defineConfig(
70
79
...userConfigs : Awaitable < UserConfigItem | UserConfigItem [ ] > [ ]
71
80
) : Promise < UserConfigItem [ ] > {
72
81
const {
82
+ autoRenamePlugins = true ,
73
83
componentExts = [ ] ,
74
84
gitignore : enableGitignore = true ,
75
85
isInEditor = defaultIsInEditor ,
@@ -222,7 +232,13 @@ export async function defineConfig(
222
232
} , { } as FlatConfigItem )
223
233
if ( Object . keys ( fusedConfig ) . length > 0 ) configs . push ( [ fusedConfig ] )
224
234
225
- const merged = combine ( ...configs , ...userConfigs )
235
+ const merged = await combine ( ...configs , ...userConfigs )
236
+
237
+ if ( autoRenamePlugins )
238
+ return renamePluginInConfigs ( merged , defaultPluginRenaming )
226
239
227
240
return merged
228
241
}
242
+
243
+ export * from './shared'
244
+ export * from './types'
Original file line number Diff line number Diff line change 3
3
4
4
export { default as pluginAntfu } from 'eslint-plugin-antfu'
5
5
export { default as pluginComments } from 'eslint-plugin-eslint-comments'
6
- export * as pluginImport from 'eslint-plugin-i '
6
+ export * as pluginImport from 'eslint-plugin-import-x '
7
7
export { default as pluginNode } from 'eslint-plugin-n'
8
8
export { default as pluginUnicorn } from 'eslint-plugin-unicorn'
9
9
export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports'
You can’t perform that action at this time.
0 commit comments