@ttsc/lint 0.18.4 → 0.19.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 (188) hide show
  1. package/README.md +125 -43
  2. package/go.mod +5 -4
  3. package/internal/rulecode/rulecode.go +88 -0
  4. package/lib/index.d.ts +10 -1
  5. package/lib/index.js +45 -17
  6. package/lib/index.js.map +1 -1
  7. package/lib/structures/ITtscLintConfig.d.ts +3 -0
  8. package/lib/structures/TtscLintRuleSetting.d.ts +3 -2
  9. package/lib/structures/format/ITtscLintFormat.d.ts +3 -2
  10. package/lib/structures/format/ITtscLintFormatSortImports.d.ts +20 -4
  11. package/lib/structures/rules/ITtscLintBoundariesRuleOptions.d.ts +80 -8
  12. package/lib/structures/rules/ITtscLintBoundariesRules.d.ts +6 -8
  13. package/lib/structures/rules/ITtscLintContributorRules.d.ts +18 -2
  14. package/lib/structures/rules/ITtscLintCoreRuleOptions.d.ts +347 -0
  15. package/lib/structures/rules/ITtscLintCoreRuleOptions.js +3 -0
  16. package/lib/structures/rules/ITtscLintCoreRuleOptions.js.map +1 -0
  17. package/lib/structures/rules/ITtscLintCoreRules.d.ts +101 -67
  18. package/lib/structures/rules/ITtscLintRegexpRules.d.ts +7 -2
  19. package/lib/structures/rules/ITtscLintRuleOptionsMap.d.ts +53 -7
  20. package/lib/structures/rules/ITtscLintRules.d.ts +6 -2
  21. package/lib/structures/rules/ITtscLintSolidRules.d.ts +0 -8
  22. package/lib/structures/rules/ITtscLintTypeScriptRuleOptions.d.ts +206 -0
  23. package/lib/structures/rules/ITtscLintTypeScriptRuleOptions.js +8 -0
  24. package/lib/structures/rules/ITtscLintTypeScriptRuleOptions.js.map +1 -0
  25. package/lib/structures/rules/ITtscLintTypeScriptRules.d.ts +55 -42
  26. package/lib/structures/rules/ITtscLintUnicornRuleOptions.d.ts +276 -0
  27. package/lib/structures/rules/ITtscLintUnicornRuleOptions.js +3 -0
  28. package/lib/structures/rules/ITtscLintUnicornRuleOptions.js.map +1 -0
  29. package/lib/structures/rules/ITtscLintUnicornRules.d.ts +44 -36
  30. package/lib/structures/rules/index.d.ts +3 -0
  31. package/lib/structures/rules/index.js +3 -0
  32. package/lib/structures/rules/index.js.map +1 -1
  33. package/linthost/ast_helpers.go +521 -23
  34. package/linthost/ast_selector_matcher.go +1628 -0
  35. package/linthost/ast_selector_parser.go +628 -0
  36. package/linthost/comment_scan.go +154 -0
  37. package/linthost/compile.go +129 -79
  38. package/linthost/config.go +352 -88
  39. package/linthost/config_format.go +15 -1
  40. package/linthost/contrib_adapter.go +47 -8
  41. package/linthost/declaration_rules.go +12 -11
  42. package/linthost/directives.go +9 -67
  43. package/linthost/dispatch.go +37 -3
  44. package/linthost/engine.go +368 -53
  45. package/linthost/escape_string.go +77 -0
  46. package/linthost/fix.go +133 -23
  47. package/linthost/flags_gen.go +18 -17
  48. package/linthost/format.go +73 -167
  49. package/linthost/format_editor_settings.go +134 -26
  50. package/linthost/grapheme_tables_gen.go +1920 -0
  51. package/linthost/host.go +159 -61
  52. package/linthost/literal_escape_scan.go +117 -0
  53. package/linthost/lsp.go +545 -98
  54. package/linthost/numeric_literal_precision.go +228 -0
  55. package/linthost/polyfill_browserslist.go +1439 -0
  56. package/linthost/polyfill_browserslist_config.go +603 -0
  57. package/linthost/polyfill_corejs.go +750 -0
  58. package/linthost/polyfill_data.go +113 -0
  59. package/linthost/polyfill_data_gen.json +39868 -0
  60. package/linthost/print_nodes_array.go +7 -1
  61. package/linthost/print_nodes_object.go +7 -1
  62. package/linthost/project_engine.go +231 -0
  63. package/linthost/project_rules.go +78 -0
  64. package/linthost/regex_clean.go +191 -0
  65. package/linthost/regex_tree.go +1544 -0
  66. package/linthost/regex_tree_optimizer.go +1685 -0
  67. package/linthost/regexp_cache.go +44 -0
  68. package/linthost/rule_codes.go +105 -0
  69. package/linthost/rule_codes.json +745 -0
  70. package/linthost/rules_ban_ts_comment.go +312 -0
  71. package/linthost/rules_boundaries.go +128 -43
  72. package/linthost/rules_boundaries_dependencies.go +1013 -0
  73. package/linthost/rules_core_extra.go +62 -92
  74. package/linthost/rules_cypress.go +1 -1
  75. package/linthost/rules_default_case.go +87 -11
  76. package/linthost/rules_dupes.go +38 -13
  77. package/linthost/rules_empty.go +188 -20
  78. package/linthost/rules_escape.go +62 -48
  79. package/linthost/rules_format_arrow_parens.go +19 -5
  80. package/linthost/rules_format_bracket_spacing.go +1 -1
  81. package/linthost/rules_format_clause_join.go +1 -1
  82. package/linthost/rules_format_declaration_header.go +31 -19
  83. package/linthost/rules_format_indent.go +1 -1
  84. package/linthost/rules_format_jsdoc.go +1 -1
  85. package/linthost/rules_format_orphan_semi.go +1 -1
  86. package/linthost/rules_format_parameter_properties.go +17 -7
  87. package/linthost/rules_format_print_width.go +1 -1
  88. package/linthost/rules_format_quote_props.go +1 -1
  89. package/linthost/rules_format_quotes.go +1 -1
  90. package/linthost/rules_format_semi.go +106 -79
  91. package/linthost/rules_format_sort_imports.go +79 -45
  92. package/linthost/rules_format_statement_split.go +1 -1
  93. package/linthost/rules_format_ternary_nullish_parens.go +1 -1
  94. package/linthost/rules_format_trailing_comma.go +64 -1
  95. package/linthost/rules_format_whitespace.go +1 -1
  96. package/linthost/rules_functional.go +21 -22
  97. package/linthost/rules_gap.go +80 -3
  98. package/linthost/rules_grouped_accessor_pairs.go +84 -25
  99. package/linthost/rules_guard_for_in.go +64 -147
  100. package/linthost/rules_jsx_a11y.go +232 -22
  101. package/linthost/rules_logic.go +84 -38
  102. package/linthost/rules_nextjs.go +105 -16
  103. package/linthost/rules_no_class_assign.go +70 -0
  104. package/linthost/rules_no_duplicate_imports.go +266 -0
  105. package/linthost/rules_no_else_return.go +156 -38
  106. package/linthost/rules_no_extend_native.go +113 -17
  107. package/linthost/rules_no_fallthrough.go +1013 -0
  108. package/linthost/rules_no_func_assign.go +70 -0
  109. package/linthost/rules_no_import_assign.go +278 -86
  110. package/linthost/rules_no_inner_declarations.go +186 -0
  111. package/linthost/rules_no_loop_func.go +438 -53
  112. package/linthost/rules_no_mixed_operators.go +208 -52
  113. package/linthost/rules_no_param_reassign.go +376 -61
  114. package/linthost/rules_no_promise_executor_return.go +156 -0
  115. package/linthost/rules_no_restricted_imports.go +1013 -57
  116. package/linthost/rules_no_restricted_syntax.go +190 -26
  117. package/linthost/rules_no_useless_constructor.go +6 -36
  118. package/linthost/rules_problems.go +154 -311
  119. package/linthost/rules_promise.go +2578 -109
  120. package/linthost/rules_react_extras.go +71 -45
  121. package/linthost/rules_react_hooks.go +18 -2
  122. package/linthost/rules_react_perf.go +1 -0
  123. package/linthost/rules_react_refresh.go +1 -1
  124. package/linthost/rules_regexp.go +230 -14
  125. package/linthost/rules_security.go +45 -19
  126. package/linthost/rules_self.go +21 -1
  127. package/linthost/rules_solid.go +13 -7
  128. package/linthost/rules_storybook.go +1 -1
  129. package/linthost/rules_suggestions.go +490 -84
  130. package/linthost/rules_testing_library.go +12 -1
  131. package/linthost/rules_ts.go +227 -54
  132. package/linthost/rules_ts_async.go +0 -131
  133. package/linthost/rules_ts_no_base_to_string.go +3 -4
  134. package/linthost/rules_ts_no_misused_promises.go +817 -0
  135. package/linthost/rules_ts_no_restricted_types.go +320 -34
  136. package/linthost/rules_ts_no_unnecessary_qualifier.go +132 -55
  137. package/linthost/rules_ts_no_unsafe_assignment.go +608 -60
  138. package/linthost/rules_ts_require_array_sort_compare.go +5 -5
  139. package/linthost/rules_ts_switch_exhaustiveness_check.go +556 -86
  140. package/linthost/rules_unicorn_better_regex.go +224 -16
  141. package/linthost/rules_unicorn_consistent_destructuring.go +1002 -7
  142. package/linthost/rules_unicorn_consistent_existence_index_check.go +208 -29
  143. package/linthost/rules_unicorn_consistent_function_scoping.go +1041 -8
  144. package/linthost/rules_unicorn_consistent_template_literal_escape.go +178 -7
  145. package/linthost/rules_unicorn_escape_case.go +30 -19
  146. package/linthost/rules_unicorn_filename_case.go +763 -16
  147. package/linthost/rules_unicorn_import_style.go +783 -17
  148. package/linthost/rules_unicorn_isolated_functions.go +934 -14
  149. package/linthost/rules_unicorn_no_hex_escape.go +26 -11
  150. package/linthost/rules_unicorn_no_typeof_undefined.go +234 -25
  151. package/linthost/rules_unicorn_no_unnecessary_polyfills.go +376 -21
  152. package/linthost/rules_unicorn_no_unused_properties.go +756 -19
  153. package/linthost/rules_unicorn_number_literal_case.go +58 -39
  154. package/linthost/rules_unicorn_prefer_at.go +7 -3
  155. package/linthost/rules_unicorn_prefer_number_properties.go +381 -48
  156. package/linthost/rules_unicorn_prefer_optional_catch_binding.go +24 -24
  157. package/linthost/rules_unicorn_prefer_simple_condition_first.go +597 -19
  158. package/linthost/rules_unicorn_prefer_string_raw.go +147 -16
  159. package/linthost/rules_unicorn_prevent_abbreviations.go +1963 -95
  160. package/linthost/rules_unicorn_string_content.go +611 -15
  161. package/linthost/rules_unicorn_switch_case_break_position.go +172 -15
  162. package/linthost/rules_unicorn_template_indent.go +923 -18
  163. package/linthost/rules_unicorn_text_encoding_identifier_case.go +202 -42
  164. package/linthost/rules_unicorn_throw_new_error.go +218 -26
  165. package/linthost/rules_var.go +829 -142
  166. package/linthost/string_length.go +222 -0
  167. package/package.json +4 -3
  168. package/rule/project.go +206 -0
  169. package/rule/rule.go +58 -1
  170. package/src/index.ts +58 -17
  171. package/src/structures/ITtscLintConfig.ts +3 -0
  172. package/src/structures/TtscLintRuleSetting.ts +3 -2
  173. package/src/structures/format/ITtscLintFormat.ts +3 -2
  174. package/src/structures/format/ITtscLintFormatSortImports.ts +21 -4
  175. package/src/structures/rules/ITtscLintBoundariesRuleOptions.ts +122 -8
  176. package/src/structures/rules/ITtscLintBoundariesRules.ts +6 -8
  177. package/src/structures/rules/ITtscLintContributorRules.ts +18 -2
  178. package/src/structures/rules/ITtscLintCoreRuleOptions.ts +465 -0
  179. package/src/structures/rules/ITtscLintCoreRules.ts +122 -67
  180. package/src/structures/rules/ITtscLintRegexpRules.ts +7 -2
  181. package/src/structures/rules/ITtscLintRuleOptionsMap.ts +88 -7
  182. package/src/structures/rules/ITtscLintRules.ts +7 -2
  183. package/src/structures/rules/ITtscLintSolidRules.ts +0 -9
  184. package/src/structures/rules/ITtscLintTypeScriptRuleOptions.ts +248 -0
  185. package/src/structures/rules/ITtscLintTypeScriptRules.ts +64 -42
  186. package/src/structures/rules/ITtscLintUnicornRuleOptions.ts +350 -0
  187. package/src/structures/rules/ITtscLintUnicornRules.ts +60 -36
  188. package/src/structures/rules/index.ts +3 -0
