@abinnovision/eslint-config-base 3.4.1 → 3.4.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configs/base.cjs +440 -4
- package/dist/configs/base.d.cts +1 -3
- package/dist/configs/base.d.mts +1 -3
- package/dist/configs/base.mjs +436 -0
- package/dist/configs/flavour-config-files.cjs +25 -1
- package/dist/configs/flavour-config-files.d.cts +1 -3
- package/dist/configs/flavour-config-files.d.mts +1 -3
- package/dist/configs/flavour-config-files.mjs +24 -0
- package/dist/configs/flavour-nestjs.cjs +24 -1
- package/dist/configs/flavour-nestjs.d.cts +1 -3
- package/dist/configs/flavour-nestjs.d.mts +1 -3
- package/dist/configs/flavour-nestjs.mjs +24 -0
- package/dist/configs/flavour-stylistic.cjs +45 -1
- package/dist/configs/flavour-stylistic.d.cts +1 -3
- package/dist/configs/flavour-stylistic.d.mts +1 -3
- package/dist/configs/flavour-stylistic.mjs +44 -0
- package/dist/configs/flavour-vitest.cjs +170 -1
- package/dist/configs/flavour-vitest.d.cts +1 -3
- package/dist/configs/flavour-vitest.d.mts +1 -3
- package/dist/configs/flavour-vitest.mjs +169 -0
- package/dist/configs/index.cjs +10 -5
- package/dist/configs/index.mjs +6 -6
- package/package.json +23 -10
- package/dist/configs/index.d.mts +0 -5
package/dist/configs/base.mjs
CHANGED
|
@@ -16,62 +16,323 @@ const config = defineConfig([{
|
|
|
16
16
|
},
|
|
17
17
|
extends: [jseslint.configs.recommended],
|
|
18
18
|
rules: {
|
|
19
|
+
/**
|
|
20
|
+
* Enforce getter/setter pairs in objects and classes.
|
|
21
|
+
*
|
|
22
|
+
* @see https://eslint.org/docs/latest/rules/accessor-pairs
|
|
23
|
+
*/
|
|
19
24
|
"accessor-pairs": ["error", {
|
|
20
25
|
setWithoutGet: true,
|
|
21
26
|
getWithoutSet: false
|
|
22
27
|
}],
|
|
28
|
+
/**
|
|
29
|
+
* Enforce return statements in callbacks of array methods.
|
|
30
|
+
*
|
|
31
|
+
* @see https://eslint.org/docs/latest/rules/array-callback-return
|
|
32
|
+
*/
|
|
23
33
|
"array-callback-return": "error",
|
|
34
|
+
/**
|
|
35
|
+
* Disallow Array constructor.
|
|
36
|
+
*
|
|
37
|
+
* @see https://eslint.org/docs/latest/rules/no-array-constructor
|
|
38
|
+
*/
|
|
24
39
|
"no-array-constructor": "error",
|
|
40
|
+
/**
|
|
41
|
+
* Disallow use of arguments.caller or arguments.callee.
|
|
42
|
+
*
|
|
43
|
+
* @see https://eslint.org/docs/latest/rules/no-caller
|
|
44
|
+
*/
|
|
25
45
|
"no-caller": "error",
|
|
46
|
+
/**
|
|
47
|
+
* Enforce default clauses in switch statements to be last.
|
|
48
|
+
*
|
|
49
|
+
* @see https://eslint.org/docs/latest/rules/default-case-last
|
|
50
|
+
*/
|
|
26
51
|
"default-case-last": "error",
|
|
52
|
+
/**
|
|
53
|
+
* Require following curly brace conventions.
|
|
54
|
+
*
|
|
55
|
+
* @see https://eslint.org/docs/latest/rules/curly
|
|
56
|
+
*/
|
|
27
57
|
curly: ["error", "all"],
|
|
58
|
+
/**
|
|
59
|
+
* Require === and !==.
|
|
60
|
+
*
|
|
61
|
+
* @see https://eslint.org/docs/latest/rules/eqeqeq
|
|
62
|
+
*/
|
|
28
63
|
eqeqeq: ["error", "always"],
|
|
64
|
+
/**
|
|
65
|
+
* Disallow eval().
|
|
66
|
+
*
|
|
67
|
+
* @see https://eslint.org/docs/latest/rules/no-eval
|
|
68
|
+
*/
|
|
29
69
|
"no-eval": "error",
|
|
70
|
+
/**
|
|
71
|
+
* Disallow extending native types.
|
|
72
|
+
*
|
|
73
|
+
* @see https://eslint.org/docs/latest/rules/no-extend-native
|
|
74
|
+
*/
|
|
30
75
|
"no-extend-native": "error",
|
|
76
|
+
/**
|
|
77
|
+
* Disallow unnecessary function binding.
|
|
78
|
+
*
|
|
79
|
+
* @see https://eslint.org/docs/latest/rules/no-extra-bind
|
|
80
|
+
*/
|
|
31
81
|
"no-extra-bind": "error",
|
|
82
|
+
/**
|
|
83
|
+
* Disallow assignment operators in return statements.
|
|
84
|
+
*
|
|
85
|
+
* @see https://eslint.org/docs/latest/rules/no-return-assign
|
|
86
|
+
*/
|
|
32
87
|
"no-return-assign": "error",
|
|
88
|
+
/**
|
|
89
|
+
* Disallow new operators outside of assignments or comparisons.
|
|
90
|
+
*
|
|
91
|
+
* @see https://eslint.org/docs/latest/rules/no-new
|
|
92
|
+
*/
|
|
33
93
|
"no-new": "error",
|
|
94
|
+
/**
|
|
95
|
+
* Disallow new operators with Function object.
|
|
96
|
+
*
|
|
97
|
+
* @see https://eslint.org/docs/latest/rules/no-new-func
|
|
98
|
+
*/
|
|
34
99
|
"no-new-func": "error",
|
|
100
|
+
/**
|
|
101
|
+
* Disallow new operators with native non-constructor functions (e.g. Symbol, BigInt).
|
|
102
|
+
*
|
|
103
|
+
* @see https://eslint.org/docs/latest/rules/no-new-native-nonconstructor
|
|
104
|
+
*/
|
|
35
105
|
"no-new-native-nonconstructor": "error",
|
|
106
|
+
/**
|
|
107
|
+
* Disallow new operators with String, Number, and Boolean objects.
|
|
108
|
+
*
|
|
109
|
+
* @see https://eslint.org/docs/latest/rules/no-new-wrappers
|
|
110
|
+
*/
|
|
36
111
|
"no-new-wrappers": "error",
|
|
112
|
+
/**
|
|
113
|
+
* Disallow octal escape sequences in string literals.
|
|
114
|
+
*
|
|
115
|
+
* @see https://eslint.org/docs/latest/rules/no-octal-escape
|
|
116
|
+
*/
|
|
37
117
|
"no-octal-escape": "error",
|
|
118
|
+
/**
|
|
119
|
+
* Disallow variable redeclaration.
|
|
120
|
+
*
|
|
121
|
+
* @see https://eslint.org/docs/latest/rules/no-redeclare
|
|
122
|
+
*/
|
|
38
123
|
"no-redeclare": "error",
|
|
124
|
+
/**
|
|
125
|
+
* Disallow comparisons where both sides are exactly the same.
|
|
126
|
+
*
|
|
127
|
+
* @see https://eslint.org/docs/latest/rules/no-self-compare
|
|
128
|
+
*/
|
|
39
129
|
"no-self-compare": "error",
|
|
130
|
+
/**
|
|
131
|
+
* Disallow comma operators.
|
|
132
|
+
*
|
|
133
|
+
* @see https://eslint.org/docs/latest/rules/no-sequences
|
|
134
|
+
*/
|
|
40
135
|
"no-sequences": "error",
|
|
136
|
+
/**
|
|
137
|
+
* Disallow throwing literals as exceptions.
|
|
138
|
+
*
|
|
139
|
+
* @see https://eslint.org/docs/latest/rules/no-throw-literal
|
|
140
|
+
*/
|
|
41
141
|
"no-throw-literal": "error",
|
|
142
|
+
/**
|
|
143
|
+
* Disallow loops with a body that allows only one iteration.
|
|
144
|
+
*
|
|
145
|
+
* @see https://eslint.org/docs/latest/rules/no-unreachable-loop
|
|
146
|
+
*/
|
|
42
147
|
"no-unreachable-loop": "error",
|
|
148
|
+
/**
|
|
149
|
+
* Disallow redundant return statements.
|
|
150
|
+
*
|
|
151
|
+
* @see https://eslint.org/docs/latest/rules/no-useless-return
|
|
152
|
+
*/
|
|
43
153
|
"no-useless-return": "error",
|
|
154
|
+
/**
|
|
155
|
+
* Require var declarations be placed at the top of their scope.
|
|
156
|
+
*
|
|
157
|
+
* @see https://eslint.org/docs/latest/rules/vars-on-top
|
|
158
|
+
*/
|
|
44
159
|
"vars-on-top": "error",
|
|
160
|
+
/**
|
|
161
|
+
* Require let or const instead of var.
|
|
162
|
+
*
|
|
163
|
+
* @see https://eslint.org/docs/latest/rules/no-var
|
|
164
|
+
*/
|
|
45
165
|
"no-var": "error",
|
|
166
|
+
/**
|
|
167
|
+
* Require const declarations for variables that are never reassigned.
|
|
168
|
+
*
|
|
169
|
+
* @see https://eslint.org/docs/latest/rules/prefer-const
|
|
170
|
+
*/
|
|
46
171
|
"prefer-const": "error",
|
|
172
|
+
/**
|
|
173
|
+
* Require object spread over Object.assign.
|
|
174
|
+
*
|
|
175
|
+
* @see https://eslint.org/docs/latest/rules/prefer-object-spread
|
|
176
|
+
*/
|
|
47
177
|
"prefer-object-spread": "error",
|
|
178
|
+
/**
|
|
179
|
+
* Require rest parameters instead of arguments.
|
|
180
|
+
*
|
|
181
|
+
* @see https://eslint.org/docs/latest/rules/prefer-rest-params
|
|
182
|
+
*/
|
|
48
183
|
"prefer-rest-params": "error",
|
|
184
|
+
/**
|
|
185
|
+
* Require spread operators instead of .apply().
|
|
186
|
+
*
|
|
187
|
+
* @see https://eslint.org/docs/latest/rules/prefer-spread
|
|
188
|
+
*/
|
|
49
189
|
"prefer-spread": "error",
|
|
190
|
+
/**
|
|
191
|
+
* Disallow returning a value from a Promise executor.
|
|
192
|
+
*
|
|
193
|
+
* @see https://eslint.org/docs/latest/rules/no-promise-executor-return
|
|
194
|
+
*/
|
|
50
195
|
"no-promise-executor-return": "error",
|
|
196
|
+
/**
|
|
197
|
+
* Disallow template literal placeholder syntax in regular strings.
|
|
198
|
+
*
|
|
199
|
+
* @see https://eslint.org/docs/latest/rules/no-template-curly-in-string
|
|
200
|
+
*/
|
|
51
201
|
"no-template-curly-in-string": "error",
|
|
202
|
+
/**
|
|
203
|
+
* Disallow unmodified conditions of loops.
|
|
204
|
+
*
|
|
205
|
+
* @see https://eslint.org/docs/latest/rules/no-unmodified-loop-condition
|
|
206
|
+
*/
|
|
52
207
|
"no-unmodified-loop-condition": "error",
|
|
208
|
+
/**
|
|
209
|
+
* Disallow unnecessary nested blocks.
|
|
210
|
+
*
|
|
211
|
+
* @see https://eslint.org/docs/latest/rules/no-lone-blocks
|
|
212
|
+
*/
|
|
53
213
|
"no-lone-blocks": "error",
|
|
214
|
+
/**
|
|
215
|
+
* Disallow renaming import, export, and destructured assignments to the same name.
|
|
216
|
+
*
|
|
217
|
+
* @see https://eslint.org/docs/latest/rules/no-useless-rename
|
|
218
|
+
*/
|
|
54
219
|
"no-useless-rename": "error",
|
|
220
|
+
/**
|
|
221
|
+
* Disallow unnecessary computed property keys in objects and classes.
|
|
222
|
+
*
|
|
223
|
+
* @see https://eslint.org/docs/latest/rules/no-useless-computed-key
|
|
224
|
+
*/
|
|
55
225
|
"no-useless-computed-key": "error",
|
|
226
|
+
/**
|
|
227
|
+
* Disallow await inside of loops.
|
|
228
|
+
*
|
|
229
|
+
* @see https://eslint.org/docs/latest/rules/no-await-in-loop
|
|
230
|
+
*/
|
|
56
231
|
"no-await-in-loop": "warn",
|
|
232
|
+
/**
|
|
233
|
+
* Disallow reassigning function parameters.
|
|
234
|
+
*
|
|
235
|
+
* @see https://eslint.org/docs/latest/rules/no-param-reassign
|
|
236
|
+
*/
|
|
57
237
|
"no-param-reassign": "error",
|
|
238
|
+
/**
|
|
239
|
+
* Custom JS Rules: Code Quality & Complexity
|
|
240
|
+
*/
|
|
241
|
+
/**
|
|
242
|
+
* Enforce a maximum cyclomatic complexity allowed in a program.
|
|
243
|
+
*
|
|
244
|
+
* @see https://eslint.org/docs/latest/rules/complexity
|
|
245
|
+
*/
|
|
58
246
|
complexity: ["error", { max: 25 }],
|
|
247
|
+
/**
|
|
248
|
+
* Enforce a maximum depth that blocks can be nested.
|
|
249
|
+
*
|
|
250
|
+
* @see https://eslint.org/docs/latest/rules/max-depth
|
|
251
|
+
*/
|
|
59
252
|
"max-depth": ["error", 5],
|
|
253
|
+
/**
|
|
254
|
+
* Enforce a maximum depth that callbacks can be nested.
|
|
255
|
+
*
|
|
256
|
+
* @see https://eslint.org/docs/latest/rules/max-nested-callbacks
|
|
257
|
+
*/
|
|
60
258
|
"max-nested-callbacks": ["error", 3],
|
|
259
|
+
/**
|
|
260
|
+
* Enforce a maximum number of parameters in function definitions.
|
|
261
|
+
*
|
|
262
|
+
* @see https://eslint.org/docs/latest/rules/max-params
|
|
263
|
+
*/
|
|
61
264
|
"max-params": ["error", 3],
|
|
265
|
+
/**
|
|
266
|
+
* Require for-in loops to include an if statement.
|
|
267
|
+
*
|
|
268
|
+
* @see https://eslint.org/docs/latest/rules/guard-for-in
|
|
269
|
+
*/
|
|
62
270
|
"guard-for-in": "error",
|
|
271
|
+
/**
|
|
272
|
+
* Require grouped accessor pairs in object literals and classes.
|
|
273
|
+
*
|
|
274
|
+
* @see https://eslint.org/docs/latest/rules/grouped-accessor-pairs
|
|
275
|
+
*/
|
|
63
276
|
"grouped-accessor-pairs": "error",
|
|
277
|
+
/**
|
|
278
|
+
* Require constructor names to begin with a capital letter.
|
|
279
|
+
*
|
|
280
|
+
* @see https://eslint.org/docs/latest/rules/new-cap
|
|
281
|
+
*/
|
|
64
282
|
"new-cap": ["error", {
|
|
65
283
|
newIsCap: true,
|
|
66
284
|
capIsNew: false,
|
|
67
285
|
properties: true
|
|
68
286
|
}],
|
|
287
|
+
/**
|
|
288
|
+
* Disallow returning value from constructor.
|
|
289
|
+
*
|
|
290
|
+
* @see https://eslint.org/docs/latest/rules/no-constructor-return
|
|
291
|
+
*/
|
|
69
292
|
"no-constructor-return": "error",
|
|
293
|
+
/**
|
|
294
|
+
* Disallow variable or function declarations in nested blocks.
|
|
295
|
+
*
|
|
296
|
+
* @see https://eslint.org/docs/latest/rules/no-inner-declarations
|
|
297
|
+
*/
|
|
70
298
|
"no-inner-declarations": "error",
|
|
299
|
+
/**
|
|
300
|
+
* Disallow the use of console.
|
|
301
|
+
*
|
|
302
|
+
* @see https://eslint.org/docs/latest/rules/no-console
|
|
303
|
+
*/
|
|
71
304
|
"no-console": "warn",
|
|
305
|
+
/**
|
|
306
|
+
* Custom Configuration Adjustments
|
|
307
|
+
* Override ESLint recommended rules where we want different behavior
|
|
308
|
+
*/
|
|
309
|
+
/**
|
|
310
|
+
* Disallow assignment operators in conditional expressions except when enclosed in parentheses.
|
|
311
|
+
*
|
|
312
|
+
* @see https://eslint.org/docs/latest/rules/no-cond-assign
|
|
313
|
+
*/
|
|
72
314
|
"no-cond-assign": ["error", "except-parens"],
|
|
315
|
+
/**
|
|
316
|
+
* Disallow constant expressions in conditions except loops.
|
|
317
|
+
*
|
|
318
|
+
* @see https://eslint.org/docs/latest/rules/no-constant-condition
|
|
319
|
+
*/
|
|
73
320
|
"no-constant-condition": ["error", { checkLoops: false }],
|
|
321
|
+
/**
|
|
322
|
+
* Disallow empty block statements except catch blocks.
|
|
323
|
+
*
|
|
324
|
+
* @see https://eslint.org/docs/latest/rules/no-empty
|
|
325
|
+
*/
|
|
74
326
|
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
327
|
+
/**
|
|
328
|
+
* Import Ordering and Organization
|
|
329
|
+
* Enforces consistent import structure
|
|
330
|
+
*/
|
|
331
|
+
/**
|
|
332
|
+
* Enforce a convention in module import order.
|
|
333
|
+
*
|
|
334
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/order.md
|
|
335
|
+
*/
|
|
75
336
|
"import/order": ["error", {
|
|
76
337
|
groups: [
|
|
77
338
|
["builtin", "external"],
|
|
@@ -91,16 +352,85 @@ const config = defineConfig([{
|
|
|
91
352
|
},
|
|
92
353
|
warnOnUnassignedImports: true
|
|
93
354
|
}],
|
|
355
|
+
/**
|
|
356
|
+
* Require exports to be placed at the end of the file.
|
|
357
|
+
*
|
|
358
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/exports-last.md
|
|
359
|
+
*/
|
|
94
360
|
"import/exports-last": "warn",
|
|
361
|
+
/**
|
|
362
|
+
* Require imports to be placed before other statements.
|
|
363
|
+
*
|
|
364
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/first.md
|
|
365
|
+
*/
|
|
95
366
|
"import/first": "error",
|
|
367
|
+
/**
|
|
368
|
+
* Require a newline after import statements.
|
|
369
|
+
*
|
|
370
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/newline-after-import.md
|
|
371
|
+
*/
|
|
96
372
|
"import/newline-after-import": "error",
|
|
373
|
+
/**
|
|
374
|
+
* Forbid repeated import of the same module.
|
|
375
|
+
*
|
|
376
|
+
* Catches splits introduced when consistent-type-imports auto-fixes
|
|
377
|
+
* a file that already had a value-only import from the same module.
|
|
378
|
+
*
|
|
379
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-duplicates.md
|
|
380
|
+
*/
|
|
97
381
|
"import/no-duplicates": ["error", { "prefer-inline": false }],
|
|
382
|
+
/**
|
|
383
|
+
* Forbid a module from importing itself.
|
|
384
|
+
*
|
|
385
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-self-import.md
|
|
386
|
+
*/
|
|
98
387
|
"import/no-self-import": "error",
|
|
388
|
+
/**
|
|
389
|
+
* Forbid unnecessary path segments in import and require statements.
|
|
390
|
+
* `noUselessIndex` is left at its default of `false` because pure
|
|
391
|
+
* ESM / NodeNext resolution does not auto-resolve `./foo` to
|
|
392
|
+
* `./foo/index.js`, so trimming `/index.js` would break imports.
|
|
393
|
+
*
|
|
394
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-useless-path-segments.md
|
|
395
|
+
*/
|
|
99
396
|
"import/no-useless-path-segments": "error",
|
|
397
|
+
/**
|
|
398
|
+
* Forbid empty named import blocks (`import {} from "foo"`).
|
|
399
|
+
*
|
|
400
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-empty-named-blocks.md
|
|
401
|
+
*/
|
|
100
402
|
"import/no-empty-named-blocks": "error",
|
|
403
|
+
/**
|
|
404
|
+
* Forbid `export let` / `export var` declarations.
|
|
405
|
+
* Aligns with the existing `no-var` / `prefer-const` rules.
|
|
406
|
+
*
|
|
407
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-mutable-exports.md
|
|
408
|
+
*/
|
|
101
409
|
"import/no-mutable-exports": "error",
|
|
410
|
+
/**
|
|
411
|
+
* Forbid importing packages through relative paths.
|
|
412
|
+
* Forces using the workspace name (e.g. `@abinnovision/eslint-config-base`)
|
|
413
|
+
* instead of `../../eslint-config-base/src/...` between monorepo packages.
|
|
414
|
+
*
|
|
415
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-relative-packages.md
|
|
416
|
+
*/
|
|
102
417
|
"import/no-relative-packages": "error",
|
|
418
|
+
/**
|
|
419
|
+
* Enforce or ban the use of inline type-only markers.
|
|
420
|
+
* `prefer-top-level` complements `@typescript-eslint/consistent-type-imports`
|
|
421
|
+
* by also banning mixed `import { type Foo, bar }` forms.
|
|
422
|
+
*
|
|
423
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/consistent-type-specifier-style.md
|
|
424
|
+
*/
|
|
103
425
|
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
426
|
+
/**
|
|
427
|
+
* Forbid importing from packages that aren't declared in the package's
|
|
428
|
+
* `dependencies` / `peerDependencies` / `optionalDependencies`.
|
|
429
|
+
* Globs in `devDependencies` are file patterns where dev-only imports
|
|
430
|
+
* are allowed (tests, configs, build scripts).
|
|
431
|
+
*
|
|
432
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-extraneous-dependencies.md
|
|
433
|
+
*/
|
|
104
434
|
"import/no-extraneous-dependencies": ["error", {
|
|
105
435
|
devDependencies: [
|
|
106
436
|
"**/*.{test,spec}.{ts,tsx,js,jsx,mts,mjs,cts,cjs}",
|
|
@@ -116,8 +446,25 @@ const config = defineConfig([{
|
|
|
116
446
|
peerDependencies: true,
|
|
117
447
|
bundledDependencies: true
|
|
118
448
|
}],
|
|
449
|
+
/**
|
|
450
|
+
* Unused Imports Handling
|
|
451
|
+
* Uses unused-imports plugin for better detection
|
|
452
|
+
*/
|
|
453
|
+
/**
|
|
454
|
+
* Disables base no-unused-vars (replaced by unused-imports).
|
|
455
|
+
*/
|
|
119
456
|
"no-unused-vars": "off",
|
|
457
|
+
/**
|
|
458
|
+
* Disallow unused imports.
|
|
459
|
+
*
|
|
460
|
+
* @see https://github.com/sweepline/eslint-plugin-unused-imports
|
|
461
|
+
*/
|
|
120
462
|
"uimports/no-unused-imports": "error",
|
|
463
|
+
/**
|
|
464
|
+
* Disallow unused variables.
|
|
465
|
+
*
|
|
466
|
+
* @see https://github.com/sweepline/eslint-plugin-unused-imports
|
|
467
|
+
*/
|
|
121
468
|
"uimports/no-unused-vars": ["warn", {
|
|
122
469
|
vars: "all",
|
|
123
470
|
varsIgnorePattern: "^_",
|
|
@@ -126,6 +473,9 @@ const config = defineConfig([{
|
|
|
126
473
|
}]
|
|
127
474
|
}
|
|
128
475
|
}, {
|
|
476
|
+
/**
|
|
477
|
+
* TypeScript-Specific Configuration
|
|
478
|
+
*/
|
|
129
479
|
files: ["**/*.{ts,tsx}"],
|
|
130
480
|
plugins: { "@typescript-eslint": tseslint.plugin },
|
|
131
481
|
languageOptions: {
|
|
@@ -134,10 +484,35 @@ const config = defineConfig([{
|
|
|
134
484
|
},
|
|
135
485
|
extends: [tseslint.configs.strictTypeChecked],
|
|
136
486
|
rules: {
|
|
487
|
+
/**
|
|
488
|
+
* Allow explicit any for flexibility.
|
|
489
|
+
*
|
|
490
|
+
* @see https://typescript-eslint.io/rules/no-explicit-any
|
|
491
|
+
*/
|
|
137
492
|
"@typescript-eslint/no-explicit-any": "off",
|
|
493
|
+
/**
|
|
494
|
+
* Allow non-null assertions.
|
|
495
|
+
*
|
|
496
|
+
* @see https://typescript-eslint.io/rules/no-non-null-assertion
|
|
497
|
+
*/
|
|
138
498
|
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
499
|
+
/**
|
|
500
|
+
* Require Promise-like statements to be handled appropriately.
|
|
501
|
+
*
|
|
502
|
+
* @see https://typescript-eslint.io/rules/no-floating-promises
|
|
503
|
+
*/
|
|
139
504
|
"@typescript-eslint/no-floating-promises": "error",
|
|
505
|
+
/**
|
|
506
|
+
* Require explicit accessibility modifiers on class properties and methods.
|
|
507
|
+
*
|
|
508
|
+
* @see https://typescript-eslint.io/rules/explicit-member-accessibility
|
|
509
|
+
*/
|
|
140
510
|
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
511
|
+
/**
|
|
512
|
+
* Require a consistent member declaration order.
|
|
513
|
+
*
|
|
514
|
+
* @see https://typescript-eslint.io/rules/member-ordering
|
|
515
|
+
*/
|
|
141
516
|
"@typescript-eslint/member-ordering": ["error", { default: [
|
|
142
517
|
"public-static-field",
|
|
143
518
|
"protected-static-field",
|
|
@@ -155,23 +530,84 @@ const config = defineConfig([{
|
|
|
155
530
|
"protected-instance-method",
|
|
156
531
|
"private-instance-method"
|
|
157
532
|
] }],
|
|
533
|
+
/**
|
|
534
|
+
* Enforce using a particular method signature syntax.
|
|
535
|
+
*
|
|
536
|
+
* @see https://typescript-eslint.io/rules/method-signature-style
|
|
537
|
+
*/
|
|
158
538
|
"@typescript-eslint/method-signature-style": "error",
|
|
539
|
+
/**
|
|
540
|
+
* Enforce consistent usage of type assertions.
|
|
541
|
+
*
|
|
542
|
+
* @see https://typescript-eslint.io/rules/consistent-type-assertions
|
|
543
|
+
*/
|
|
159
544
|
"@typescript-eslint/consistent-type-assertions": ["error", {
|
|
160
545
|
assertionStyle: "as",
|
|
161
546
|
objectLiteralTypeAssertions: "never"
|
|
162
547
|
}],
|
|
548
|
+
/**
|
|
549
|
+
* Enforce type definitions to consistently use interface or type.
|
|
550
|
+
*
|
|
551
|
+
* @see https://typescript-eslint.io/rules/consistent-type-definitions
|
|
552
|
+
*/
|
|
163
553
|
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
|
554
|
+
/**
|
|
555
|
+
* Enforce consistent usage of type imports.
|
|
556
|
+
*
|
|
557
|
+
* @see https://typescript-eslint.io/rules/consistent-type-imports
|
|
558
|
+
*/
|
|
164
559
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
560
|
+
/**
|
|
561
|
+
* Disallow type imports with side effects.
|
|
562
|
+
*
|
|
563
|
+
* @see https://typescript-eslint.io/rules/no-import-type-side-effects
|
|
564
|
+
*/
|
|
165
565
|
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
566
|
+
/**
|
|
567
|
+
* Require using for-of loops instead of standard for loops over arrays.
|
|
568
|
+
*
|
|
569
|
+
* @see https://typescript-eslint.io/rules/prefer-for-of
|
|
570
|
+
*/
|
|
166
571
|
"@typescript-eslint/prefer-for-of": "warn",
|
|
572
|
+
/**
|
|
573
|
+
* Require using function types instead of interfaces with call signatures.
|
|
574
|
+
*
|
|
575
|
+
* @see https://typescript-eslint.io/rules/prefer-function-type
|
|
576
|
+
*/
|
|
167
577
|
"@typescript-eslint/prefer-function-type": "error",
|
|
578
|
+
/**
|
|
579
|
+
* Require using nullish coalescing operator instead of logical OR.
|
|
580
|
+
*
|
|
581
|
+
* @see https://typescript-eslint.io/rules/prefer-nullish-coalescing
|
|
582
|
+
*/
|
|
168
583
|
"@typescript-eslint/prefer-nullish-coalescing": "error",
|
|
584
|
+
/**
|
|
585
|
+
* Custom Overrides for TypeScript Rules
|
|
586
|
+
*/
|
|
587
|
+
/**
|
|
588
|
+
* Disallow TypeScript namespaces except in declarations and definition files.
|
|
589
|
+
*
|
|
590
|
+
* @see https://typescript-eslint.io/rules/no-namespace
|
|
591
|
+
*/
|
|
169
592
|
"@typescript-eslint/no-namespace": ["error", {
|
|
170
593
|
allowDeclarations: true,
|
|
171
594
|
allowDefinitionFiles: true
|
|
172
595
|
}],
|
|
596
|
+
/**
|
|
597
|
+
* Require awaiting a value before returning it from an async function.
|
|
598
|
+
*
|
|
599
|
+
* @see https://typescript-eslint.io/rules/return-await
|
|
600
|
+
*/
|
|
173
601
|
"@typescript-eslint/return-await": ["warn", "always"],
|
|
602
|
+
/**
|
|
603
|
+
* Disable TypeScript no-unused-vars (using unused-imports plugin).
|
|
604
|
+
*/
|
|
174
605
|
"@typescript-eslint/no-unused-vars": "off",
|
|
606
|
+
/**
|
|
607
|
+
* Disallow classes used as namespaces except when used with decorators.
|
|
608
|
+
*
|
|
609
|
+
* @see https://typescript-eslint.io/rules/no-extraneous-class
|
|
610
|
+
*/
|
|
175
611
|
"@typescript-eslint/no-extraneous-class": ["error", { allowWithDecorator: true }]
|
|
176
612
|
}
|
|
177
613
|
}]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
let eslint_config = require("eslint/config");
|
|
3
3
|
let globals = require("globals");
|
|
4
|
-
globals = require_runtime.__toESM(globals);
|
|
4
|
+
globals = require_runtime.__toESM(globals, 1);
|
|
5
5
|
//#region src/configs/flavour-config-files.ts
|
|
6
6
|
/**
|
|
7
7
|
* ESLint configuration for build tool and project configuration files.
|
|
@@ -25,9 +25,33 @@ globals = require_runtime.__toESM(globals);
|
|
|
25
25
|
const config = (0, eslint_config.defineConfig)([{
|
|
26
26
|
languageOptions: { globals: { ...globals.default.node } },
|
|
27
27
|
rules: {
|
|
28
|
+
/**
|
|
29
|
+
* Disallow the use of console.
|
|
30
|
+
* Disabled for config files that often log build information.
|
|
31
|
+
*
|
|
32
|
+
* @see https://eslint.org/docs/latest/rules/no-console
|
|
33
|
+
*/
|
|
28
34
|
"no-console": "off",
|
|
35
|
+
/**
|
|
36
|
+
* Enforce a maximum number of lines per function.
|
|
37
|
+
* Disabled for complex build configurations.
|
|
38
|
+
*
|
|
39
|
+
* @see https://eslint.org/docs/latest/rules/max-lines-per-function
|
|
40
|
+
*/
|
|
29
41
|
"max-lines-per-function": "off",
|
|
42
|
+
/**
|
|
43
|
+
* Allow importing devDependencies in build/config files.
|
|
44
|
+
* Tools like vite, vitest, tsdown are typically devDependencies.
|
|
45
|
+
*
|
|
46
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-extraneous-dependencies.md
|
|
47
|
+
*/
|
|
30
48
|
"import/no-extraneous-dependencies": "off",
|
|
49
|
+
/**
|
|
50
|
+
* Disallow require statements except in import statements.
|
|
51
|
+
* Disabled for CommonJS config files.
|
|
52
|
+
*
|
|
53
|
+
* @see https://typescript-eslint.io/rules/no-var-requires
|
|
54
|
+
*/
|
|
31
55
|
"@typescript-eslint/no-var-requires": "off"
|
|
32
56
|
}
|
|
33
57
|
}]);
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as eslint_config0 from "eslint/config";
|
|
2
|
-
|
|
3
1
|
//#region src/configs/flavour-config-files.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* ESLint configuration for build tool and project configuration files.
|
|
@@ -20,6 +18,6 @@ import * as eslint_config0 from "eslint/config";
|
|
|
20
18
|
* ];
|
|
21
19
|
* ```
|
|
22
20
|
*/
|
|
23
|
-
declare const config:
|
|
21
|
+
declare const config: import("eslint/config").Config[];
|
|
24
22
|
//#endregion
|
|
25
23
|
export { config };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as eslint_config0 from "eslint/config";
|
|
2
|
-
|
|
3
1
|
//#region src/configs/flavour-config-files.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* ESLint configuration for build tool and project configuration files.
|
|
@@ -20,6 +18,6 @@ import * as eslint_config0 from "eslint/config";
|
|
|
20
18
|
* ];
|
|
21
19
|
* ```
|
|
22
20
|
*/
|
|
23
|
-
declare const config:
|
|
21
|
+
declare const config: import("eslint/config").Config[];
|
|
24
22
|
//#endregion
|
|
25
23
|
export { config };
|
|
@@ -23,9 +23,33 @@ import globals from "globals";
|
|
|
23
23
|
const config = defineConfig([{
|
|
24
24
|
languageOptions: { globals: { ...globals.node } },
|
|
25
25
|
rules: {
|
|
26
|
+
/**
|
|
27
|
+
* Disallow the use of console.
|
|
28
|
+
* Disabled for config files that often log build information.
|
|
29
|
+
*
|
|
30
|
+
* @see https://eslint.org/docs/latest/rules/no-console
|
|
31
|
+
*/
|
|
26
32
|
"no-console": "off",
|
|
33
|
+
/**
|
|
34
|
+
* Enforce a maximum number of lines per function.
|
|
35
|
+
* Disabled for complex build configurations.
|
|
36
|
+
*
|
|
37
|
+
* @see https://eslint.org/docs/latest/rules/max-lines-per-function
|
|
38
|
+
*/
|
|
27
39
|
"max-lines-per-function": "off",
|
|
40
|
+
/**
|
|
41
|
+
* Allow importing devDependencies in build/config files.
|
|
42
|
+
* Tools like vite, vitest, tsdown are typically devDependencies.
|
|
43
|
+
*
|
|
44
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-extraneous-dependencies.md
|
|
45
|
+
*/
|
|
28
46
|
"import/no-extraneous-dependencies": "off",
|
|
47
|
+
/**
|
|
48
|
+
* Disallow require statements except in import statements.
|
|
49
|
+
* Disabled for CommonJS config files.
|
|
50
|
+
*
|
|
51
|
+
* @see https://typescript-eslint.io/rules/no-var-requires
|
|
52
|
+
*/
|
|
29
53
|
"@typescript-eslint/no-var-requires": "off"
|
|
30
54
|
}
|
|
31
55
|
}]);
|