@@ -41,6 +41,7 @@ const sharedRules = {
41
41
}
42
42
43
43
const sharedRulesForImportX = {
44
+ ...origImportXFlatConfigs . recommended . rules ,
44
45
'import-x/order' : [
45
46
'warn' ,
46
47
{
@@ -66,35 +67,38 @@ const sharedRulesForImportX = {
66
67
]
67
68
}
68
69
69
- const getImportXFlatConfigs = isEsm => ( {
70
- recommended : {
71
- ...origImportXFlatConfigs . recommended ,
72
- languageOptions : {
73
- ...origImportXFlatConfigs . recommended . languageOptions ,
74
- ecmaVersion : LATEST ,
75
- sourceType : isEsm ? 'module' : 'script'
70
+ function getImportXFlatConfigs ( isEsm ) {
71
+ return {
72
+ recommended : {
73
+ ...origImportXFlatConfigs . recommended ,
74
+ languageOptions : {
75
+ ...origImportXFlatConfigs . recommended . languageOptions ,
76
+ ecmaVersion : LATEST ,
77
+ sourceType : isEsm ? 'module' : 'script'
78
+ } ,
79
+ rules : {
80
+ ...sharedRulesForImportX ,
81
+ 'import-x/no-named-as-default-member' : 'off'
82
+ }
76
83
} ,
77
- rules : {
78
- ...origImportXFlatConfigs . recommended . rules ,
79
- ...sharedRulesForImportX ,
80
- 'import-x/no-named-as-default-member' : 'off'
81
- }
82
- } ,
83
- typescript : {
84
- ...origImportXFlatConfigs . typescript ,
85
- settings : {
86
- ...origImportXFlatConfigs . typescript . settings ,
87
- 'import-x/resolver-next' : [
88
- createOxcImportResolver ( {
89
- tsConfig : {
90
- configFile : rootTsConfigPath ,
91
- references : 'auto'
92
- }
93
- } )
94
- ]
84
+ typescript : {
85
+ ...origImportXFlatConfigs . typescript ,
86
+ plugins : origImportXFlatConfigs . recommended . plugins ,
87
+ settings : {
88
+ ...origImportXFlatConfigs . typescript . settings ,
89
+ ...sharedRulesForImportX ,
90
+ 'import-x/resolver-next' : [
91
+ createOxcImportResolver ( {
92
+ tsConfig : {
93
+ configFile : rootTsConfigPath ,
94
+ references : 'auto'
95
+ }
96
+ } )
97
+ ]
98
+ }
95
99
}
96
100
}
97
- } )
101
+ }
98
102
99
103
const importFlatConfigsForScript = getImportXFlatConfigs ( false )
100
104
const importFlatConfigsForModule = getImportXFlatConfigs ( true )
@@ -126,13 +130,13 @@ module.exports = [
126
130
}
127
131
}
128
132
} ,
133
+ linterOptions : {
134
+ reportUnusedDisableDirectives : 'off'
135
+ } ,
129
136
plugins : {
130
137
...sharedPlugins ,
131
138
'@typescript-eslint' : tsEslint . plugin
132
139
} ,
133
- linterOptions : {
134
- reportUnusedDisableDirectives : 'off'
135
- } ,
136
140
rules : {
137
141
...sharedRules ,
138
142
// Define @typescript -eslint/no-extraneous-class because oxlint defines
@@ -167,17 +171,10 @@ module.exports = [
167
171
}
168
172
} ,
169
173
{
170
- files : [ 'scripts/**/*.js' , 'test/**/*.cjs' ] ,
171
- ...nodePlugin . configs [ 'flat/recommended-script' ]
172
- } ,
173
- {
174
- files : [ 'scripts/**/*.js' , 'test/**/*.cjs' ] ,
175
- plugins : {
176
- ...sharedPlugins
177
- } ,
174
+ files : [ 'scripts/**/*.{c,}js' , 'test/**/*.{c,}js' ] ,
175
+ ...nodePlugin . configs [ 'flat/recommended-script' ] ,
178
176
rules : {
179
- ...js . configs . recommended . rules ,
180
- ...sharedRules ,
177
+ ...nodePlugin . configs [ 'flat/recommended-script' ] . rules ,
181
178
'n/exports-style' : [ 'error' , 'module.exports' ] ,
182
179
// The n/no-unpublished-bin rule does does not support non-trivial glob
183
180
// patterns used in package.json "files" fields. In those cases we simplify
@@ -199,5 +196,15 @@ module.exports = [
199
196
{ argsIgnorePattern : '^_|^this$' , ignoreRestSiblings : true }
200
197
]
201
198
}
199
+ } ,
200
+ {
201
+ files : [ 'scripts/**/*.{c,}js' , 'test/**/*.{c,}js' ] ,
202
+ plugins : {
203
+ ...sharedPlugins
204
+ } ,
205
+ rules : {
206
+ ...js . configs . recommended . rules ,
207
+ ...sharedRules
208
+ }
202
209
}
203
210
]
0 commit comments