@xylabs/eslint-config-flat 8.2.0 → 8.2.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.
Files changed (56) hide show
  1. package/README.md +30 -2
  2. package/dist/neutral/core/index.d.ts +2 -0
  3. package/dist/neutral/core/index.d.ts.map +1 -1
  4. package/dist/neutral/import/index.d.ts.map +1 -1
  5. package/dist/neutral/index.d.ts +9 -8
  6. package/dist/neutral/index.d.ts.map +1 -1
  7. package/dist/neutral/index.mjs +648 -195
  8. package/dist/neutral/index.mjs.map +4 -4
  9. package/dist/neutral/rules/consistency.d.ts +3 -0
  10. package/dist/neutral/rules/consistency.d.ts.map +1 -0
  11. package/dist/neutral/rules/correctness.d.ts +3 -0
  12. package/dist/neutral/rules/correctness.d.ts.map +1 -0
  13. package/dist/neutral/rules/index.d.ts +2 -0
  14. package/dist/neutral/rules/index.d.ts.map +1 -1
  15. package/dist/neutral/sonar/index.d.ts.map +1 -1
  16. package/dist/neutral/tiers/conflicts.d.ts +20 -0
  17. package/dist/neutral/tiers/conflicts.d.ts.map +1 -0
  18. package/dist/neutral/tiers/index.d.ts +35 -0
  19. package/dist/neutral/tiers/index.d.ts.map +1 -0
  20. package/dist/neutral/tiers/opinionated.d.ts +5 -0
  21. package/dist/neutral/tiers/opinionated.d.ts.map +1 -0
  22. package/dist/neutral/tiers/plugin-rules.d.ts +8 -0
  23. package/dist/neutral/tiers/plugin-rules.d.ts.map +1 -0
  24. package/dist/neutral/typescript/index.d.ts +5 -0
  25. package/dist/neutral/typescript/index.d.ts.map +1 -1
  26. package/dist/neutral/unicorn/index.d.ts +3 -1
  27. package/dist/neutral/unicorn/index.d.ts.map +1 -1
  28. package/dist/neutral/workspaces/index.d.ts.map +1 -1
  29. package/dist/node/core/index.d.ts +2 -0
  30. package/dist/node/core/index.d.ts.map +1 -1
  31. package/dist/node/import/index.d.ts.map +1 -1
  32. package/dist/node/index.d.ts +9 -8
  33. package/dist/node/index.d.ts.map +1 -1
  34. package/dist/node/index.mjs +648 -195
  35. package/dist/node/index.mjs.map +4 -4
  36. package/dist/node/rules/consistency.d.ts +3 -0
  37. package/dist/node/rules/consistency.d.ts.map +1 -0
  38. package/dist/node/rules/correctness.d.ts +3 -0
  39. package/dist/node/rules/correctness.d.ts.map +1 -0
  40. package/dist/node/rules/index.d.ts +2 -0
  41. package/dist/node/rules/index.d.ts.map +1 -1
  42. package/dist/node/sonar/index.d.ts.map +1 -1
  43. package/dist/node/tiers/conflicts.d.ts +20 -0
  44. package/dist/node/tiers/conflicts.d.ts.map +1 -0
  45. package/dist/node/tiers/index.d.ts +35 -0
  46. package/dist/node/tiers/index.d.ts.map +1 -0
  47. package/dist/node/tiers/opinionated.d.ts +5 -0
  48. package/dist/node/tiers/opinionated.d.ts.map +1 -0
  49. package/dist/node/tiers/plugin-rules.d.ts +8 -0
  50. package/dist/node/tiers/plugin-rules.d.ts.map +1 -0
  51. package/dist/node/typescript/index.d.ts +5 -0
  52. package/dist/node/typescript/index.d.ts.map +1 -1
  53. package/dist/node/unicorn/index.d.ts +3 -1
  54. package/dist/node/unicorn/index.d.ts.map +1 -1
  55. package/dist/node/workspaces/index.d.ts.map +1 -1
  56. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
- // src/core/index.ts
2
- import js from "@eslint/js";
1
+ // src/json/index.ts
2
+ import json from "@eslint/json";
3
3
 
4
4
  // src/ignores.ts
