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 8888 "eslint-config-prettier" : " ^9.1.0" ,
8989 "eslint-plugin-antfu" : " ^2.1.2" ,
9090 "eslint-plugin-eslint-comments" : " ^3.2.0" ,
91- "eslint-plugin-i " : " ^2.29 .1" ,
91+ "eslint-plugin-import-x " : " ^0.4 .1" ,
9292 "eslint-plugin-jsdoc" : " ^48.2.1" ,
9393 "eslint-plugin-jsonc" : " ^2.13.0" ,
9494 "eslint-plugin-n" : " ^16.6.2" ,
Original file line number Diff line number Diff line change @@ -107,14 +107,11 @@ export async function typescript(
107107 rules : {
108108 ...renameRules (
109109 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' } ,
117111 ) ,
112+ ...renameRules ( pluginTs . configs . strict . rules ! , {
113+ '@typescript-eslint' : 'ts' ,
114+ } ) ,
118115 'no-dupe-class-members' : 'off' ,
119116 'no-loss-of-precision' : 'off' ,
120117 'no-redeclare' : 'off' ,
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
2828 getOverrides ,
2929 interopDefault ,
3030 loadPrettierConfig ,
31+ renamePluginInConfigs ,
3132 resolveSubOptions ,
3233} from './shared'
3334import {
@@ -55,6 +56,14 @@ const flatConfigProps: (keyof FlatConfigItem)[] = [
5556 'settings' ,
5657]
5758
59+ export const defaultPluginRenaming = {
60+ '@typescript-eslint' : 'ts' ,
61+ 'import-x' : 'import' ,
62+ n : 'node' ,
63+ vitest : 'test' ,
64+ yml : 'yaml' ,
65+ }
66+
5867/**
5968 * Construct an array of ESLint flat config items.
6069 *
@@ -70,6 +79,7 @@ export async function defineConfig(
7079 ...userConfigs : Awaitable < UserConfigItem | UserConfigItem [ ] > [ ]
7180) : Promise < UserConfigItem [ ] > {
7281 const {
82+ autoRenamePlugins = true ,
7383 componentExts = [ ] ,
7484 gitignore : enableGitignore = true ,
7585 isInEditor = defaultIsInEditor ,
@@ -222,7 +232,13 @@ export async function defineConfig(
222232 } , { } as FlatConfigItem )
223233 if ( Object . keys ( fusedConfig ) . length > 0 ) configs . push ( [ fusedConfig ] )
224234
225- const merged = combine ( ...configs , ...userConfigs )
235+ const merged = await combine ( ...configs , ...userConfigs )
236+
237+ if ( autoRenamePlugins )
238+ return renamePluginInConfigs ( merged , defaultPluginRenaming )
226239
227240 return merged
228241}
242+
243+ export * from './shared'
244+ export * from './types'
Original file line number Diff line number Diff line change 33
44export { default as pluginAntfu } from 'eslint-plugin-antfu'
55export { 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 '
77export { default as pluginNode } from 'eslint-plugin-n'
88export { default as pluginUnicorn } from 'eslint-plugin-unicorn'
99export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports'
You can’t perform that action at this time.
0 commit comments