@@ -6,12 +6,13 @@ import { FlatCompat } from "@eslint/eslintrc";
6
6
import eslint from "@eslint/js" ;
7
7
import eslintCommentsPlugin from "eslint-plugin-eslint-comments" ;
8
8
import eslintPluginPlugin from "eslint-plugin-eslint-plugin" ;
9
+ import gitignore from "eslint-config-flat-gitignore" ;
10
+ import jsdocPlugin from "eslint-plugin-jsdoc" ;
9
11
import perfectionist from "eslint-plugin-perfectionist" ;
10
12
import perfectionistNatural from "eslint-plugin-perfectionist/configs/recommended-natural" ;
11
- import jsdocPlugin from "eslint-plugin-jsdoc" ;
12
13
import simpleImportSortPlugin from "eslint-plugin-simple-import-sort" ;
13
14
import tseslint from "typescript-eslint" ;
14
- import gitignore from "eslint-config-flat-gitignore " ;
15
+ import vitest from "eslint-plugin-vitest " ;
15
16
16
17
const dirname = url . fileURLToPath ( new URL ( "." , import . meta. url ) ) ;
17
18
// const compat = new FlatCompat({ baseDirectory: dirname });
@@ -40,11 +41,6 @@ export default tseslint.config(
40
41
languageOptions : {
41
42
parserOptions : {
42
43
allowAutomaticSingleRunInference : true ,
43
- cacheLifetime : {
44
- // we pretty well never create/change tsconfig structure - so no need to ever evict the cache
45
- // in the rare case that we do - just need to manually restart their IDE.
46
- glob : "Infinity" ,
47
- } ,
48
44
project : [
49
45
"tsconfig.json" ,
50
46
"packages/*/tsconfig.json" ,
@@ -67,35 +63,12 @@ export default tseslint.config(
67
63
minimumDescriptionLength : 5 ,
68
64
} ,
69
65
] ,
70
- "@typescript-eslint/consistent-type-imports" : [
71
- "error ",
72
- { prefer : "type-imports" , disallowTypeAnnotations : true } ,
73
- ] ,
66
+ "@typescript-eslint/consistent-type-imports" : [ "error" , {
67
+ prefer : "type-imports ",
68
+ disallowTypeAnnotations : true ,
69
+ } ] ,
74
70
"@typescript-eslint/explicit-function-return-type" : "off" ,
75
71
"@typescript-eslint/no-explicit-any" : "error" ,
76
- "no-constant-condition" : "off" ,
77
- "@typescript-eslint/no-unnecessary-condition" : [
78
- "error" ,
79
- { allowConstantLoopConditions : true } ,
80
- ] ,
81
- "@typescript-eslint/no-var-requires" : "off" ,
82
- "@typescript-eslint/prefer-literal-enum-member" : [
83
- "error" ,
84
- {
85
- allowBitwiseExpressions : true ,
86
- } ,
87
- ] ,
88
- "@typescript-eslint/unbound-method" : "off" ,
89
- "@typescript-eslint/restrict-template-expressions" : [
90
- "error" ,
91
- {
92
- allowNumber : true ,
93
- allowBoolean : true ,
94
- allowAny : true ,
95
- allowNullish : true ,
96
- allowRegExp : true ,
97
- } ,
98
- ] ,
99
72
"@typescript-eslint/no-unused-vars" : [
100
73
"error" ,
101
74
{
@@ -112,28 +85,20 @@ export default tseslint.config(
112
85
} ,
113
86
] ,
114
87
115
- //
116
- // eslint-base
117
- //
118
-
119
- eqeqeq : [
120
- "error" ,
121
- "always" ,
122
- ] ,
88
+ "array-callback-return" : "off" ,
89
+ "eslint-plugin/require-meta-docs-url" : "off" ,
123
90
"logical-assignment-operators" : "error" ,
91
+ "max-depth" : [ "warn" , 3 ] ,
92
+ "no-console" : "error" ,
124
93
"no-else-return" : "error" ,
94
+ "no-fallthrough" : [ "error" , { commentPattern : ".*intentional fallthrough.*" } ] ,
125
95
"no-mixed-operators" : "error" ,
126
- "no-console" : "error" ,
127
96
"no-process-exit" : "error" ,
128
- "no-fallthrough" : [
129
- "error" ,
130
- { commentPattern : ".*intentional fallthrough.*" } ,
131
- ] ,
97
+ "no-undef" : "off" ,
132
98
"one-var" : [ "error" , "never" ] ,
133
- "array-callback-return " : "off " ,
99
+ "prefer-object-has-own " : "error " ,
134
100
curly : "off" ,
135
- "eslint-plugin/require-meta-docs-url" : "off" ,
136
- "max-depth" : [ "warn" , 3 ] ,
101
+ eqeqeq : [ "error" , "always" ] ,
137
102
"no-restricted-syntax" : [
138
103
"error" ,
139
104
{
@@ -153,8 +118,6 @@ export default tseslint.config(
153
118
selector : 'ImportDeclaration[source.value="."]' ,
154
119
} ,
155
120
] ,
156
- "no-undef" : "off" ,
157
- "prefer-object-has-own" : "error" ,
158
121
159
122
"perfectionist/sort-exports" : "off" ,
160
123
"perfectionist/sort-imports" : "off" ,
@@ -188,28 +151,12 @@ export default tseslint.config(
188
151
} ,
189
152
] ,
190
153
191
- //
192
- // eslint-plugin-eslint-comment
193
- //
194
-
195
- // require a eslint-enable comment for every eslint-disable comment
196
- "eslint-comments/disable-enable-pair" : [
197
- "error" ,
198
- {
199
- allowWholeFile : true ,
200
- } ,
201
- ] ,
202
- // disallow a eslint-enable comment for multiple eslint-disable comments
154
+ "eslint-comments/disable-enable-pair" : [ "error" , { allowWholeFile : true } ] ,
203
155
"eslint-comments/no-aggregating-enable" : "error" ,
204
- // disallow duplicate eslint-disable comments
205
156
"eslint-comments/no-duplicate-disable" : "error" ,
206
- // disallow eslint-disable comments without rule names
207
157
"eslint-comments/no-unlimited-disable" : "error" ,
208
- // disallow unused eslint-disable comments
209
158
"eslint-comments/no-unused-disable" : "error" ,
210
- // disallow unused eslint-enable comments
211
159
"eslint-comments/no-unused-enable" : "error" ,
212
- // disallow ESLint directive-comments
213
160
"eslint-comments/no-use" : [
214
161
"error" ,
215
162
{
@@ -223,12 +170,7 @@ export default tseslint.config(
223
170
} ,
224
171
] ,
225
172
226
- // enforce a sort order across the codebase
227
- "simple-import-sort/imports" : "error" ,
228
-
229
- //
230
- // eslint-plugin-jsdoc
231
- //
173
+ "simple-import-sort/imports" : "warn" ,
232
174
233
175
"jsdoc/check-tag-names" : "off" ,
234
176
"jsdoc/check-param-names" : "off" ,
@@ -238,64 +180,49 @@ export default tseslint.config(
238
180
"jsdoc/require-returns" : "off" ,
239
181
"jsdoc/require-yields" : "off" ,
240
182
"jsdoc/tag-lines" : "off" ,
241
- // "jsdoc/informative-docs": "error ",
183
+ "jsdoc/informative-docs" : "warn " ,
242
184
} ,
243
185
} ,
244
186
{
245
187
files : [ "**/*.js" ] ,
246
188
extends : [ tseslint . configs . disableTypeChecked ] ,
247
189
rules : {
248
- // turn off other type-aware rules
249
- "deprecation/deprecation" : "off" ,
250
- "@typescript-eslint/internal/no-poorly-typed-ts-props" : "off" ,
251
-
252
190
// turn off rules that don't apply to JS code
253
- "@typescript-eslint/explicit-function-return-type" : "off" ,
254
191
} ,
255
192
} ,
256
- // test file specific configuration
257
193
{
258
194
files : [
259
- "packages/*/tests/**/*.spec.{ts,tsx,cts,mts}" ,
260
- "packages/*/tests/**/*.test.{ts,tsx,cts,mts}" ,
261
- "packages/*/tests/**/spec.{ts,tsx,cts,mts}" ,
262
- "packages/*/tests/**/test.{ts,tsx,cts,mts}" ,
263
- "packages/parser/tests/**/*.{ts,tsx,cts,mts}" ,
264
- "packages/integration-tests/tools/integration-test-base.ts" ,
265
- "packages/integration-tests/tools/pack-packages.ts" ,
195
+ "**/*.spec.{ts,tsx,cts,mts}" ,
196
+ "**/*.test.{ts,tsx,cts,mts}" ,
197
+ "**/spec.{ts,tsx,cts,mts}" ,
198
+ "**/test.{ts,tsx,cts,mts}" ,
266
199
] ,
200
+ plugins : {
201
+ vitest,
202
+ } ,
267
203
rules : {
268
- "@typescript-eslint/no-empty-function" : [
269
- "error" ,
270
- { allow : [ "arrowFunctions" ] } ,
271
- ] ,
204
+ // @ts -ignore
205
+ ...vitest . configs . recommended . rules ,
206
+ "@typescript-eslint/no-empty-function" : [ "error" , { allow : [ "arrowFunctions" ] } ] ,
272
207
"@typescript-eslint/no-non-null-assertion" : "off" ,
273
208
"@typescript-eslint/no-unsafe-assignment" : "off" ,
274
209
"@typescript-eslint/no-unsafe-call" : "off" ,
275
210
"@typescript-eslint/no-unsafe-member-access" : "off" ,
276
211
"@typescript-eslint/no-unsafe-return" : "off" ,
277
212
} ,
278
- } ,
279
- //
280
- // tools and tests
281
- //
282
- {
283
- files : [
284
- "**/tools/**/*.{ts,tsx,cts,mts}" ,
285
- "**/tests/**/*.{ts,tsx,cts,mts}" ,
286
- ] ,
287
- rules : {
288
- // allow console logs in tools and tests
289
- "no-console" : "off" ,
213
+ languageOptions : {
214
+ globals : {
215
+ ...vitest . environments . env . globals ,
216
+ } ,
290
217
} ,
291
218
} ,
292
219
gitignore ( ) ,
293
220
{
294
221
ignores : [
295
- "eslint.config.mjs" ,
296
222
"docs" ,
297
223
"examples" ,
298
224
"website" ,
225
+ "eslint.config.mjs" ,
299
226
] ,
300
227
} ,
301
228
) ;
0 commit comments