@@ -1,4 +1,26 @@
1
- import type { TtscLintRuleSetting } from "../TtscLintRuleSetting";
1
+ import type {
2
+ TtscLintRuleOptionsSetting,
3
+ TtscLintRuleSetting,
4
+ } from "../TtscLintRuleSetting";
5
+ import type {
6
+ ITtscLintCoreDefaultCaseRuleOptions,
7
+ ITtscLintCoreNoDuplicateImportsRuleOptions,
8
+ ITtscLintCoreNoElseReturnRuleOptions,
9
+ ITtscLintCoreNoEmptyFunctionRuleOptions,
10
+ ITtscLintCoreNoEmptyRuleOptions,
11
+ ITtscLintCoreNoExtendNativeRuleOptions,
12
+ ITtscLintCoreNoMixedOperatorsRuleOptions,
13
+ ITtscLintCoreNoParamReassignRuleOptions,
14
+ ITtscLintCoreNoPromiseExecutorReturnRuleOptions,
15
+ ITtscLintCoreNoUnusedExpressionsRuleOptions,
16
+ ITtscLintCorePreferConstRuleOptions,
17
+ ITtscLintNoFallthroughRuleOptions,
18
+ TtscLintCoreGroupedAccessorPairsRuleSetting,
19
+ TtscLintCoreNoInnerDeclarationsRuleSetting,
20
+ TtscLintCoreNoRestrictedImportsRuleSetting,
21
+ TtscLintCoreNoRestrictedSyntaxRuleSetting,
22
+ TtscLintCoreNoReturnAssignRuleSetting,
23
+ } from "./ITtscLintCoreRuleOptions";
2
24
 
