@@ -8,13 +8,9 @@ import eslintPluginUnicorn from 'eslint-plugin-unicorn';
8
8
9
9
/** @typedef {import('eslint').Linter } Linter */
10
10
11
- /** @type {Linter.Config[] } */
12
- const baseConfig = [
13
- js . configs . recommended ,
14
-
11
+ export const importConfig = [
15
12
importPlugin . flatConfigs . recommended ,
16
13
{
17
- files : [ '**/*.{js,mjs,cjs}' ] ,
18
14
languageOptions : {
19
15
ecmaVersion : 'latest' ,
20
16
sourceType : 'module' ,
@@ -98,8 +94,27 @@ const baseConfig = [
98
94
] ,
99
95
} ,
100
96
] ,
97
+
98
+ // disabled due to https://github.com/import-js/eslint-plugin-import/issues/3076
99
+ 'import/no-unresolved' : 'off' ,
101
100
} ,
102
101
} ,
102
+ ] ;
103
+
104
+ /**
105
+ * Set configs file patters in case config does not have one.
106
+ *
107
+ * @param {Linter.Config[] } configs
108
+ * @param {string[] } files
109
+ * @return {Linter.Config[] }
110
+ */
111
+ export function adjustESLintConfigFiles ( configs , files ) {
112
+ return configs . map ( ( cfg ) => ( { files, ...cfg } ) ) ;
113
+ }
114
+
115
+ /** @type {Linter.Config[] } */
116
+ const baseConfig = [
117
+ js . configs . recommended ,
103
118
104
119
pluginPromise . configs [ 'flat/recommended' ] ,
105
120
{
@@ -109,6 +124,8 @@ const baseConfig = [
109
124
} ,
110
125
} ,
111
126
127
+ ...importConfig ,
128
+
112
129
eslintPluginNoUseExtendNative . configs . recommended ,
113
130
114
131
eslintPluginUnicorn . configs [ 'flat/recommended' ] ,
@@ -242,10 +259,7 @@ const baseConfig = [
242
259
} ,
243
260
} ,
244
261
245
- {
246
- ...xo [ 0 ] ,
247
- files : [ '*.{js,mjs,cjs,ts,tsx,jsx}' ] ,
248
- } ,
262
+ ...xo ,
249
263
{
250
264
rules : {
251
265
// annoying rules
@@ -256,9 +270,11 @@ const baseConfig = [
256
270
// conflicts with prettier
257
271
'@stylistic/object-curly-spacing' : 'off' ,
258
272
'@stylistic/quotes' : 'off' ,
273
+ '@stylistic/arrow-parens' : 'off' ,
274
+ '@stylistic/comma-dangle' : 'off' ,
259
275
} ,
260
276
} ,
261
277
eslintPluginPrettierRecommended ,
262
278
] ;
263
279
264
- export default baseConfig ;
280
+ export default adjustESLintConfigFiles ( baseConfig , [ '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}' ] ) ;
0 commit comments