@abinnovision/eslint-config-base 3.2.0 → 3.2.1-beta.5

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/index.js DELETED
@@ -1,1000 +0,0 @@
1
- // src/configs/base.ts
2
- import jseslint from "@eslint/js";
3
- import { defineConfig } from "eslint/config";
4
- import eslintPluginImport from "eslint-plugin-import";
5
- import unusedImports from "eslint-plugin-unused-imports";
6
- import tseslint from "typescript-eslint";
7
- var config = defineConfig([
8
- {
9
- files: ["**/*.{ts,tsx,js,jsx}"],
10
- languageOptions: {
11
- ecmaVersion: "latest"
12
- },
13
- plugins: {
14
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
15
- import: eslintPluginImport,
16
- uimports: unusedImports
17
- },
18
- extends: [
19
- /**
20
- * ESLint Recommended Rules
21
- *
22
- * @see https://eslint.org/docs/latest/rules/
23
- */
24
- jseslint.configs.recommended
25
- ],
26
- rules: {
27
- /**
28
- * Enforce getter/setter pairs in objects and classes.
29
- *
30
- * @see https://eslint.org/docs/latest/rules/accessor-pairs
31
- */
32
- "accessor-pairs": [
33
- "error",
34
- { setWithoutGet: true, getWithoutSet: false }
35
- ],
36
- /**
37
- * Enforce return statements in callbacks of array methods.
38
- *
39
- * @see https://eslint.org/docs/latest/rules/array-callback-return
40
- */
41
- "array-callback-return": "error",
42
- /**
43
- * Disallow Array constructor.
44
- *
45
- * @see https://eslint.org/docs/latest/rules/no-array-constructor
46
- */
47
- "no-array-constructor": "error",
48
- /**
49
- * Disallow use of arguments.caller or arguments.callee.
50
- *
51
- * @see https://eslint.org/docs/latest/rules/no-caller
52
- */
53
- "no-caller": "error",
54
- /**
55
- * Enforce default clauses in switch statements to be last.
56
- *
57
- * @see https://eslint.org/docs/latest/rules/default-case-last
58
- */
59
- "default-case-last": "error",
60
- /**
61
- * Require following curly brace conventions.
62
- *
63
- * @see https://eslint.org/docs/latest/rules/curly
64
- */
65
- curly: ["error", "all"],
66
- /**
67
- * Require === and !==.
68
- *
69
- * @see https://eslint.org/docs/latest/rules/eqeqeq
70
- */
71
- eqeqeq: ["error", "always"],
72
- /**
73
- * Disallow eval().
74
- *
75
- * @see https://eslint.org/docs/latest/rules/no-eval
76
- */
77
- "no-eval": "error",
78
- /**
79
- * Disallow extending native types.
80
- *
81
- * @see https://eslint.org/docs/latest/rules/no-extend-native
82
- */
83
- "no-extend-native": "error",
84
- /**
85
- * Disallow unnecessary function binding.
86
- *
87
- * @see https://eslint.org/docs/latest/rules/no-extra-bind
88
- */
89
- "no-extra-bind": "error",
90
- /**
91
- * Disallow assignment operators in return statements.
92
- *
93
- * @see https://eslint.org/docs/latest/rules/no-return-assign
94
- */
95
- "no-return-assign": "error",
96
- /**
97
- * Disallow new operators outside of assignments or comparisons.
98
- *
99
- * @see https://eslint.org/docs/latest/rules/no-new
100
- */
101
- "no-new": "error",
102
- /**
103
- * Disallow new operators with Function object.
104
- *
105
- * @see https://eslint.org/docs/latest/rules/no-new-func
106
- */
107
- "no-new-func": "error",
108
- /**
109
- * Disallow new operators with native non-constructor functions (e.g. Symbol, BigInt).
110
- *
111
- * @see https://eslint.org/docs/latest/rules/no-new-native-nonconstructor
112
- */
113
- "no-new-native-nonconstructor": "error",
114
- /**
115
- * Disallow new operators with String, Number, and Boolean objects.
116
- *
117
- * @see https://eslint.org/docs/latest/rules/no-new-wrappers
118
- */
119
- "no-new-wrappers": "error",
120
- /**
121
- * Disallow octal escape sequences in string literals.
122
- *
123
- * @see https://eslint.org/docs/latest/rules/no-octal-escape
124
- */
125
- "no-octal-escape": "error",
126
- /**
127
- * Disallow variable redeclaration.
128
- *
129
- * @see https://eslint.org/docs/latest/rules/no-redeclare
130
- */
131
- "no-redeclare": "error",
132
- /**
133
- * Disallow comparisons where both sides are exactly the same.
134
- *
135
- * @see https://eslint.org/docs/latest/rules/no-self-compare
136
- */
137
- "no-self-compare": "error",
138
- /**
139
- * Disallow comma operators.
140
- *
141
- * @see https://eslint.org/docs/latest/rules/no-sequences
142
- */
143
- "no-sequences": "error",
144
- /**
145
- * Disallow throwing literals as exceptions.
146
- *
147
- * @see https://eslint.org/docs/latest/rules/no-throw-literal
148
- */
149
- "no-throw-literal": "error",
150
- /**
151
- * Disallow loops with a body that allows only one iteration.
152
- *
153
- * @see https://eslint.org/docs/latest/rules/no-unreachable-loop
154
- */
155
- "no-unreachable-loop": "error",
156
- /**
157
- * Disallow redundant return statements.
158
- *
159
- * @see https://eslint.org/docs/latest/rules/no-useless-return
160
- */
161
- "no-useless-return": "error",
162
- /**
163
- * Require var declarations be placed at the top of their scope.
164
- *
165
- * @see https://eslint.org/docs/latest/rules/vars-on-top
166
- */
167
- "vars-on-top": "error",
168
- /**
169
- * Require let or const instead of var.
170
- *
171
- * @see https://eslint.org/docs/latest/rules/no-var
172
- */
173
- "no-var": "error",
174
- /**
175
- * Require const declarations for variables that are never reassigned.
176
- *
177
- * @see https://eslint.org/docs/latest/rules/prefer-const
178
- */
179
- "prefer-const": "error",
180
- /**
181
- * Require object spread over Object.assign.
182
- *
183
- * @see https://eslint.org/docs/latest/rules/prefer-object-spread
184
- */
185
- "prefer-object-spread": "error",
186
- /**
187
- * Require rest parameters instead of arguments.
188
- *
189
- * @see https://eslint.org/docs/latest/rules/prefer-rest-params
190
- */
191
- "prefer-rest-params": "error",
192
- /**
193
- * Require spread operators instead of .apply().
194
- *
195
- * @see https://eslint.org/docs/latest/rules/prefer-spread
196
- */
197
- "prefer-spread": "error",
198
- /**
199
- * Disallow returning a value from a Promise executor.
200
- *
201
- * @see https://eslint.org/docs/latest/rules/no-promise-executor-return
202
- */
203
- "no-promise-executor-return": "error",
204
- /**
205
- * Disallow template literal placeholder syntax in regular strings.
206
- *
207
- * @see https://eslint.org/docs/latest/rules/no-template-curly-in-string
208
- */
209
- "no-template-curly-in-string": "error",
210
- /**
211
- * Disallow unmodified conditions of loops.
212
- *
213
- * @see https://eslint.org/docs/latest/rules/no-unmodified-loop-condition
214
- */
215
- "no-unmodified-loop-condition": "error",
216
- /**
217
- * Disallow unnecessary nested blocks.
218
- *
219
- * @see https://eslint.org/docs/latest/rules/no-lone-blocks
220
- */
221
- "no-lone-blocks": "error",
222
- /**
223
- * Disallow renaming import, export, and destructured assignments to the same name.
224
- *
225
- * @see https://eslint.org/docs/latest/rules/no-useless-rename
226
- */
227
- "no-useless-rename": "error",
228
- /**
229
- * Disallow unnecessary computed property keys in objects and classes.
230
- *
231
- * @see https://eslint.org/docs/latest/rules/no-useless-computed-key
232
- */
233
- "no-useless-computed-key": "error",
234
- /**
235
- * Disallow await inside of loops.
236
- *
237
- * @see https://eslint.org/docs/latest/rules/no-await-in-loop
238
- */
239
- "no-await-in-loop": "warn",
240
- /**
241
- * Disallow reassigning function parameters.
242
- *
243
- * @see https://eslint.org/docs/latest/rules/no-param-reassign
244
- */
245
- "no-param-reassign": "error",
246
- /**
247
- * Custom JS Rules: Code Quality & Complexity
248
- */
249
- /**
250
- * Enforce a maximum cyclomatic complexity allowed in a program.
251
- *
252
- * @see https://eslint.org/docs/latest/rules/complexity
253
- */
254
- complexity: ["error", { max: 25 }],
255
- /**
256
- * Enforce a maximum depth that blocks can be nested.
257
- *
258
- * @see https://eslint.org/docs/latest/rules/max-depth
259
- */
260
- "max-depth": ["error", 5],
261
- /**
262
- * Enforce a maximum depth that callbacks can be nested.
263
- *
264
- * @see https://eslint.org/docs/latest/rules/max-nested-callbacks
265
- */
266
- "max-nested-callbacks": ["error", 3],
267
- /**
268
- * Enforce a maximum number of parameters in function definitions.
269
- *
270
- * @see https://eslint.org/docs/latest/rules/max-params
271
- */
272
- "max-params": ["error", 3],
273
- /**
274
- * Require for-in loops to include an if statement.
275
- *
276
- * @see https://eslint.org/docs/latest/rules/guard-for-in
277
- */
278
- "guard-for-in": "error",
279
- /**
280
- * Require grouped accessor pairs in object literals and classes.
281
- *
282
- * @see https://eslint.org/docs/latest/rules/grouped-accessor-pairs
283
- */
284
- "grouped-accessor-pairs": "error",
285
- /**
286
- * Require constructor names to begin with a capital letter.
287
- *
288
- * @see https://eslint.org/docs/latest/rules/new-cap
289
- */
290
- "new-cap": [
291
- "error",
292
- {
293
- newIsCap: true,
294
- capIsNew: false,
295
- properties: true
296
- }
297
- ],
298
- /**
299
- * Disallow returning value from constructor.
300
- *
301
- * @see https://eslint.org/docs/latest/rules/no-constructor-return
302
- */
303
- "no-constructor-return": "error",
304
- /**
305
- * Disallow variable or function declarations in nested blocks.
306
- *
307
- * @see https://eslint.org/docs/latest/rules/no-inner-declarations
308
- */
309
- "no-inner-declarations": "error",
310
- /**
311
- * Disallow the use of console.
312
- *
313
- * @see https://eslint.org/docs/latest/rules/no-console
314
- */
315
- "no-console": "warn",
316
- /**
317
- * Custom Configuration Adjustments
318
- * Override ESLint recommended rules where we want different behavior
319
- */
320
- /**
321
- * Disallow assignment operators in conditional expressions except when enclosed in parentheses.
322
- *
323
- * @see https://eslint.org/docs/latest/rules/no-cond-assign
324
- */
325
- "no-cond-assign": ["error", "except-parens"],
326
- /**
327
- * Disallow constant expressions in conditions except loops.
328
- *
329
- * @see https://eslint.org/docs/latest/rules/no-constant-condition
330
- */
331
- "no-constant-condition": ["error", { checkLoops: false }],
332
- /**
333
- * Disallow empty block statements except catch blocks.
334
- *
335
- * @see https://eslint.org/docs/latest/rules/no-empty
336
- */
337
- "no-empty": ["error", { allowEmptyCatch: true }],
338
- /**
339
- * Import Ordering and Organization
340
- * Enforces consistent import structure
341
- */
342
- /**
343
- * Enforce a convention in module import order.
344
- *
345
- * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
346
- */
347
- "import/order": [
348
- "error",
349
- {
350
- groups: [
351
- // Externals
352
- ["builtin", "external"],
353
- // Internals
354
- ["internal", "unknown", "parent", "sibling", "index"],
355
- // Types
356
- ["object", "type"]
357
- ],
358
- "newlines-between": "always",
359
- alphabetize: { order: "asc", caseInsensitive: true },
360
- warnOnUnassignedImports: true
361
- }
362
- ],
363
- /**
364
- * Require exports to be placed at the end of the file.
365
- *
366
- * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/exports-last.md
367
- */
368
- "import/exports-last": "warn",
369
- /**
370
- * Require imports to be placed before other statements.
371
- *
372
- * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
373
- */
374
- "import/first": "error",
375
- /**
376
- * Require a newline after import statements.
377
- *
378
- * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
379
- */
380
- "import/newline-after-import": "error",
381
- /**
382
- * Unused Imports Handling
383
- * Uses unused-imports plugin for better detection
384
- */
385
- /**
386
- * Disables base no-unused-vars (replaced by unused-imports).
387
- */
388
- "no-unused-vars": "off",
389
- /**
390
- * Disallow unused imports.
391
- *
392
- * @see https://github.com/sweepline/eslint-plugin-unused-imports
393
- */
394
- "uimports/no-unused-imports": "error",
395
- /**
396
- * Disallow unused variables.
397
- *
398
- * @see https://github.com/sweepline/eslint-plugin-unused-imports
399
- */
400
- "uimports/no-unused-vars": [
401
- "warn",
402
- {
403
- vars: "all",
404
- varsIgnorePattern: "^_",
405
- args: "after-used",
406
- argsIgnorePattern: "^_"
407
- }
408
- ]
409
- }
410
- },
411
- {
412
- /**
413
- * TypeScript-Specific Configuration
414
- */
415
- files: ["**/*.{ts,tsx}"],
416
- plugins: {
417
- "@typescript-eslint": tseslint.plugin
418
- },
419
- languageOptions: {
420
- parser: tseslint.parser,
421
- parserOptions: {
422
- project: "./tsconfig.json"
423
- }
424
- },
425
- extends: [
426
- /**
427
- * TypeScript ESLint Recommended Rules
428
- *
429
- * @see https://typescript-eslint.io/rules
430
- */
431
- tseslint.configs.strictTypeChecked
432
- ],
433
- rules: {
434
- /**
435
- * Allow explicit any for flexibility.
436
- *
437
- * @see https://typescript-eslint.io/rules/no-explicit-any
438
- */
439
- "@typescript-eslint/no-explicit-any": "off",
440
- /**
441
- * Allow non-null assertions.
442
- *
443
- * @see https://typescript-eslint.io/rules/no-non-null-assertion
444
- */
445
- "@typescript-eslint/no-non-null-assertion": "warn",
446
- /**
447
- * Require Promise-like statements to be handled appropriately.
448
- *
449
- * @see https://typescript-eslint.io/rules/no-floating-promises
450
- */
451
- "@typescript-eslint/no-floating-promises": "error",
452
- /**
453
- * Require explicit accessibility modifiers on class properties and methods.
454
- *
455
- * @see https://typescript-eslint.io/rules/explicit-member-accessibility
456
- */
457
- "@typescript-eslint/explicit-member-accessibility": "error",
458
- /**
459
- * Require a consistent member declaration order.
460
- *
461
- * @see https://typescript-eslint.io/rules/member-ordering
462
- */
463
- "@typescript-eslint/member-ordering": [
464
- "error",
465
- {
466
- default: [
467
- // Fields
468
- "public-static-field",
469
- "protected-static-field",
470
- "private-static-field",
471
- "public-instance-field",
472
- "protected-instance-field",
473
- "private-instance-field",
474
- // Constructors
475
- "public-constructor",
476
- "protected-constructor",
477
- "private-constructor",
478
- // Methods
479
- "public-static-method",
480
- "protected-static-method",
481
- "private-static-method",
482
- "public-instance-method",
483
- "protected-instance-method",
484
- "private-instance-method"
485
- ]
486
- }
487
- ],
488
- /**
489
- * Enforce using a particular method signature syntax.
490
- *
491
- * @see https://typescript-eslint.io/rules/method-signature-style
492
- */
493
- "@typescript-eslint/method-signature-style": "error",
494
- /**
495
- * Enforce consistent usage of type assertions.
496
- *
497
- * @see https://typescript-eslint.io/rules/consistent-type-assertions
498
- */
499
- "@typescript-eslint/consistent-type-assertions": [
500
- "error",
501
- {
502
- assertionStyle: "as",
503
- objectLiteralTypeAssertions: "never"
504
- }
505
- ],
506
- /**
507
- * Enforce type definitions to consistently use interface or type.
508
- *
509
- * @see https://typescript-eslint.io/rules/consistent-type-definitions
510
- */
511
- "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
512
- /**
513
- * Enforce consistent usage of type imports.
514
- *
515
- * @see https://typescript-eslint.io/rules/consistent-type-imports
516
- */
517
- "@typescript-eslint/consistent-type-imports": "error",
518
- /**
519
- * Disallow type imports with side effects.
520
- *
521
- * @see https://typescript-eslint.io/rules/no-import-type-side-effects
522
- */
523
- "@typescript-eslint/no-import-type-side-effects": "error",
524
- /**
525
- * Require using for-of loops instead of standard for loops over arrays.
526
- *
527
- * @see https://typescript-eslint.io/rules/prefer-for-of
528
- */
529
- "@typescript-eslint/prefer-for-of": "warn",
530
- /**
531
- * Require using function types instead of interfaces with call signatures.
532
- *
533
- * @see https://typescript-eslint.io/rules/prefer-function-type
534
- */
535
- "@typescript-eslint/prefer-function-type": "error",
536
- /**
537
- * Require using nullish coalescing operator instead of logical OR.
538
- *
539
- * @see https://typescript-eslint.io/rules/prefer-nullish-coalescing
540
- */
541
- "@typescript-eslint/prefer-nullish-coalescing": "error",
542
- /**
543
- * Custom Overrides for TypeScript Rules
544
- */
545
- /**
546
- * Disallow TypeScript namespaces except in declarations and definition files.
547
- *
548
- * @see https://typescript-eslint.io/rules/no-namespace
549
- */
550
- "@typescript-eslint/no-namespace": [
551
- "error",
552
- {
553
- allowDeclarations: true,
554
- allowDefinitionFiles: true
555
- }
556
- ],
557
- /**
558
- * Require awaiting a value before returning it from an async function.
559
- *
560
- * @see https://typescript-eslint.io/rules/return-await
561
- */
562
- "@typescript-eslint/return-await": ["warn", "always"],
563
- /**
564
- * Disable TypeScript no-unused-vars (using unused-imports plugin).
565
- */
566
- "@typescript-eslint/no-unused-vars": "off",
567
- /**
568
- * Disallow classes used as namespaces except when used with decorators.
569
- *
570
- * @see https://typescript-eslint.io/rules/no-extraneous-class
571
- */
572
- "@typescript-eslint/no-extraneous-class": [
573
- "error",
574
- {
575
- allowWithDecorator: true
576
- }
577
- ]
578
- }
579
- }
580
- ]);
581
-
582
- // src/configs/flavour-config-files.ts
583
- import { defineConfig as defineConfig2 } from "eslint/config";
584
- import globals from "globals";
585
- var config2 = defineConfig2([
586
- {
587
- languageOptions: {
588
- globals: {
589
- ...globals.node
590
- }
591
- },
592
- rules: {
593
- /**
594
- * Disallow the use of console.
595
- * Disabled for config files that often log build information.
596
- *
597
- * @see https://eslint.org/docs/latest/rules/no-console
598
- */
599
- "no-console": "off",
600
- /**
601
- * Enforce a maximum number of lines per function.
602
- * Disabled for complex build configurations.
603
- *
604
- * @see https://eslint.org/docs/latest/rules/max-lines-per-function
605
- */
606
- "max-lines-per-function": "off",
607
- /**
608
- * Disallow require statements except in import statements.
609
- * Disabled for CommonJS config files.
610
- *
611
- * @see https://typescript-eslint.io/rules/no-var-requires
612
- */
613
- "@typescript-eslint/no-var-requires": "off"
614
- }
615
- }
616
- ]);
617
-
618
- // src/configs/flavour-nestjs.ts
619
- import { defineConfig as defineConfig3 } from "eslint/config";
620
- var config3 = defineConfig3([
621
- {
622
- files: ["**/*.{ts,js}"],
623
- rules: {
624
- /**
625
- * Enforce a maximum number of parameters in function definitions.
626
- * Increased to 8 for NestJS dependency injection patterns.
627
- *
628
- * @see https://eslint.org/docs/latest/rules/max-params
629
- */
630
- "max-params": ["error", 8],
631
- /**
632
- * Disallow useless constructors.
633
- * Disabled for NestJS as DI decorators make constructors appear "useless".
634
- *
635
- * @see https://typescript-eslint.io/rules/no-useless-constructor
636
- */
637
- "@typescript-eslint/no-useless-constructor": "off",
638
- /**
639
- * Disallow empty functions.
640
- * Allow empty constructors for NestJS DI parameter properties.
641
- *
642
- * @see https://typescript-eslint.io/rules/no-empty-function
643
- */
644
- "@typescript-eslint/no-empty-function": [
645
- "error",
646
- { allow: ["constructors"] }
647
- ],
648
- /**
649
- * Require or disallow parameter properties in class constructors.
650
- * Enforces NestJS DI pattern using parameter properties.
651
- *
652
- * @see https://typescript-eslint.io/rules/parameter-properties
653
- */
654
- "@typescript-eslint/parameter-properties": [
655
- "error",
656
- {
657
- allow: [
658
- "private readonly",
659
- "protected readonly",
660
- "public readonly",
661
- "private",
662
- "protected",
663
- "public"
664
- ],
665
- prefer: "parameter-property"
666
- }
667
- ]
668
- }
669
- }
670
- ]);
671
-
672
- // src/configs/flavour-stylistic.ts
673
- import stylistic from "@stylistic/eslint-plugin";
674
- import { defineConfig as defineConfig4 } from "eslint/config";
675
- var config4 = defineConfig4([
676
- {
677
- files: ["**/*.{ts,tsx,js,jsx}"],
678
- plugins: {
679
- "@stylistic": stylistic
680
- },
681
- rules: {
682
- /**
683
- * Enforce block comments to use starred-block style (multiline).
684
- * Prevents inline block comments like: /** foo *​/
685
- *
686
- * @see https://eslint.style/rules/default/multiline-comment-style
687
- */
688
- "@stylistic/multiline-comment-style": ["error", "starred-block"],
689
- /**
690
- * Enforce consistent spacing after // or /* delimiters.
691
- *
692
- * @see https://eslint.style/rules/default/spaced-comment
693
- */
694
- "@stylistic/spaced-comment": ["error", "always"],
695
- /**
696
- * Require a blank line before block and line comments.
697
- * Comments belong to the following code block, so only enforce
698
- * before, not after.
699
- *
700
- * Allows comments at the start of blocks, objects, arrays, classes,
701
- * interfaces, types, enums, and modules without a preceding blank line.
702
- *
703
- * @see https://eslint.style/rules/default/lines-around-comment
704
- */
705
- "@stylistic/lines-around-comment": [
706
- "error",
707
- {
708
- beforeBlockComment: true,
709
- beforeLineComment: true,
710
- allowBlockStart: true,
711
- allowObjectStart: true,
712
- allowArrayStart: true,
713
- allowClassStart: true,
714
- allowInterfaceStart: true,
715
- allowTypeStart: true,
716
- allowEnumStart: true,
717
- allowModuleStart: true
718
- }
719
- ],
720
- /**
721
- * Enforce line comments to be placed above the code line.
722
- *
723
- * @see https://eslint.style/rules/default/line-comment-position
724
- */
725
- "@stylistic/line-comment-position": ["error", "above"],
726
- /**
727
- * Require blank lines between specific statement types.
728
- * - After block-like statements (if, for, while, try, switch).
729
- * - Before return statements.
730
- * - After directives ("use strict", etc.).
731
- *
732
- * @see https://eslint.style/rules/default/padding-line-between-statements
733
- */
734
- "@stylistic/padding-line-between-statements": [
735
- "error",
736
- { blankLine: "always", prev: "block-like", next: "*" },
737
- { blankLine: "always", prev: "*", next: "return" },
738
- { blankLine: "always", prev: "directive", next: "*" }
739
- ],
740
- /**
741
- * Disallow padding inside blocks.
742
- * No empty lines right after { or before }.
743
- *
744
- * @see https://eslint.style/rules/default/padded-blocks
745
- */
746
- "@stylistic/padded-blocks": ["error", "never"],
747
- /**
748
- * Require blank lines between class members.
749
- * Except after single-line members and TypeScript overloads
750
- * to keep compact field declarations readable.
751
- *
752
- * @see https://eslint.style/rules/default/lines-between-class-members
753
- */
754
- "@stylistic/lines-between-class-members": [
755
- "error",
756
- "always",
757
- {
758
- exceptAfterSingleLine: true,
759
- exceptAfterOverload: true
760
- }
761
- ],
762
- /**
763
- * Limit consecutive empty lines.
764
- * Prettier already collapses multiple blank lines within code,
765
- * but this additionally prevents blank lines at the start of files.
766
- *
767
- * @see https://eslint.style/rules/default/no-multiple-empty-lines
768
- */
769
- "@stylistic/no-multiple-empty-lines": [
770
- "error",
771
- { max: 1, maxBOF: 0, maxEOF: 0 }
772
- ]
773
- }
774
- }
775
- ]);
776
-
777
- // src/configs/flavour-vitest.ts
778
- import vitest from "@vitest/eslint-plugin";
779
- import { defineConfig as defineConfig5 } from "eslint/config";
780
- var config5 = defineConfig5([
781
- {
782
- files: [
783
- "**/*.test.{ts,tsx,js,jsx}",
784
- "**/*.spec.{ts,tsx,js,jsx}",
785
- "**/__tests__/**/*.{ts,tsx,js,jsx}"
786
- ],
787
- plugins: {
788
- vitest
789
- },
790
- languageOptions: {
791
- globals: {
792
- ...vitest.environments.env.globals
793
- }
794
- },
795
- settings: {
796
- vitest: {
797
- typecheck: true
798
- }
799
- },
800
- rules: {
801
- /**
802
- * Enable Vitest recommended rules.
803
- */
804
- ...vitest.configs.recommended.rules,
805
- /**
806
- * Enforce a maximum number of parameters in function definitions.
807
- * Increased to 5 for test setup functions that receive fixtures and mocks.
808
- *
809
- * @see https://eslint.org/docs/latest/rules/max-params
810
- */
811
- "max-params": ["error", 5],
812
- /**
813
- * Enforce a maximum depth that callbacks can be nested.
814
- * Increased to 5 for describe/it/beforeEach nesting patterns.
815
- *
816
- * @see https://eslint.org/docs/latest/rules/max-nested-callbacks
817
- */
818
- "max-nested-callbacks": ["error", 5],
819
- /**
820
- * Enforce a maximum cyclomatic complexity allowed in a program.
821
- * Increased to 30 and downgraded to warn for complex test scenarios.
822
- *
823
- * @see https://eslint.org/docs/latest/rules/complexity
824
- */
825
- complexity: ["warn", 30],
826
- /**
827
- * Enforce a maximum number of lines per function.
828
- * Disabled for test cases with comprehensive setup and assertions.
829
- *
830
- * @see https://eslint.org/docs/latest/rules/max-lines-per-function
831
- */
832
- "max-lines-per-function": "off",
833
- /**
834
- * Enforce a maximum number of statements allowed in function blocks.
835
- * Disabled for tests with multiple setup and assertion statements.
836
- *
837
- * @see https://eslint.org/docs/latest/rules/max-statements
838
- */
839
- "max-statements": "off",
840
- /**
841
- * Enforce a maximum number of lines per file.
842
- * Disabled for comprehensive test suites.
843
- *
844
- * @see https://eslint.org/docs/latest/rules/max-lines
845
- */
846
- "max-lines": "off",
847
- /**
848
- * Disallow assigning a value with type any to variables and properties.
849
- * Disabled for mock objects and test utilities.
850
- *
851
- * @see https://typescript-eslint.io/rules/no-unsafe-assignment
852
- */
853
- "@typescript-eslint/no-unsafe-assignment": "off",
854
- /**
855
- * Disallow member access on a value with type any.
856
- * Disabled for mock objects.
857
- *
858
- * @see https://typescript-eslint.io/rules/no-unsafe-member-access
859
- */
860
- "@typescript-eslint/no-unsafe-member-access": "off",
861
- /**
862
- * Disallow calling a value with type any.
863
- * Disabled for test utilities like vi.fn().
864
- *
865
- * @see https://typescript-eslint.io/rules/no-unsafe-call
866
- */
867
- "@typescript-eslint/no-unsafe-call": "off",
868
- /**
869
- * Disallow returning a value with type any from a function.
870
- * Disabled for test helper functions.
871
- *
872
- * @see https://typescript-eslint.io/rules/no-unsafe-return
873
- */
874
- "@typescript-eslint/no-unsafe-return": "off",
875
- /**
876
- * Disallow passing a value with type any to a function parameter.
877
- * Disabled for test mock parameters.
878
- *
879
- * @see https://typescript-eslint.io/rules/no-unsafe-argument
880
- */
881
- "@typescript-eslint/no-unsafe-argument": "off",
882
- /**
883
- * Require unbound methods to be called with correct this context.
884
- * Disabled for Vitest expectations like expect(obj.method).toBeCalled().
885
- *
886
- * @see https://typescript-eslint.io/rules/unbound-method
887
- */
888
- "@typescript-eslint/unbound-method": "off",
889
- /**
890
- * Disallow magic numbers.
891
- * Disabled for test assertions with literal values.
892
- *
893
- * @see https://typescript-eslint.io/rules/no-magic-numbers
894
- */
895
- "@typescript-eslint/no-magic-numbers": "off",
896
- /**
897
- * Require Promise-like statements to be handled appropriately.
898
- * Downgraded to warn for test utilities.
899
- *
900
- * @see https://typescript-eslint.io/rules/no-floating-promises
901
- */
902
- "@typescript-eslint/no-floating-promises": "warn",
903
- /**
904
- * Disallow non-null assertions using the ! postfix operator.
905
- * Disabled for tests where values are known to exist.
906
- *
907
- * @see https://typescript-eslint.io/rules/no-non-null-assertion
908
- */
909
- "@typescript-eslint/no-non-null-assertion": "off",
910
- /**
911
- * Disallow empty functions.
912
- * Disabled for test stubs and spies.
913
- *
914
- * @see https://eslint.org/docs/latest/rules/no-empty-function
915
- */
916
- "no-empty-function": "off",
917
- /**
918
- * Disallow empty functions.
919
- * Disabled for test stubs and spies.
920
- *
921
- * @see https://typescript-eslint.io/rules/no-empty-function
922
- */
923
- "@typescript-eslint/no-empty-function": "off",
924
- /**
925
- * Disallow magic numbers.
926
- * Disabled for test assertions.
927
- *
928
- * @see https://eslint.org/docs/latest/rules/no-magic-numbers
929
- */
930
- "no-magic-numbers": "off",
931
- /**
932
- * Disallow the use of console.
933
- * Disabled for test debugging.
934
- *
935
- * @see https://eslint.org/docs/latest/rules/no-console
936
- */
937
- "no-console": "off",
938
- /**
939
- * Disallow focused tests.
940
- * Prevents .only from being committed.
941
- *
942
- * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-focused-tests.md
943
- */
944
- "vitest/no-focused-tests": "error",
945
- /**
946
- * Disallow disabled tests.
947
- * Warns about .skip usage.
948
- *
949
- * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-disabled-tests.md
950
- */
951
- "vitest/no-disabled-tests": "warn",
952
- /**
953
- * Enforce lowercase test names.
954
- * Consistent test naming convention.
955
- *
956
- * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-lowercase-title.md
957
- */
958
- "vitest/prefer-lowercase-title": "warn",
959
- /**
960
- * Enforce a maximum depth for nested describe calls.
961
- *
962
- * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/max-nested-describe.md
963
- */
964
- "vitest/max-nested-describe": ["error", { max: 5 }],
965
- /**
966
- * Disallow conditional logic in tests.
967
- * Tests should be deterministic.
968
- *
969
- * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-in-test.md
970
- */
971
- "vitest/no-conditional-in-test": "error",
972
- /**
973
- * Disallow conditional expects.
974
- * Expectations should not be inside conditionals.
975
- *
976
- * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-expect.md
977
- */
978
- "vitest/no-conditional-expect": "error",
979
- /**
980
- * Enforce consistent hook ordering.
981
- *
982
- * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-in-order.md
983
- */
984
- "vitest/prefer-hooks-in-order": "warn",
985
- /**
986
- * Prefer vi.spyOn over manual mocks.
987
- *
988
- * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-spy-on.md
989
- */
990
- "vitest/prefer-spy-on": "warn"
991
- }
992
- }
993
- ]);
994
- export {
995
- config as base,
996
- config2 as configFiles,
997
- config3 as nestjs,
998
- config4 as stylistic,
999
- config5 as vitest
1000
- };