3
25
  /**
4
26
  * Generic ESLint-compatible rules that apply to both JavaScript and TypeScript
@@ -37,7 +59,7 @@ export interface ITtscLintCoreRules {
37
59
  *
38
60
  * @reference https://eslint.org/docs/latest/rules/default-case
39
61
  */
40
- "default-case"?: TtscLintRuleSetting;
62
+ "default-case"?: TtscLintRuleOptionsSetting<ITtscLintCoreDefaultCaseRuleOptions>;
41
63
 
42
64
  /**
43
65
  * Require the `default` clause of a `switch` statement to appear after every
@@ -135,7 +157,7 @@ export interface ITtscLintCoreRules {
135
157
  *
136
158
  * @reference https://eslint.org/docs/latest/rules/grouped-accessor-pairs
137
159
  */
138
- "grouped-accessor-pairs"?: TtscLintRuleSetting;
160
+ "grouped-accessor-pairs"?: TtscLintCoreGroupedAccessorPairsRuleSetting;
139
161
 
140
162
  /**
141
163
  * Require the body of every `for (key in obj)` loop to begin with a guard
@@ -301,10 +323,13 @@ export interface ITtscLintCoreRules {
301
323
  "no-case-declarations"?: TtscLintRuleSetting;
302
324
 
303
325
  /**
304
- * Reject reassigning a class binding (`class C {}; C = ...`).
326
+ * Reject every write to a binding introduced by a class declaration or named
327
+ * class expression.
305
328
  *
306
- * The declaration name is effectively final; overwriting it silently leaves
307
- * other call sites pointing at the original class.
329
+ * Binding identity is resolved lexically, so same-spelled parameter, catch,
330
+ * block, and sibling bindings remain independent. Direct and compound
331
+ * assignments, updates, destructuring targets, and `for-in`/`for-of` targets
332
+ * are all covered.
308
333
  *
309
334
  * @reference https://eslint.org/docs/latest/rules/no-class-assign
310
335
  */
