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