5
5
  var ignores = [
@@ -22,6 +22,32 @@ var ignores = [
22
22
  "yarn.lock"
23
23
  ];
24
24
 
25
+ // src/json/index.ts
26
+ var jsonConfig = {
27
+ ignores,
28
+ files: ["**/*.json"],
29
+ plugins: { json },
30
+ language: "json/json",
31
+ rules: { "json/no-duplicate-keys": ["error"] }
32
+ };
33
+ var jsoncConfig = {
34
+ ignores,
35
+ files: ["**/*.jsonc"],
36
+ plugins: { json },
37
+ language: "json/jsonc",
38
+ rules: { "json/no-duplicate-keys": ["error"] }
39
+ };
40
+ var json5Config = {
41
+ ignores,
42
+ files: ["**/*.json5"],
43
+ plugins: { json },
44
+ language: "json/json5",
45
+ rules: { "json/no-duplicate-keys": ["error"] }
46
+ };
47
+
48
+ // src/markdown/index.ts
49
+ import markdown from "@eslint/markdown";
50
+
25
51
  // src/shared.ts
26
52
  import tsParser from "@typescript-eslint/parser";
27
53
  var scriptFiles = [
@@ -91,7 +117,34 @@ function scopeConfigs(configs, options = {}) {
91
117
  return (Array.isArray(configs) ? configs : [configs]).map((config2) => scopeConfig(config2, options));
92
118
  }
93
119
 
94
- // src/rules/index.ts
120
+ // src/markdown/index.ts
121
+ var markdownConfig = scopeConfigs(markdown.configs.recommended);
122
+
123
+ // src/core/index.ts
124
+ import js from "@eslint/js";
125
+
126
+ // src/rules/consistency.ts
127
+ var consistencyRulesConfig = {
128
+ ignores,
129
+ rules: {
130
+ "complexity": ["error", 18],
131
+ "max-depth": ["error", 6],
132
+ "max-lines": [
133
+ "error",
134
+ {
135
+ max: 512,
136
+ skipBlankLines: true
137
+ }
138
+ ],
139
+ "array-element-newline": ["warn", "consistent"],
140
+ // Owned by max-nested-callbacks — measures callback nesting, not call depth
141
+ "max-nested-callbacks": ["error", 6],
142
+ "max-statements": ["error", 32],
143
+ "no-tabs": ["error"]
144
+ }
145
+ };
146
+
147
+ // src/rules/correctness.ts
95
148
  var restrictedImportPaths = [
96
149
  "./index.ts",
97
150
  "../index.ts",
@@ -102,6 +155,33 @@ var restrictedImportPaths = [
102
155
  "../../../../../../index.ts",
103
156
  "../../../../../../../index.ts"
104
157
  ];
158
+ var correctnessRulesConfig = {
159
+ ignores,
160
+ rules: {
161
+ // Owned by @typescript-eslint/no-unused-vars
162
+ "no-unused-vars": "off",
163
+ // Owned by unicorn/escape-case
164
+ "no-useless-escape": "off",
165
+ // Owned by unicorn/prefer-spread
166
+ "prefer-spread": "off",
167
+ "no-restricted-imports": [
168
+ "error",
169
+ { paths: restrictedImportPaths }
170
+ ]
171
+ }
172
+ };
173
+
174
+ // src/rules/index.ts
175
+ var restrictedImportPaths2 = [
176
+ "./index.ts",
177
+ "../index.ts",
178
+ "../../index.ts",
179
+ "../../../index.ts",
180
+ "../../../../index.ts",
181
+ "../../../../../index.ts",
182
+ "../../../../../../index.ts",
183
+ "../../../../../../../index.ts"
184
+ ];
105
185
  var restrictedSrcImportPatterns = [
106
186
  {
107
187
  group: [
@@ -115,25 +195,8 @@ var restrictedSrcImportPatterns = [
115
195
  var rulesConfig = {
116
196
  ignores,
117
197
  rules: {
118
- "complexity": ["error", 18],
119
- "max-depth": ["error", 6],
120
- "max-lines": [
121
- "error",
122
- {
123
- max: 512,
124
- skipBlankLines: true
125
- }
126
- ],
127
- "array-element-newline": ["warn", "consistent"],
128
- "max-nested-callbacks": ["error", 6],
129
- "max-statements": ["error", 32],
130
- "no-restricted-imports": [
131
- "error",
132
- { paths: restrictedImportPaths }
133
- ],
134
- "no-tabs": ["error"],
135
- "no-unused-vars": "off",
136
- "no-useless-escape": "off"
198
+ ...correctnessRulesConfig.rules,
199
+ ...consistencyRulesConfig.rules
137
200
  }
138
201
  };
139
202
  var srcImportsConfig = {
@@ -143,7 +206,7 @@ var srcImportsConfig = {
143
206
  "no-restricted-imports": [
144
207
  "error",
145
208
  {
146
- paths: restrictedImportPaths,
209
+ paths: restrictedImportPaths2,
147
210
  patterns: restrictedSrcImportPatterns
148
211
  }
149
212
  ]
@@ -152,14 +215,12 @@ var srcImportsConfig = {
152
215
 
153
216
  // src/unicorn/index.ts
154
217
  import unicornPlugin from "eslint-plugin-unicorn";
155
- var unicornV66NewRules = [
218
+ var unicornV66MigrationQueue = [
156
219
  "unicorn/class-reference-in-static-methods",
157
220
  "unicorn/comment-content",
158
- "unicorn/consistent-class-member-order",
159
221
  "unicorn/consistent-export-decorator-position",
160
222
  "unicorn/consistent-optional-chaining",
161
223
  "unicorn/explicit-timer-delay",
162
- "unicorn/max-nested-calls",
163
224
  "unicorn/no-array-reverse",
164
225
  "unicorn/no-array-sort",
165
226
  "unicorn/no-break-in-nested-loop",
@@ -225,20 +286,32 @@ var unicornV66NewRules = [
225
286
  "unicorn/require-array-sort-compare",
226
287
  "unicorn/require-proxy-trap-boolean-return"
227
288
  ];
289
+ var unicornV66NewRules = unicornV66MigrationQueue;
228
290
  var unicornConfig = {
229
291
  ...unicornPlugin.configs.recommended,
230
292
  plugins: { unicorn: unicornPlugin },
231
293
  rules: {
232
294
  ...unicornPlugin.configs.recommended.rules,
233
- ...Object.fromEntries(unicornV66NewRules.map((rule) => [rule, "warn"])),
295
+ ...Object.fromEntries(unicornV66MigrationQueue.map((rule) => [rule, "warn"])),
296
+ // Owned by @typescript-eslint/member-ordering
297
+ "unicorn/consistent-class-member-order": ["off"],
298
+ // Owned by max-nested-callbacks
299
+ "unicorn/max-nested-calls": ["off"],
300
+ // Naming preference — too disruptive for org-wide enforcement
234
301
  "unicorn/catch-error-name": ["off"],
302
+ // Closure patterns are valid in our codebase
235
303
  "unicorn/consistent-function-scoping": ["off"],
304
+ // Tier 3 opinionated — enabled in opinionatedConfig
236
305
  "unicorn/filename-case": ["off"],
237
306
  "unicorn/new-for-builtins": ["off"],
238
307
  "unicorn/no-array-callback-reference": ["off"],
308
+ // Tier 3 opinionated — enabled in opinionatedConfig
239
309
  "unicorn/no-await-expression-member": ["off"],
310
+ // Owned by unicorn/no-unnecessary-nested-ternary
240
311
  "unicorn/no-nested-ternary": ["off"],
312
+ // Org uses null alongside undefined
241
313
  "unicorn/no-null": ["off"],
314
+ // Formatting — candidate for stylistic tier; overlaps @stylistic formatting
242
315
  "unicorn/number-literal-case": ["off"],
243
316
  "unicorn/prefer-module": ["off"],
244
317
  "unicorn/prefer-top-level-await": ["off"],
@@ -254,19 +327,27 @@ var workspacesConfig = {
254
327
  plugins: { workspaces: workspacesPlugin },
255
328
  rules: {
256
329
  ...workspacesPlugin.configs.recommended.rules,
330
+ // Tier 3 opinionated — enabled in opinionatedConfig
257
331
  "workspaces/no-relative-imports": ["off"],
258
332
  "workspaces/require-dependency": ["off"]
259
333
  }
260
334
  };
261
335
 
262
336
  // src/core/index.ts
263
- var coreConfig = [
337
+ var correctnessCoreConfig = [
264
338
  scopeConfig(js.configs.recommended, { files: scriptFiles, languageOptions: scriptLanguageOptions }),
265
- rulesConfig,
339
+ correctnessRulesConfig,
266
340
  srcImportsConfig,
267
- scopeConfig(unicornConfig, { files: scriptFiles }),
268
341
  workspacesConfig
269
342
  ];
343
+ var bestPracticesCoreConfig = [
344
+ scopeConfig(unicornConfig, { files: scriptFiles })
345
+ ];
346
+ var coreConfig = [
347
+ ...correctnessCoreConfig,
348
+ consistencyRulesConfig,
349
+ ...bestPracticesCoreConfig
350
+ ];
270
351
 
271
352
  // src/import/index.ts
272
353
  import importPlugin from "eslint-plugin-import-x";
@@ -284,13 +365,15 @@ var importConfig = [
284
365
  },
285
366
  settings: { "import-x/resolver": { typescript: { alwaysTryTypes: true, project: "./tsconfig.json" } } },
286
367
  rules: {
368
+ // Owned by simple-import-sort/imports
287
369
  "simple-import-sort/imports": ["warn"],
288
370
  "simple-import-sort/exports": ["warn"],
371
+ // Type-aware resolution is slow and requires per-repo resolver setup
289
372
  "import-x/default": ["off"],
290
373
  "import-x/named": ["off"],
291
374
  "import-x/namespace": ["off"],
292
- "import-x/no-absolute-path": ["warn"],
293
375
  "import-x/no-unresolved": ["off"],
376
+ "import-x/no-absolute-path": ["warn"],
294
377
  "import-x/no-cycle": [
295
378
  "warn",
296
379
  { maxDepth: 5 }
@@ -305,57 +388,281 @@ var importConfig = [
305
388
  }
306
389
  ];
307
390
 
308
- // src/json/index.ts
309
- import json from "@eslint/json";
310
- var jsonConfig = {
311
- ignores,
312
- files: ["**/*.json"],
313
- plugins: { json },
314
- language: "json/json",
315
- rules: { "json/no-duplicate-keys": ["error"] }
316
- };
317
- var jsoncConfig = {
318
- ignores,
319
- files: ["**/*.jsonc"],
320
- plugins: { json },
321
- language: "json/jsonc",
322
- rules: { "json/no-duplicate-keys": ["error"] }
323
- };
324
- var json5Config = {
391
+ // src/sonar/index.ts
392
+ import sonarjs from "eslint-plugin-sonarjs";
393
+ var sonarConfig = {
394
+ plugins: { sonarjs },
325
395
  ignores,
326
- files: ["**/*.json5"],
327
- plugins: { json },
328
- language: "json/json5",
329
- rules: { "json/no-duplicate-keys": ["error"] }
396
+ rules: {
397
+ "sonarjs/no-small-switch": ["off"],
398
+ "sonarjs/os-command": ["off"],
399
+ "sonarjs/no-os-command-from-path": ["off"],
400
+ "sonarjs/no-nested-conditional": ["off"],
401
+ "sonarjs/todo-tag": ["off"],
402
+ "sonarjs/deprecation": ["warn"],
403
+ "sonarjs/no-nested-functions": ["off"],
404
+ "sonarjs/function-return-type": ["off"],
405
+ "sonarjs/pseudo-random": ["off"],
406
+ "sonarjs/public-static-readonly": ["warn"],
407
+ "sonarjs/post-message": ["off"],
408
+ "sonarjs/different-types-comparison": ["off"],
409
+ // Owned by simple-import-sort/imports
410
+ "sonarjs/no-alphabetical-sort": ["off"],
411
+ "sonarjs/no-identical-functions": ["warn"],
412
+ "sonarjs/no-empty-test-file": ["off"],
413
+ "sonarjs/no-dead-store": ["warn"],
414
+ "sonarjs/no-redundant-jump": ["warn"],
415
+ "sonarjs/void-use": ["off"],
416
+ // Owned by complexity
417
+ "sonarjs/cognitive-complexity": ["off"],
418
+ // Owned by @typescript-eslint/no-unused-vars
419
+ "sonarjs/unused-import": ["off"],
420
+ "sonarjs/no-unused-vars": ["off"],
421
+ "sonarjs/no-commented-code": ["off"],
422
+ "sonarjs/prefer-single-boolean-return": ["off"],
423
+ "sonarjs/redundant-type-aliases": ["off"]
424
+ }
330
425
  };
331
426
 
332
- // src/markdown/index.ts
333
- import markdown from "@eslint/markdown";
334
- var markdownConfig = scopeConfigs(markdown.configs.recommended);
427
+ // src/tiers/conflicts.ts
428
+ var RULE_OWNERSHIP_GROUPS = [
429
+ {
430
+ description: "Class member ordering with alphabetical within-group sorting",
431
+ owner: "@typescript-eslint/member-ordering",
432
+ disabled: ["unicorn/consistent-class-member-order"]
433
+ },
434
+ {
435
+ description: "Callback nesting depth limit",
436
+ owner: "max-nested-callbacks",
437
+ disabled: ["unicorn/max-nested-calls"]
438
+ },
439
+ {
440
+ description: "Spread over Function.prototype.apply",
441
+ owner: "unicorn/prefer-spread",
442
+ disabled: ["prefer-spread"]
443
+ },
444
+ {
445
+ description: "Semicolon style",
446
+ owner: "@stylistic/semi",
447
+ disabled: ["semi"]
448
+ },
449
+ {
450
+ description: "Quote style",
451
+ owner: "@stylistic/quotes",
452
+ disabled: ["quotes"]
453
+ },
454
+ {
455
+ description: "Unused variable detection with TypeScript support",
456
+ owner: "@typescript-eslint/no-unused-vars",
457
+ disabled: ["no-unused-vars", "sonarjs/no-unused-vars"]
458
+ },
459
+ {
460
+ description: "Escape sequence casing in strings and regexes",
461
+ owner: "unicorn/escape-case",
462
+ disabled: ["no-useless-escape"]
463
+ },
464
+ {
465
+ description: "Negated condition style",
466
+ owner: "unicorn/no-negated-condition",
467
+ disabled: ["no-negated-condition"]
468
+ },
469
+ {
470
+ description: "Nested ternary restrictions",
471
+ owner: "unicorn/no-unnecessary-nested-ternary",
472
+ disabled: ["no-nested-ternary", "unicorn/no-nested-ternary"]
473
+ },
474
+ {
475
+ description: "Cyclomatic complexity per function",
476
+ owner: "complexity",
477
+ disabled: ["sonarjs/cognitive-complexity"]
478
+ },
479
+ {
480
+ description: "Unused import detection",
481
+ owner: "@typescript-eslint/no-unused-vars",
482
+ disabled: ["sonarjs/unused-import"]
483
+ },
484
+ {
485
+ description: "Import statement ordering",
486
+ owner: "simple-import-sort/imports",
487
+ disabled: ["import-x/order", "sonarjs/no-alphabetical-sort"]
488
+ }
489
+ ];
490
+ function isRuleEnabled(setting) {
491
+ if (setting === void 0) {
492
+ return false;
493
+ }
494
+ if (setting === "off" || setting === 0) {
495
+ return false;
496
+ }
497
+ if (Array.isArray(setting) && setting[0] === "off") {
498
+ return false;
499
+ }
500
+ return true;
501
+ }
502
+ function mergeConfigRules(configs) {
503
+ const merged = {};
504
+ for (const entry of configs) {
505
+ if (!entry.rules) {
506
+ continue;
507
+ }
508
+ Object.assign(merged, entry.rules);
509
+ }
510
+ return merged;
511
+ }
512
+ function findRuleOwnershipConflicts(rules) {
513
+ const conflicts = [];
514
+ for (const group of RULE_OWNERSHIP_GROUPS) {
515
+ const ownerSetting = rules[group.owner];
516
+ if (!isRuleEnabled(ownerSetting)) {
517
+ continue;
518
+ }
519
+ for (const conflictingRule of group.disabled) {
520
+ if (isRuleEnabled(rules[conflictingRule])) {
521
+ conflicts.push({
522
+ description: group.description,
523
+ owner: group.owner,
524
+ conflictingRule,
525
+ ownerSetting,
526
+ conflictingSetting: rules[conflictingRule]
527
+ });
528
+ }
529
+ }
530
+ }
531
+ return conflicts;
532
+ }
533
+ function assertNoRuleOwnershipConflicts(configs) {
534
+ const conflicts = findRuleOwnershipConflicts(mergeConfigRules(configs));
535
+ if (conflicts.length === 0) {
536
+ return;
537
+ }
538
+ const details = conflicts.map((conflict) => `${conflict.owner} conflicts with ${conflict.conflictingRule} (${conflict.description})`).join("\n");
539
+ throw new Error(`ESLint rule ownership conflicts detected:
540
+ ${details}`);
541
+ }
335
542
 
336
543
  // src/typescript/index.ts
337
544
  import esStylistic from "@stylistic/eslint-plugin";
338
545
  import tsPlugin from "@typescript-eslint/eslint-plugin";
339
546
  var flatConfigs = tsPlugin.configs;
340
- function createTypeScriptOverride(languageOptions) {
547
+ var memberOrderingRule = [
548
+ "warn",
549
+ {
550
+ default: {
551
+ memberTypes: [
552
+ "signature",
553
+ "call-signature",
554
+ "public-static-field",
555
+ "protected-static-field",
556
+ "private-static-field",
557
+ "public-decorated-field",
558
+ "protected-decorated-field",
559
+ "private-decorated-field",
560
+ "public-instance-field",
561
+ "protected-instance-field",
562
+ "private-instance-field",
563
+ "public-abstract-field",
564
+ "protected-abstract-field",
565
+ "public-field",
566
+ "protected-field",
567
+ "private-field",
568
+ "static-field",
569
+ "instance-field",
570
+ "abstract-field",
571
+ "decorated-field",
572
+ "field",
573
+ "public-constructor",
574
+ "protected-constructor",
575
+ "private-constructor",
576
+ "constructor",
577
+ ["public-static-get", "public-static-set"],
578
+ ["protected-static-get", "protected-static-set"],
579
+ ["private-static-get", "private-static-set"],
580
+ ["public-decorated-get", "public-decorated-set"],
581
+ ["protected-decorated-get", "protected-decorated-set"],
582
+ ["private-decorated-get", "private-decorated-set"],
583
+ ["public-instance-get", "public-instance-set"],
584
+ ["protected-instance-get", "protected-instance-set"],
585
+ ["private-instance-get", "private-instance-set"],
586
+ ["public-abstract-get", "public-abstract-set"],
587
+ ["protected-abstract-get", "protected-abstract-set"],
588
+ ["public-get", "public-set"],
589
+ ["protected-get", "protected-set"],
590
+ ["private-get", "private-set"],
591
+ ["static-get", "static-set"],
592
+ ["instance-get", "instance-set"],
593
+ ["abstract-get", "abstract-set"],
594
+ ["decorated-get", "decorated-set"],
595
+ "get",
596
+ "set",
597
+ "public-static-method",
598
+ "protected-static-method",
599
+ "private-static-method",
600
+ "public-decorated-method",
601
+ "protected-decorated-method",
602
+ "private-decorated-method",
603
+ "public-instance-method",
604
+ "protected-instance-method",
605
+ "private-instance-method",
606
+ "public-abstract-method",
607
+ "protected-abstract-method",
608
+ "public-method",
609
+ "protected-method",
610
+ "private-method",
611
+ "static-method",
612
+ "instance-method",
613
+ "abstract-method",
614
+ "decorated-method",
615
+ "method"
616
+ ],
617
+ order: "alphabetically"
618
+ }
619
+ }
620
+ ];
621
+ function createCorrectnessOverride(languageOptions) {
622
+ return {
623
+ files: scriptFiles,
624
+ languageOptions,
625
+ rules: {
626
+ "@typescript-eslint/no-unused-vars": [
627
+ "warn",
628
+ {
629
+ argsIgnorePattern: "^_",
630
+ varsIgnorePattern: "^_",
631
+ ignoreRestSiblings: true
632
+ }
633
+ ],
634
+ "@typescript-eslint/require-await": "off",
635
+ "@typescript-eslint/explicit-module-boundary-types": "off",
636
+ "@typescript-eslint/no-empty-object-type": ["off"],
637
+ "@typescript-eslint/triple-slash-reference": ["off"],
638
+ // Tier 3 opinionated — enabled in opinionatedConfig
639
+ "@typescript-eslint/strict-boolean-expressions": ["off"],
640
+ // Owned by @stylistic/quotes
641
+ "quotes": ["off"],
642
+ // Owned by @stylistic/semi
643
+ "semi": ["off"],
644
+ // Owned by unicorn/prefer-spread
645
+ "prefer-spread": ["off"],
646
+ "require-await": "off"
647
+ }
648
+ };
649
+ }
650
+ function createConsistencyOverride(languageOptions) {
341
651
  return {
342
652
  files: scriptFiles,
343
653
  languageOptions,
344
654
  plugins: { "@stylistic": esStylistic },
345
655
  rules: {
346
656
  ...esStylistic.configs.recommended.rules,
347
- "@typescript-eslint/no-empty-object-type": ["off"],
348
657
  "@typescript-eslint/no-empty-function": "warn",
349
658
  "@stylistic/eol-last": "warn",
350
659
  "@typescript-eslint/explicit-member-accessibility": ["warn", { accessibility: "no-public" }],
351
- "@typescript-eslint/explicit-module-boundary-types": "off",
352
660
  "@stylistic/brace-style": ["warn", "1tbs", { allowSingleLine: true }],
353
661
  "@stylistic/quotes": ["warn", "single", { avoidEscape: true }],
354
662
  "@typescript-eslint/consistent-type-imports": ["warn", { fixStyle: "separate-type-imports", prefer: "type-imports" }],
355
663
  "@stylistic/object-property-newline": ["warn", { allowAllPropertiesOnSameLine: true }],
356
664
  "@stylistic/function-call-argument-newline": ["warn", "consistent"],
357
665
  "@stylistic/function-paren-newline": ["warn", "multiline-arguments"],
358
- "@typescript-eslint/triple-slash-reference": ["off"],
359
666
  "@stylistic/member-delimiter-style": [
360
667
  "error",
361
668
  {
@@ -399,185 +706,331 @@ function createTypeScriptOverride(languageOptions) {
399
706
  message: "Enums are disallowed. Consider using a union of string literals or a `const` object instead."
400
707
  }
401
708
  ],
402
- "@typescript-eslint/member-ordering": [
403
- "warn",
404
- {
405
- default: {
406
- memberTypes: [
407
- "signature",
408
- "call-signature",
409
- "public-static-field",
410
- "protected-static-field",
411
- "private-static-field",
412
- "public-decorated-field",
413
- "protected-decorated-field",
414
- "private-decorated-field",
415
- "public-instance-field",
416
- "protected-instance-field",
417
- "private-instance-field",
418
- "public-abstract-field",
419
- "protected-abstract-field",
420
- "public-field",
421
- "protected-field",
422
- "private-field",
423
- "static-field",
424
- "instance-field",
425
- "abstract-field",
426
- "decorated-field",
427
- "field",
428
- "public-constructor",
429
- "protected-constructor",
430
- "private-constructor",
431
- "constructor",
432
- ["public-static-get", "public-static-set"],
433
- ["protected-static-get", "protected-static-set"],
434
- ["private-static-get", "private-static-set"],
435
- ["public-decorated-get", "public-decorated-set"],
436
- ["protected-decorated-get", "protected-decorated-set"],
437
- ["private-decorated-get", "private-decorated-set"],
438
- ["public-instance-get", "public-instance-set"],
439
- ["protected-instance-get", "protected-instance-set"],
440
- ["private-instance-get", "private-instance-set"],
441
- ["public-abstract-get", "public-abstract-set"],
442
- ["protected-abstract-get", "protected-abstract-set"],
443
- ["public-get", "public-set"],
444
- ["protected-get", "protected-set"],
445
- ["private-get", "private-set"],
446
- ["static-get", "static-set"],
447
- ["instance-get", "instance-set"],
448
- ["abstract-get", "abstract-set"],
449
- ["decorated-get", "decorated-set"],
450
- "get",
451
- "set",
452
- "public-static-method",
453
- "protected-static-method",
454
- "private-static-method",
455
- "public-decorated-method",
456
- "protected-decorated-method",
457
- "private-decorated-method",
458
- "public-instance-method",
459
- "protected-instance-method",
460
- "private-instance-method",
461
- "public-abstract-method",
462
- "protected-abstract-method",
463
- "public-method",
464
- "protected-method",
465
- "private-method",
466
- "static-method",
467
- "instance-method",
468
- "abstract-method",
469
- "decorated-method",
470
- "method"
471
- ],
472
- order: "alphabetically"
473
- }
474
- }
475
- ],
476
- "@typescript-eslint/no-unused-vars": [
477
- "warn",
478
- {
479
- argsIgnorePattern: "^_",
480
- varsIgnorePattern: "^_",
481
- ignoreRestSiblings: true
482
- }
483
- ],
484
- "@typescript-eslint/require-await": "off",
485
- "@typescript-eslint/strict-boolean-expressions": ["off"],
486
- "quotes": ["off"],
487
- "require-await": "off",
488
- "semi": ["warn", "never"]
709
+ "@typescript-eslint/member-ordering": memberOrderingRule
489
710
  }
490
711
  };
491
712
  }
492
- var typescriptConfig = [
713
+ var typescriptDelegationConfig = {
714
+ files: scriptFiles,
715
+ rules: {
716
+ // Owned by unicorn/prefer-spread — stylistic presets may re-enable the core rule
717
+ "prefer-spread": "off",
718
+ // Owned by @stylistic/semi
719
+ "semi": "off",
720
+ // Owned by @stylistic/quotes
721
+ "quotes": "off"
722
+ }
723
+ };
724
+ var typescriptCorrectnessConfig = [
493
725
  ...scopeConfigs(flatConfigs["flat/recommended"], { files: scriptFiles, languageOptions: scriptLanguageOptions }),
726
+ createCorrectnessOverride(scriptLanguageOptions)
727
+ ];
728
+ var typescriptConsistencyConfig = [
494
729
  ...scopeConfigs(flatConfigs["flat/stylistic"], { files: scriptFiles, languageOptions: scriptLanguageOptions }),
495
- createTypeScriptOverride(scriptLanguageOptions)
730
+ createConsistencyOverride(scriptLanguageOptions)
496
731
  ];
497
- var typescriptTypeCheckedConfig = [
732
+ var typescriptTypeCheckedCorrectnessConfig = [
498
733
  ...scopeConfigs(flatConfigs["flat/recommended-type-checked"], { files: scriptFiles, languageOptions: typeCheckedLanguageOptions }),
499
- ...scopeConfigs(flatConfigs["flat/stylistic-type-checked"], { files: scriptFiles, languageOptions: typeCheckedLanguageOptions }),
500
- createTypeScriptOverride(typeCheckedLanguageOptions),
734
+ createCorrectnessOverride(typeCheckedLanguageOptions),
501
735
  {
502
736
  files: scriptFiles,
503
737
  languageOptions: typeCheckedLanguageOptions,
504
738
  rules: { "@typescript-eslint/no-deprecated": "warn" }
505
739
  }
506
740
  ];
741
+ var typescriptTypeCheckedConsistencyConfig = [
742
+ ...scopeConfigs(flatConfigs["flat/stylistic-type-checked"], { files: scriptFiles, languageOptions: typeCheckedLanguageOptions }),
743
+ createConsistencyOverride(typeCheckedLanguageOptions)
744
+ ];
745
+ var typescriptConfig = [
746
+ ...typescriptCorrectnessConfig,
747
+ ...typescriptConsistencyConfig,
748
+ typescriptDelegationConfig
749
+ ];
750
+ var typescriptTypeCheckedConfig = [
751
+ ...typescriptTypeCheckedCorrectnessConfig,
752
+ ...typescriptTypeCheckedConsistencyConfig,
753
+ typescriptDelegationConfig
754
+ ];
507
755
 
508
- // src/sonar/index.ts
509
- import sonarjs from "eslint-plugin-sonarjs";
510
- var sonarConfig = {
511
- plugins: { sonarjs },
512
- ignores,
756
+ // src/tiers/opinionated.ts
757
+ var opinionatedLayerConfig = {
758
+ files: scriptFiles,
513
759
  rules: {
514
- "sonarjs/no-small-switch": ["off"],
515
- "sonarjs/os-command": ["off"],
516
- "sonarjs/no-os-command-from-path": ["off"],
517
- "sonarjs/no-nested-conditional": ["off"],
518
- "sonarjs/todo-tag": ["off"],
519
- "sonarjs/deprecation": ["warn"],
520
- "sonarjs/no-nested-functions": ["off"],
521
- "sonarjs/function-return-type": ["off"],
522
- "sonarjs/pseudo-random": ["off"],
523
- "sonarjs/public-static-readonly": ["warn"],
524
- "sonarjs/post-message": ["off"],
525
- "sonarjs/different-types-comparison": ["off"],
526
- "sonarjs/no-alphabetical-sort": ["warn"],
527
- "sonarjs/no-identical-functions": ["warn"],
528
- "sonarjs/no-empty-test-file": ["off"],
529
- "sonarjs/no-dead-store": ["warn"],
530
- "sonarjs/no-redundant-jump": ["warn"],
531
- "sonarjs/void-use": ["off"],
532
- // handled by ESLint
533
- "sonarjs/cognitive-complexity": ["off"],
534
- "sonarjs/unused-import": ["off"],
535
- // handled by typescript-eslint
536
- "sonarjs/no-unused-vars": ["off"],
537
- "sonarjs/no-commented-code": ["off"],
538
- "sonarjs/prefer-single-boolean-return": ["off"],
539
- "sonarjs/redundant-type-aliases": ["off"]
760
+ "@typescript-eslint/strict-boolean-expressions": "warn",
761
+ "unicorn/filename-case": ["warn", { case: "kebabCase" }],
762
+ "unicorn/no-await-expression-member": "warn",
763
+ "unicorn/number-literal-case": "warn",
764
+ "workspaces/no-relative-imports": "warn",
765
+ "workspaces/require-dependency": "warn"
540
766
  }
541
767
  };
768
+ var strictPromotionRules = {
769
+ "@stylistic/eol-last": "error",
770
+ "@typescript-eslint/no-empty-function": "error",
771
+ "@typescript-eslint/no-deprecated": "error",
772
+ "array-element-newline": "error",
773
+ "import-x/no-absolute-path": "error",
774
+ "import-x/no-cycle": "error",
775
+ "import-x/no-restricted-paths": "error",
776
+ "import-x/no-self-import": "error",
777
+ "import-x/no-useless-path-segments": "error",
778
+ "no-restricted-syntax": "error",
779
+ "simple-import-sort/exports": "error",
780
+ "simple-import-sort/imports": "error",
781
+ "sonarjs/deprecation": "error",
782
+ "sonarjs/no-dead-store": "error",
783
+ "sonarjs/no-identical-functions": "error",
784
+ "sonarjs/no-redundant-jump": "error",
785
+ "sonarjs/public-static-readonly": "error",
786
+ "unicorn/no-useless-undefined": "error",
787
+ ...Object.fromEntries(unicornV66MigrationQueue.map((rule) => [rule, "error"])),
788
+ ...Object.fromEntries([
789
+ "@typescript-eslint/consistent-type-imports",
790
+ "@typescript-eslint/explicit-member-accessibility",
791
+ "@typescript-eslint/member-ordering",
792
+ "@stylistic/brace-style",
793
+ "@stylistic/function-call-argument-newline",
794
+ "@stylistic/function-paren-newline",
795
+ "@stylistic/object-curly-newline",
796
+ "@stylistic/object-property-newline",
797
+ "@stylistic/quotes",
798
+ "@stylistic/max-len",
799
+ "unicorn/filename-case",
800
+ "unicorn/no-await-expression-member",
801
+ "unicorn/number-literal-case",
802
+ "workspaces/no-relative-imports",
803
+ "workspaces/require-dependency",
804
+ "@typescript-eslint/strict-boolean-expressions"
805
+ ].map((rule) => [rule, "error"]))
806
+ };
807
+ var strictLayerConfig = {
808
+ files: scriptFiles,
809
+ rules: strictPromotionRules
810
+ };
811
+
812
+ // src/tiers/index.ts
813
+ function mergeTierConfigs(...parts) {
814
+ return parts.flat();
815
+ }
816
+ var correctnessConfig = mergeTierConfigs(
817
+ markdownConfig,
818
+ correctnessCoreConfig,
819
+ typescriptCorrectnessConfig
820
+ );
821
+ var correctnessTypeCheckedConfig = mergeTierConfigs(
822
+ markdownConfig,
823
+ correctnessCoreConfig,
824
+ typescriptTypeCheckedCorrectnessConfig
825
+ );
826
+ var consistencyConfig = mergeTierConfigs(
827
+ correctnessConfig,
828
+ [consistencyRulesConfig],
829
+ typescriptConsistencyConfig,
830
+ [typescriptDelegationConfig]
831
+ );
832
+ var consistencyTypeCheckedConfig = mergeTierConfigs(
833
+ correctnessTypeCheckedConfig,
834
+ [consistencyRulesConfig],
835
+ typescriptTypeCheckedConsistencyConfig,
836
+ [typescriptDelegationConfig]
837
+ );
838
+ var bestPracticesConfig = mergeTierConfigs(
839
+ consistencyConfig,
840
+ bestPracticesCoreConfig,
841
+ importConfig
842
+ );
843
+ var bestPracticesTypeCheckedConfig = mergeTierConfigs(
844
+ consistencyTypeCheckedConfig,
845
+ bestPracticesCoreConfig,
846
+ importConfig
847
+ );
848
+ var opinionatedConfig = mergeTierConfigs(
849
+ bestPracticesConfig,
850
+ [opinionatedLayerConfig]
851
+ );
852
+ var opinionatedTypeCheckedConfig = mergeTierConfigs(
853
+ bestPracticesTypeCheckedConfig,
854
+ [opinionatedLayerConfig]
855
+ );
856
+ var strictConfig = mergeTierConfigs(
857
+ opinionatedConfig,
858
+ [sonarConfig, strictLayerConfig]
859
+ );
860
+ var strictTypeCheckedConfig = mergeTierConfigs(
861
+ opinionatedTypeCheckedConfig,
862
+ [sonarConfig, strictLayerConfig]
863
+ );
864
+ var recommendedConfig = bestPracticesConfig;
865
+ var recommendedTypeCheckedConfig = bestPracticesTypeCheckedConfig;
866
+ var config = bestPracticesTypeCheckedConfig;
867
+
868
+ // src/tiers/plugin-rules.ts
869
+ import js2 from "@eslint/js";
870
+ import json2 from "@eslint/json";
871
+ import markdown2 from "@eslint/markdown";
872
+ import esStylistic2 from "@stylistic/eslint-plugin";
873
+ import tsPlugin2 from "@typescript-eslint/eslint-plugin";
874
+ import importPlugin2 from "eslint-plugin-import-x";
875
+ import simpleImportSort2 from "eslint-plugin-simple-import-sort";
876
+ import sonarjs2 from "eslint-plugin-sonarjs";
877
+ import unicornPlugin2 from "eslint-plugin-unicorn";
878
+ import workspacesPlugin2 from "eslint-plugin-workspaces";
879
+ var compareStrings = (left, right) => left.localeCompare(right);
880
+ function sortedRuleNames(rules) {
881
+ if (!rules) {
882
+ return [];
883
+ }
884
+ return Object.keys(rules).toSorted(compareStrings);
885
+ }
886
+ function sortedRuleNamesFromConfigs(configs) {
887
+ if (!configs) {
888
+ return [];
889
+ }
890
+ const merged = {};
891
+ for (const entry of configs) {
892
+ if (entry.rules) {
893
+ Object.assign(merged, entry.rules);
894
+ }
895
+ }
896
+ return sortedRuleNames(merged);
897
+ }
898
+ function pluginRuleNames(plugin) {
899
+ if (!plugin.rules) {
900
+ return [];
901
+ }
902
+ const prefix = typeof plugin.meta?.name === "string" ? plugin.meta.name.replace(/^eslint-plugin-/, "").replace(/^@eslint\//, "") : "unknown";
903
+ return Object.keys(plugin.rules).toSorted(compareStrings).map((ruleName) => `${prefix}/${ruleName}`);
904
+ }
905
+ function collectPluginRuleSnapshots() {
906
+ const unicornRecommended = unicornPlugin2.configs["flat/recommended"];
907
+ const importRecommended = importPlugin2.flatConfigs.recommended;
908
+ const flatConfigs2 = tsPlugin2.configs;
909
+ const workspacesRecommended = workspacesPlugin2.configs.recommended;
910
+ return [
911
+ {
912
+ plugin: "@eslint/js",
913
+ rules: sortedRuleNames(js2.configs.recommended.rules),
914
+ source: "configs.recommended"
915
+ },
916
+ {
917
+ plugin: "@eslint/json",
918
+ rules: pluginRuleNames(json2),
919
+ source: "plugin.rules"
920
+ },
921
+ {
922
+ plugin: "@eslint/markdown",
923
+ rules: sortedRuleNames(
924
+ markdown2.configs.recommended[0]?.rules
925
+ ),
926
+ source: "configs.recommended"
927
+ },
928
+ {
929
+ plugin: "@stylistic/eslint-plugin",
930
+ rules: sortedRuleNames(esStylistic2.configs.recommended.rules),
931
+ source: "configs.recommended"
932
+ },
933
+ {
934
+ plugin: "@typescript-eslint/eslint-plugin",
935
+ rules: sortedRuleNamesFromConfigs(flatConfigs2["flat/recommended-type-checked"]),
936
+ source: "configs.flat/recommended-type-checked"
937
+ },
938
+ {
939
+ plugin: "@typescript-eslint/eslint-plugin",
940
+ rules: sortedRuleNamesFromConfigs(flatConfigs2["flat/stylistic-type-checked"]),
941
+ source: "configs.flat/stylistic-type-checked"
942
+ },
943
+ {
944
+ plugin: "eslint-plugin-import-x",
945
+ rules: sortedRuleNames(importRecommended.rules),
946
+ source: "flatConfigs.recommended"
947
+ },
948
+ {
949
+ plugin: "eslint-plugin-import-x",
950
+ rules: sortedRuleNames(importPlugin2.flatConfigs.typescript.rules),
951
+ source: "flatConfigs.typescript"
952
+ },
953
+ {
954
+ plugin: "eslint-plugin-simple-import-sort",
955
+ rules: pluginRuleNames(simpleImportSort2),
956
+ source: "plugin.rules"
957
+ },
958
+ {
959
+ plugin: "eslint-plugin-sonarjs",
960
+ rules: pluginRuleNames(sonarjs2),
961
+ source: "plugin.rules"
962
+ },
963
+ {
964
+ plugin: "eslint-plugin-unicorn",
965
+ rules: sortedRuleNames(unicornRecommended?.rules),
966
+ source: "configs.flat/recommended"
967
+ },
968
+ {
969
+ plugin: "eslint-plugin-workspaces",
970
+ rules: sortedRuleNames(workspacesRecommended.rules),
971
+ source: "configs.recommended"
972
+ }
973
+ ];
974
+ }
975
+ function serializePluginRuleSnapshots(snapshots) {
976
+ return `${JSON.stringify(snapshots, null, 2)}
977
+ `;
978
+ }
542
979
 
543
980
  // src/index.ts
544
- var recommendedConfig = [
545
- ...markdownConfig,
546
- ...coreConfig,
547
- ...typescriptConfig,
548
- ...importConfig
549
- ];
550
- var recommendedTypeCheckedConfig = [
551
- ...markdownConfig,
552
- ...coreConfig,
553
- ...typescriptTypeCheckedConfig,
554
- ...importConfig
555
- ];
556
981
  var docsConfig = [
557
982
  ...markdownConfig,
558
983
  jsonConfig,
559
984
  jsoncConfig,
560
985
  json5Config
561
986
  ];
562
- var config = recommendedTypeCheckedConfig;
563
987
  export {
988
+ RULE_OWNERSHIP_GROUPS,
989
+ assertNoRuleOwnershipConflicts,
990
+ bestPracticesConfig,
991
+ bestPracticesCoreConfig,
992
+ bestPracticesTypeCheckedConfig,
993
+ collectPluginRuleSnapshots,
564
994
  config,
995
+ consistencyConfig,
996
+ consistencyRulesConfig,
997
+ consistencyTypeCheckedConfig,
565
998
  coreConfig,
999
+ correctnessConfig,
1000
+ correctnessCoreConfig,
1001
+ correctnessRulesConfig,
1002
+ correctnessTypeCheckedConfig,
566
1003
  docsConfig,
1004
+ findRuleOwnershipConflicts,
567
1005
  ignores,
568
1006
  importConfig,
569
1007
  json5Config,
570
1008
  jsonConfig,
571
1009
  jsoncConfig,
572
1010
  markdownConfig,
1011
+ mergeConfigRules,
1012
+ opinionatedConfig,
1013
+ opinionatedLayerConfig,
1014
+ opinionatedTypeCheckedConfig,
573
1015
  recommendedConfig,
574
1016
  recommendedTypeCheckedConfig,
575
1017
  rulesConfig,
1018
+ serializePluginRuleSnapshots,
576
1019
  sonarConfig,
577
1020
  srcImportsConfig,
1021
+ strictConfig,
1022
+ strictLayerConfig,
1023
+ strictPromotionRules,
1024
+ strictTypeCheckedConfig,
578
1025
  typescriptConfig,
1026
+ typescriptConsistencyConfig,
1027
+ typescriptCorrectnessConfig,
1028
+ typescriptDelegationConfig,
579
1029
  typescriptTypeCheckedConfig,
1030
+ typescriptTypeCheckedConsistencyConfig,
1031
+ typescriptTypeCheckedCorrectnessConfig,
580
1032
  unicornConfig,
1033
+ unicornV66MigrationQueue,
581
1034
  unicornV66NewRules,
582
1035
  workspacesConfig
583
1036
  };