@@ -422,8 +447,8 @@ export interface ITtscLintCoreRules {
422
447
  "no-dupe-class-members"?: TtscLintRuleSetting;
423
448
 
424
449
  /**
425
- * Reject `if (a) {} else if (a) {}` the second branch is unreachable
426
- * because the first condition already handled it.
450
+ * Reject an `else if` branch when duplicate or structurally covered
451
+ * conditions earlier in the same chain make it unreachable.
427
452
  *
428
453
  * @reference https://eslint.org/docs/latest/rules/no-dupe-else-if
429
454
  */
@@ -446,30 +471,33 @@ export interface ITtscLintCoreRules {
446
471
  "no-duplicate-case"?: TtscLintRuleSetting;
447
472
 
448
473
  /**
449
- * Reject two import declarations that resolve to the same module specifier.
450
- * The runtime sees one module load either way; the duplicated declaration is
451
- * purely noise at the head of the file and obscures the dependency graph.
474
+ * Reject an import declaration whose module specifier already appeared above
475
+ * when the two declarations could be merged into one legal declaration.
476
+ * Same-module pairs TypeScript cannot consolidate named next to namespace
477
+ * bindings, or a type-only default next to type-only named bindings — are not
478
+ * duplicates. `allowSeparateTypeImports` additionally keeps clause-level
479
+ * `import type` declarations apart from value imports, and `includeExports`
480
+ * folds `export … from` declarations into the same analysis.
452
481
  *
453
482
  * @reference https://eslint.org/docs/latest/rules/no-duplicate-imports
454
483
  */
455
- "no-duplicate-imports"?: TtscLintRuleSetting;
484
+ "no-duplicate-imports"?: TtscLintRuleOptionsSetting<ITtscLintCoreNoDuplicateImportsRuleOptions>;
456
485
 
457
486
  /**
458
- * Reject an `else` block whose preceding `if` branch already terminates
459
- * control flow with `return`, `throw`, `break`, or `continue` — flatten the
460
- * body into the surrounding scope.
487
+ * Reject an `else` block whose preceding `if` branch returns on every path;
488
+ * flatten the body into the surrounding scope.
461
489
  *
462
490
  * @reference https://eslint.org/docs/latest/rules/no-else-return
463
491
  */
464
- "no-else-return"?: TtscLintRuleSetting;
492
+ "no-else-return"?: TtscLintRuleOptionsSetting<ITtscLintCoreNoElseReturnRuleOptions>;
465
493
 
466
494
  /**
467
- * Reject empty blocks (`if (x) {}`, `while (x) {}`, `try {} catch (e) {}`
468
- * etc.) that almost always indicate forgotten code.
495
+ * Reject empty, uncommented blocks and switches. Set `allowEmptyCatch` to
496
+ * accept an uncommented empty catch clause; its default is `false`.
469
497
  *
470
498
  * @reference https://eslint.org/docs/latest/rules/no-empty
471
499
  */
472
- "no-empty"?: TtscLintRuleSetting;
500
+ "no-empty"?: TtscLintRuleOptionsSetting<ITtscLintCoreNoEmptyRuleOptions>;
473
501
 
474
502
  /**
475
503
  * Reject empty regex character classes (`[]`).
@@ -482,14 +510,13 @@ export interface ITtscLintCoreRules {
482
510
  "no-empty-character-class"?: TtscLintRuleSetting;
483
511
 
484
512
  /**
485
- * Reject empty function and method bodies (`function f() {}`, `() => {}`).
486
- *
487
- * Use `() => undefined` or a leading TODO comment when the empty body is
488
- * intentional.
513
+ * Reject empty, uncommented function bodies. The `allow` option accepts
514
+ * canonical function, method, accessor, constructor, async, generator,
515
+ * decorator, and override categories.
489
516
  *
490
517
  * @reference https://eslint.org/docs/latest/rules/no-empty-function
491
518
  */
492
- "no-empty-function"?: TtscLintRuleSetting;
519
+ "no-empty-function"?: TtscLintRuleOptionsSetting<ITtscLintCoreNoEmptyFunctionRuleOptions>;
493
520
 
494
521
  /**
495
522
  * Reject empty named import or export clauses — `import {} from "x"`, `import
@@ -550,17 +577,18 @@ export interface ITtscLintCoreRules {
550
577
  "no-ex-assign"?: TtscLintRuleSetting;
551
578
 
552
579
  /**
553
- * Reject assignments to a built-in prototype such as `Array.prototype.foo =
554
- * bar`. Only `<Builtin>.prototype.<key> = …` is flagged; assigning to
555
- * `Object.foo = …` (a static property) is left alone.
580
+ * Reject extending a built-in prototype through direct assignment or
581
+ * `Object.defineProperty` / `Object.defineProperties`. Assigning to a static
582
+ * property such as `Object.foo` is left alone.
556
583
  *
557
584
  * @reference https://eslint.org/docs/latest/rules/no-extend-native
558
585
  */
559
- "no-extend-native"?: TtscLintRuleSetting;
586
+ "no-extend-native"?: TtscLintRuleOptionsSetting<ITtscLintCoreNoExtendNativeRuleOptions>;
560
587
 
561
588
  /**
562
- * Reject unnecessary `Function.prototype.bind()` calls for example, binding
563
- * without arguments or binding an arrow function (which ignores `this`).
589
+ * Reject `.bind(thisArg)` on an arrow function or on a regular function whose
590
+ * own scope never reads `this`. Calls that bind later arguments are preserved
591
+ * as partial applications.
564
592
  *
565
593
  * @reference https://eslint.org/docs/latest/rules/no-extra-bind
566
594
  */
@@ -575,18 +603,27 @@ export interface ITtscLintCoreRules {
575
603
  "no-extra-boolean-cast"?: TtscLintRuleSetting;
576
604
 
577
605
  /**
578
- * Reject `switch` case fall-through unless preceded by an explicit `// falls
579
- * through` comment.
606
+ * Reject `switch` cases that can reach the next `case` / `default` label
607
+ * without an intentional-fallthrough comment (`// falls through` by
608
+ * default).
609
+ *
610
+ * Reachability follows statement completion: a case whose every path ends in
611
+ * `break`, `continue`, `return`, or `throw` (composed through blocks,
612
+ * `if/else`, loops, labeled statements, and `try/catch/finally`) does not
613
+ * fall through, while a `return` inside a nested function never terminates
614
+ * the case. Options: {@link ITtscLintNoFallthroughRuleOptions}.
580
615
  *
581
616
  * @reference https://eslint.org/docs/latest/rules/no-fallthrough
582
617
  */
583
- "no-fallthrough"?: TtscLintRuleSetting;
618
+ "no-fallthrough"?: TtscLintRuleOptionsSetting<ITtscLintNoFallthroughRuleOptions>;
584
619
 
585
620
  /**
586
- * Reject reassignment of function declarations (`function f() {}; f = 0;`).
621
+ * Reject writes to bindings introduced by function declarations and named
622
+ * function expressions. Lexical binding identity keeps same-spelled shadows
623
+ * independent across parameters, blocks, catches, and sibling scopes.
587
624
  *
588
- * The hoisted binding looks final to most readers; overwriting it makes the
589
- * original implementation unreachable from other references.
625
+ * Direct and compound assignment, updates, destructuring, and for-in/of
626
+ * targets are all modifying references to the function binding.
590
627
  *
591
628
  * @reference https://eslint.org/docs/latest/rules/no-func-assign
592
629
  */
@@ -615,12 +652,13 @@ export interface ITtscLintCoreRules {
615
652
  "no-import-assign"?: TtscLintRuleSetting;
616
653
 
617
654
  /**
618
- * Reject `function` and `var` declarations nested in non-function blocks
619
- * (loops, `if`, etc.) they hoist in surprising ways.
655
+ * Reject function declarations nested in sloppy blocks. The `"both"` mode
656
+ * also checks `var`; strict ES2015 block-scoped functions are allowed by
657
+ * default and can be disabled through `blockScopedFunctions`.
620
658
  *
621
659
  * @reference https://eslint.org/docs/latest/rules/no-inner-declarations
622
660
  */
623
- "no-inner-declarations"?: TtscLintRuleSetting;
661
+ "no-inner-declarations"?: TtscLintCoreNoInnerDeclarationsRuleSetting;
624
662
 
625
663
  /**
626
664
  * Reject `this` references outside any function-like, class method, or
@@ -679,10 +717,9 @@ export interface ITtscLintCoreRules {
679
717
  "no-lonely-if"?: TtscLintRuleSetting;
680
718
 
681
719
  /**
682
- * Reject function declarations defined inside the body of a loop. Each
683
- * iteration of the loop allocates a fresh function whose closure captures the
684
- * surrounding `let`/`var` binding — a class of bugs where every captured
685
- * function reads the iteration's final value instead of its own.
720
+ * Reject loop-created closures that capture bindings which can change between
721
+ * iterations. Constants, per-iteration `let` bindings, and unreferenced
722
+ * synchronous IIFEs are safe.
686
723
  *
687
724
  * @reference https://eslint.org/docs/latest/rules/no-loop-func
688
725
  */
@@ -719,14 +756,14 @@ export interface ITtscLintCoreRules {
719
756
  * The famous case is `a && b || c`: readers expect left-to-right grouping but
720
757
  * the parser sees `(a && b) || c` because `&&` binds tighter than `||`.
721
758
  *
722
- * The conservative baseline only flags the highest-confusion mixes — logical
723
- * mixed with a different logical (`&&` next to `||` / `??`), and bitwise
724
- * (`&`, `|`, `^`) next to a comparison or logical. Wrapping the inner
725
- * sub-expression in parens suppresses the report.
759
+ * The default groups cover arithmetic, bitwise, comparison, logical, and
760
+ * relational operators, matching ESLint. A custom `groups` option replaces
761
+ * that grouping, while `allowSamePrecedence` controls equal-precedence mixes.
762
+ * Wrapping the inner sub-expression in parens suppresses the report.
726
763
  *
727
764
  * @reference https://eslint.org/docs/latest/rules/no-mixed-operators
728
765
  */
729
- "no-mixed-operators"?: TtscLintRuleSetting;
766
+ "no-mixed-operators"?: TtscLintRuleOptionsSetting<ITtscLintCoreNoMixedOperatorsRuleOptions>;
730
767
 
731
768
  /**
732
769
  * Reject chained assignment such as `a = b = 0`, which obscures intent and
@@ -832,13 +869,14 @@ export interface ITtscLintCoreRules {
832
869
  "no-octal-escape"?: TtscLintRuleSetting;
833
870
 
834
871
  /**
835
- * Reject reassigning a function parameter inside the body of the function it
836
- * belongs to. The parameter name stops pointing at the caller's argument
837
- * after the write. Property mutations (`param.foo = …`) are not flagged.
872
+ * Reject writes to a function parameter's binding, including through nested
873
+ * closures and destructuring assignment targets. `props: true` also reports
874
+ * property writes, with the official exact-name and regular-expression ignore
875
+ * lists.
838
876
  *
839
877
  * @reference https://eslint.org/docs/latest/rules/no-param-reassign
840
878
  */
841
- "no-param-reassign"?: TtscLintRuleSetting;
879
+ "no-param-reassign"?: TtscLintRuleOptionsSetting<ITtscLintCoreNoParamReassignRuleOptions>;
842
880
 
843
881
  /**
844
882
  * Reject `++` and `--` operators.
@@ -851,12 +889,13 @@ export interface ITtscLintCoreRules {
851
889
  "no-plusplus"?: TtscLintRuleSetting;
852
890
 
853
891
  /**
854
- * Reject `return` inside the Promise executor function — the value is
855
- * ignored.
892
+ * Reject values returned by the global Promise constructor's executor. This
893
+ * covers concise arrows and explicit returns without crossing nested function
894
+ * boundaries. Set `allowVoid` to accept an explicit unary `void` return.
856
895
  *
857
896
  * @reference https://eslint.org/docs/latest/rules/no-promise-executor-return
858
897
  */
859
- "no-promise-executor-return"?: TtscLintRuleSetting;
898
+ "no-promise-executor-return"?: TtscLintRuleOptionsSetting<ITtscLintCoreNoPromiseExecutorReturnRuleOptions>;
860
899
 
861
900
  /**
862
901
  * Reject access to `obj.__proto__`; use `Object.getPrototypeOf` /
@@ -896,19 +935,23 @@ export interface ITtscLintCoreRules {
896
935
  "no-regex-spaces"?: TtscLintRuleSetting;
897
936
 
898
937
  /**
899
- * Reject `import` declarations targeting any module specifier in the project
900
- * denylist.
938
+ * Reject static imports and re-exports selected by exact paths or patterns.
939
+ * Missing or empty restrictions are a no-op.
901
940
  *
902
941
  * @reference https://eslint.org/docs/latest/rules/no-restricted-imports
903
942
  */
904
- "no-restricted-imports"?: TtscLintRuleSetting;
943
+ "no-restricted-imports"?: TtscLintCoreNoRestrictedImportsRuleSetting;
905
944
 
906
945
  /**
907
- * Reject AST node kinds listed in the project denylist.
946
+ * Reject syntax matching the configured AST selectors. With no selector
947
+ * options the rule is silent; it does not impose a built-in denylist.
948
+ *
949
+ * Native TypeScript-Go kind names and the documented esquery-compatible
950
+ * selector forms are supported, including TypeScript-only syntax.
908
951
  *
909
952
  * @reference https://eslint.org/docs/latest/rules/no-restricted-syntax
910
953
  */
911
- "no-restricted-syntax"?: TtscLintRuleSetting;
954
+ "no-restricted-syntax"?: TtscLintCoreNoRestrictedSyntaxRuleSetting;
912
955
 
913
956
  /**
914
957
  * Reject assignment expressions used as the operand of `return` (`return x =
@@ -916,7 +959,7 @@ export interface ITtscLintCoreRules {
916
959
  *
917
960
  * @reference https://eslint.org/docs/latest/rules/no-return-assign
918
961
  */
919
- "no-return-assign"?: TtscLintRuleSetting;
962
+ "no-return-assign"?: TtscLintCoreNoReturnAssignRuleSetting;
920
963
 
921
964
  /**
922
965
  * Reject `javascript:` URLs in string literals — they execute their body as
@@ -1074,12 +1117,21 @@ export interface ITtscLintCoreRules {
1074
1117
  "no-unsafe-optional-chaining"?: TtscLintRuleSetting;
1075
1118
 
1076
1119
  /**
1077
- * Reject expression statements with no observable effect, like a bare `x;` or
1078
- * `'use strict' && f();`.
1120
+ * Reject expression statements with no observable effect, like a bare `x;`,
1121
+ * `a === b;`, or a tagged template literal statement.
1122
+ *
1123
+ * Directive prologues — the leading run of string-literal statements at the
1124
+ * top of a script, module, namespace body, or function body — are accepted
1125
+ * whatever their text (`"use strict"`, `"use client"`, …); the same strings
1126
+ * elsewhere are rejected. Productive expressions (calls, `new`, assignments,
1127
+ * updates, `delete`, `void`, `await`, `yield`) are accepted, and JSX is
1128
+ * accepted unless
1129
+ * {@link ITtscLintCoreNoUnusedExpressionsRuleOptions.enforceForJSX} is
1130
+ * enabled.
1079
1131
  *
1080
1132
  * @reference https://eslint.org/docs/latest/rules/no-unused-expressions
1081
1133
  */
1082
- "no-unused-expressions"?: TtscLintRuleSetting;
1134
+ "no-unused-expressions"?: TtscLintRuleOptionsSetting<ITtscLintCoreNoUnusedExpressionsRuleOptions>;
1083
1135
 
1084
1136
  /**
1085
1137
  * Reject labels that no `break` or `continue` statement references.
@@ -1214,12 +1266,15 @@ export interface ITtscLintCoreRules {
1214
1266
  "prefer-arrow-callback"?: TtscLintRuleSetting;
1215
1267
 
1216
1268
  /**
1217
- * Require `const` for variables that are never reassigned after declaration.
1218
- * Autofixable for single-declaration `let`s.
1269
+ * Require `const` for lexical bindings that are never reassigned after their
1270
+ * initial value is established. Declaration-only and destructured bindings
1271
+ * follow ESLint's `ignoreReadBeforeAssign` and `destructuring` options.
1272
+ * Autofixable when one initialized declaration can safely change its shared
1273
+ * `let` keyword.
1219
1274
  *
1220
1275
  * @reference https://eslint.org/docs/latest/rules/prefer-const
1221
1276
  */
1222
- "prefer-const"?: TtscLintRuleSetting;
1277
+ "prefer-const"?: TtscLintRuleOptionsSetting<ITtscLintCorePreferConstRuleOptions>;
1223
1278
 
1224
1279
  /**
1225
1280
  * Reject single-property and single-index variable declarations (`const a =
@@ -102,10 +102,15 @@ export interface ITtscLintRegexpRules {
102
102
 
103
103
  /**
104
104
  * Reject regex flags that the literal does not exercise — `i` on a pattern
105
- * without case-variable characters, `m` without `^`/`$`, `s` without `.`, and
106
- * similar dead flags on `g`/`y`.
105
+ * with no case-variable character, `m` on a pattern with no `^`/`$`
106
+ * assertion.
107
107
  *
108
108
  * Cleans up flag combos that suggest behavior the pattern can never trigger.
109
+ * A character is case-variable wherever it sits, so `/[a-z]/i` keeps its flag
110
+ * (the flag is what extends the class to `A-Z`), and a `^` or `$` inside a
111
+ * character class is a plain character that does not save `m`. Patterns the
112
+ * rule cannot settle from the source — a Unicode property escape, a
113
+ * backreference, a `v`-mode set-notation class — count as using the flag.
109
114
  *
110
115
  * @reference https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-flag.html
111
116
  */
@@ -1,3 +1,4 @@
1
+ import type { TtscLintRuleOptionsSetting } from "../TtscLintRuleSetting";
1
2
  import type {
2
3
  ITtscLintBoundariesDependenciesRuleOptions,
3
4
  ITtscLintBoundariesElementTypesRuleOptions,
@@ -6,6 +7,20 @@ import type {
6
7
  ITtscLintBoundariesNoPrivateRuleOptions,
7
8
  ITtscLintBoundariesNoUnknownRuleOptions,
8
9
  } from "./ITtscLintBoundariesRuleOptions";
10
+ import type {
11
+ ITtscLintCoreDefaultCaseRuleOptions,
12
+ ITtscLintCoreNoDuplicateImportsRuleOptions,
13
+ ITtscLintCoreNoElseReturnRuleOptions,
14
+ ITtscLintCoreNoEmptyFunctionRuleOptions,
15
+ ITtscLintCoreNoEmptyRuleOptions,
16
+ ITtscLintCoreNoExtendNativeRuleOptions,
17
+ ITtscLintCoreNoMixedOperatorsRuleOptions,
18
+ ITtscLintCoreNoParamReassignRuleOptions,
19
+ ITtscLintCoreNoPromiseExecutorReturnRuleOptions,
20
+ ITtscLintCoreNoUnusedExpressionsRuleOptions,
21
+ ITtscLintCorePreferConstRuleOptions,
22
+ ITtscLintNoFallthroughRuleOptions,
23
+ } from "./ITtscLintCoreRuleOptions";
9
24
  import type { ITtscLintCypressUnsafeToChainCommandRuleOptions } from "./ITtscLintCypressRuleOptions";
10
25
  import type {
11
26
  ITtscLintFunctionalEmptyRuleOptions,
@@ -27,30 +42,68 @@ import type { ITtscLintReactPerfRuleOptions } from "./ITtscLintReactPerfRuleOpti
27
42
  import type { ITtscLintReactOnlyExportComponentsRuleOptions } from "./ITtscLintReactRuleOptions";
28
43
  import type { ITtscLintStorybookNoUninstalledAddonsRuleOptions } from "./ITtscLintStorybookRuleOptions";
29
44
  import type { ITtscLintTestingLibraryConsistentDataTestIdRuleOptions } from "./ITtscLintTestingLibraryRuleOptions";
45
+ import type {
46
+ ITtscLintTypeScriptBanTsCommentRuleOptions,
47
+ ITtscLintTypeScriptNoFloatingPromisesRuleOptions,
48
+ ITtscLintTypeScriptNoMisusedPromisesRuleOptions,
49
+ ITtscLintTypeScriptNoRestrictedTypesRuleOptions,
50
+ ITtscLintTypeScriptSwitchExhaustivenessCheckRuleOptions,
51
+ } from "./ITtscLintTypeScriptRuleOptions";
52
+ import type {
53
+ ITtscLintUnicornBetterRegexRuleOptions,
54
+ ITtscLintUnicornConsistentFunctionScopingRuleOptions,
55
+ ITtscLintUnicornFilenameCaseRuleOptions,
56
+ ITtscLintUnicornImportStyleRuleOptions,
57
+ ITtscLintUnicornIsolatedFunctionsRuleOptions,
58
+ ITtscLintUnicornNoTypeofUndefinedRuleOptions,
59
+ ITtscLintUnicornNoUnnecessaryPolyfillsRuleOptions,
60
+ ITtscLintUnicornPreferNumberPropertiesRuleOptions,
61
+ ITtscLintUnicornPreventAbbreviationsRuleOptions,
62
+ ITtscLintUnicornStringContentRuleOptions,
63
+ ITtscLintUnicornTemplateIndentRuleOptions,
64
+ ITtscLintUnicornTextEncodingIdentifierCaseRuleOptions,
65
+ } from "./ITtscLintUnicornRuleOptions";
30
66
 
31
67
  /**
32
- * Index from typed rule name to its options object.
68
+ * Index from typed rule name to its single options-object slot.
33
69
  *
34
- * Built-in rule families with configurable options are listed here. Contributor
35
- * plugins extend the map by augmenting it from their own package:
70
+ * Built-in rule families with one object option are listed here. Rules with
71
+ * canonical positional lists expose dedicated setting types instead.
72
+ * Contributor plugins extend the map by augmenting it from their own package:
36
73
  *
37
74
  * ```ts
38
75
  * declare module "@ttsc/lint" {
39
76
  * interface ITtscLintRuleOptionsMap {
40
- * "demo/no-marker-comment": { marker: string };
77
+ * "demo/no-marker-comment": { markers?: readonly string[] };
41
78
  * }
42
79
  * }
43
80
  * ```
44
81
  *
45
- * After augmentation, `{@link TtscLintRuleOptionsSetting}` tuples and the
46
- * `defineConfig`-style helpers in plugin packages can type-check the options
47
- * object against the contributor's declared shape.
82
+ * {@link TtscLintRuleOptionsOverlay} maps every entry to its strongly typed
83
+ * severity tuple. {@link ITtscLintRules} intersects that overlay with the
84
+ * built-in families and the open contributor fallback, so importing a plugin's
85
+ * augmentation tightens its registered rule while unknown contributor names
86
+ * retain the backward-compatible `unknown` options slot.
48
87
  *
49
88
  * `format/*` is **not** listed: formatter behavior is configured through the
50
89
  * top-level `format` block ({@link ITtscLintFormat}), not through the `rules`
51
90
  * surface.
52
91
  */
53
92
  export interface ITtscLintRuleOptionsMap {
93
+ "default-case": ITtscLintCoreDefaultCaseRuleOptions;
94
+ "unicorn/template-indent": ITtscLintUnicornTemplateIndentRuleOptions;
95
+ "typescript/no-floating-promises": ITtscLintTypeScriptNoFloatingPromisesRuleOptions;
96
+ "no-duplicate-imports": ITtscLintCoreNoDuplicateImportsRuleOptions;
97
+ "no-else-return": ITtscLintCoreNoElseReturnRuleOptions;
98
+ "no-empty": ITtscLintCoreNoEmptyRuleOptions;
99
+ "no-empty-function": ITtscLintCoreNoEmptyFunctionRuleOptions;
100
+ "no-extend-native": ITtscLintCoreNoExtendNativeRuleOptions;
101
+ "no-mixed-operators": ITtscLintCoreNoMixedOperatorsRuleOptions;
102
+ "no-param-reassign": ITtscLintCoreNoParamReassignRuleOptions;
103
+ "no-promise-executor-return": ITtscLintCoreNoPromiseExecutorReturnRuleOptions;
104
+ "no-unused-expressions": ITtscLintCoreNoUnusedExpressionsRuleOptions;
105
+ "no-fallthrough": ITtscLintNoFallthroughRuleOptions;
106
+ "prefer-const": ITtscLintCorePreferConstRuleOptions;
54
107
  "testing-library/consistent-data-testid": ITtscLintTestingLibraryConsistentDataTestIdRuleOptions;
55
108
  "functional/functional-parameters": ITtscLintFunctionalParametersRuleOptions;
56
109
  "functional/immutable-data": ITtscLintFunctionalImmutableDataRuleOptions;
@@ -85,4 +138,32 @@ export interface ITtscLintRuleOptionsMap {
85
138
  "react-perf/jsx-no-jsx-as-prop": ITtscLintReactPerfRuleOptions;
86
139
  "storybook/no-uninstalled-addons": ITtscLintStorybookNoUninstalledAddonsRuleOptions;
87
140
  "react/only-export-components": ITtscLintReactOnlyExportComponentsRuleOptions;
141
+ "typescript/ban-ts-comment": ITtscLintTypeScriptBanTsCommentRuleOptions;
142
+ "typescript/no-misused-promises": ITtscLintTypeScriptNoMisusedPromisesRuleOptions;
143
+ "typescript/no-restricted-types": ITtscLintTypeScriptNoRestrictedTypesRuleOptions;
144
+ "typescript/switch-exhaustiveness-check": ITtscLintTypeScriptSwitchExhaustivenessCheckRuleOptions;
145
+ "unicorn/consistent-function-scoping": ITtscLintUnicornConsistentFunctionScopingRuleOptions;
146
+ "unicorn/better-regex": ITtscLintUnicornBetterRegexRuleOptions;
147
+ "unicorn/prevent-abbreviations": ITtscLintUnicornPreventAbbreviationsRuleOptions;
148
+ "unicorn/import-style": ITtscLintUnicornImportStyleRuleOptions;
149
+ "unicorn/filename-case": ITtscLintUnicornFilenameCaseRuleOptions;
150
+ "unicorn/string-content": ITtscLintUnicornStringContentRuleOptions;
151
+ "unicorn/isolated-functions": ITtscLintUnicornIsolatedFunctionsRuleOptions;
152
+ "unicorn/no-typeof-undefined": ITtscLintUnicornNoTypeofUndefinedRuleOptions;
153
+ "unicorn/no-unnecessary-polyfills": ITtscLintUnicornNoUnnecessaryPolyfillsRuleOptions;
154
+ "unicorn/prefer-number-properties": ITtscLintUnicornPreferNumberPropertiesRuleOptions;
155
+ "unicorn/text-encoding-identifier-case": ITtscLintUnicornTextEncodingIdentifierCaseRuleOptions;
88
156
  }
157
+
158
+ /**
159
+ * Strongly typed rule settings derived from the augmentable options map.
160
+ *
161
+ * This mapped overlay is consumed by {@link ITtscLintRules}; keeping the
162
+ * derivation here makes module augmentation immediately affect the public
163
+ * configuration type without a second per-plugin rule-name declaration.
164
+ */
165
+ export type TtscLintRuleOptionsOverlay = {
166
+ [TRuleName in keyof ITtscLintRuleOptionsMap]?: TtscLintRuleOptionsSetting<
167
+ ITtscLintRuleOptionsMap[TRuleName]
168
+ >;
169
+ };
@@ -12,6 +12,7 @@ import type { ITtscLintPromiseRules } from "./ITtscLintPromiseRules";
12
12
  import type { ITtscLintReactPerfRules } from "./ITtscLintReactPerfRules";
13
13
  import type { ITtscLintReactRules } from "./ITtscLintReactRules";
14
14
  import type { ITtscLintRegexpRules } from "./ITtscLintRegexpRules";
15
+ import type { TtscLintRuleOptionsOverlay } from "./ITtscLintRuleOptionsMap";
15
16
  import type { ITtscLintSecurityRules } from "./ITtscLintSecurityRules";
16
17
  import type { ITtscLintSolidRules } from "./ITtscLintSolidRules";
17
18
  import type { ITtscLintStorybookRules } from "./ITtscLintStorybookRules";
@@ -51,7 +52,10 @@ import type { ITtscLintVitestRules } from "./ITtscLintVitestRules";
51
52
  * public rules surface.
52
53
  * - Any other `"<namespace>/<rule>"` key is accepted via
53
54
  * {@link ITtscLintContributorRules} so plugin-shipped rules compose cleanly
54
- * without ambient module augmentation.
55
+ * without ambient module augmentation. A plugin can augment
56
+ * `ITtscLintRuleOptionsMap`; {@link TtscLintRuleOptionsOverlay} then tightens
57
+ * that rule's options while the open fallback remains for unregistered
58
+ * contributor names.
55
59
  */
56
60
  export type ITtscLintRules = ITtscLintCoreRules &
57
61
  ITtscLintTypeScriptRules &
@@ -74,4 +78,5 @@ export type ITtscLintRules = ITtscLintCoreRules &
74
78
  ITtscLintTestingLibraryRules &
75
79
  ITtscLintUnicornRules &
76
80
  ITtscLintVitestRules &
77
- ITtscLintContributorRules;
81
+ ITtscLintContributorRules &
82
+ TtscLintRuleOptionsOverlay;
@@ -64,15 +64,6 @@ export interface ITtscLintSolidRules {
64
64
  */
65
65
  "solid/jsx-no-undef"?: TtscLintRuleSetting;
66
66
 
67
- /**
68
- * Scope-marker compatibility rule (mirrors ESLint's `react/jsx-uses-vars`).
69
- *
70
- * The native engine emits no diagnostics for this id.
71
- *
72
- * @reference https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/jsx-uses-vars.md
73
- */
74
- "solid/jsx-uses-vars"?: TtscLintRuleSetting;
75
-
76
67
  /**
77
68
  * Reject array values passed as Solid event handlers — Solid does not unwrap
78
69
  * the array form React supports.