@ttsc/lint 0.18.4 → 0.19.0

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 +95 -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 +160 -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 +151 -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 +145 -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
@@ -0,0 +1,465 @@
1
+ import type { TtscLintRuleSetting } from "../TtscLintRuleSetting";
2
+ import type { TtscLintSeverity } from "../TtscLintSeverity";
3
+
4
+ /**
5
+ * Options shapes for the configurable rules in {@link ITtscLintCoreRules}.
6
+ *
7
+ * @reference https://eslint.org/docs/latest/rules/
8
+ */
9
+
10
+ /** `no-duplicate-imports` rule options. */
11
+ export interface ITtscLintCoreNoDuplicateImportsRuleOptions {
12
+ /**
13
+ * Keep clause-level `import type` declarations out of the duplicate
14
+ * comparison with value-bearing declarations of the same module, so one
15
+ * runtime import plus one type-only import may coexist. Inline type
16
+ * specifiers such as `import { type Foo }` stay on the value side because the
17
+ * whole import clause is not type-only.
18
+ *
19
+ * @default false
20
+ */
21
+ allowSeparateTypeImports?: boolean;
22
+
23
+ /**
24
+ * Also treat `export … from` declarations of an already imported (or
25
+ * re-exported) module as duplicates when the declarations could be merged.
26
+ *
27
+ * @default false
28
+ */
29
+ includeExports?: boolean;
30
+ }
31
+
32
+ /** `no-empty` rule options. */
33
+ export interface ITtscLintCoreNoEmptyRuleOptions {
34
+ /**
35
+ * Allow a catch clause with no statements or interior comment. Other empty
36
+ * blocks remain reportable.
37
+ *
38
+ * @default false
39
+ */
40
+ allowEmptyCatch?: boolean;
41
+ }
42
+
43
+ /** Function categories accepted by `no-empty-function`. */
44
+ export type TtscLintCoreNoEmptyFunctionAllow =
45
+ | "functions"
46
+ | "arrowFunctions"
47
+ | "generatorFunctions"
48
+ | "methods"
49
+ | "generatorMethods"
50
+ | "getters"
51
+ | "setters"
52
+ | "constructors"
53
+ | "asyncFunctions"
54
+ | "asyncMethods"
55
+ | "privateConstructors"
56
+ | "protectedConstructors"
57
+ | "decoratedFunctions"
58
+ | "overrideMethods";
59
+
60
+ /** `no-empty-function` rule options. */
61
+ export interface ITtscLintCoreNoEmptyFunctionRuleOptions {
62
+ /**
63
+ * Function categories that may have an empty, uncommented block body.
64
+ * TypeScript parameter-property constructors are always accepted because
65
+ * their parameters initialize fields even when the block has no statements.
66
+ *
67
+ * @default [ ]
68
+ */
69
+ allow?: TtscLintCoreNoEmptyFunctionAllow[];
70
+ }
71
+
72
+ /**
73
+ * `no-unused-expressions` rule options.
74
+ *
75
+ * Mirrors the upstream ESLint option object; every flag defaults to `false`.
76
+ *
77
+ * @reference https://eslint.org/docs/latest/rules/no-unused-expressions
78
+ */
79
+ export interface ITtscLintCoreNoUnusedExpressionsRuleOptions {
80
+ /**
81
+ * Allow short-circuit expression statements such as `a && b()`. Only the
82
+ * right-hand side must be a productive expression; `a && b` stays reported.
83
+ *
84
+ * @default false
85
+ */
86
+ allowShortCircuit?: boolean;
87
+
88
+ /**
89
+ * Allow ternary expression statements such as `a ? b() : c()`. Both result
90
+ * branches must be productive expressions; `a ? b() : c` stays reported.
91
+ *
92
+ * @default false
93
+ */
94
+ allowTernary?: boolean;
95
+
96
+ /**
97
+ * Allow tagged template literal statements. The tag function call may have
98
+ * side effects. Untagged template literal statements stay reported.
99
+ *
100
+ * @default false
101
+ */
102
+ allowTaggedTemplates?: boolean;
103
+
104
+ /**
105
+ * Report JSX elements and fragments standing alone as statements. By default
106
+ * they are accepted because rendering libraries may evaluate them for side
107
+ * effects.
108
+ *
109
+ * @default false
110
+ */
111
+ enforceForJSX?: boolean;
112
+
113
+ /**
114
+ * Also exempt statements that positionally look like directive-prologue
115
+ * members under the loose ESTree view upstream ESLint uses, in which
116
+ * parentheses are invisible: a parenthesized string inside the leading string
117
+ * run of a script, module, namespace body, or function body is not reported.
118
+ * Real (unparenthesized) directive prologues are always exempt regardless of
119
+ * this flag.
120
+ *
121
+ * @default false
122
+ */
123
+ ignoreDirectives?: boolean;
124
+ }
125
+
126
+ /** Object option for ESLint's canonical `no-inner-declarations` tuple. */
127
+ export interface ITtscLintCoreNoInnerDeclarationsRuleOptions {
128
+ /**
129
+ * Allow ES2015 block-scoped function declarations in strict scripts and
130
+ * function bodies, modules, and class code, or report them as a style
131
+ * policy.
132
+ *
133
+ * @default "allow"
134
+ */
135
+ blockScopedFunctions?: "allow" | "disallow";
136
+ }
137
+
138
+ /**
139
+ * Canonical positional setting for `no-inner-declarations`.
140
+ *
141
+ * The declaration mode is ESLint's first option. The optional object remains
142
+ * the second option, so existing ESLint configurations can be copied without
143
+ * reshaping them into a ttsc-only object.
144
+ */
145
+ export type TtscLintCoreNoInnerDeclarationsRuleSetting =
146
+ | TtscLintRuleSetting
147
+ | readonly [TtscLintSeverity, "functions" | "both"]
148
+ | readonly [
149
+ TtscLintSeverity,
150
+ "functions" | "both",
151
+ ITtscLintCoreNoInnerDeclarationsRuleOptions,
152
+ ];
153
+
154
+ /** One restriction accepted by ESLint's `no-restricted-syntax` rule. */
155
+ export type TtscLintCoreNoRestrictedSyntaxSelector =
156
+ | string
157
+ | {
158
+ /** Esquery selector evaluated against the TypeScript-Go AST. */
159
+ selector: string;
160
+
161
+ /** Diagnostic text replacing the canonical default message. */
162
+ message?: string;
163
+ };
164
+
165
+ /**
166
+ * Canonical variadic setting for `no-restricted-syntax`.
167
+ *
168
+ * Every tuple item after the severity is one independently reported selector. A
169
+ * bare severity or one-element tuple carries no selectors and is silent.
170
+ */
171
+ export type TtscLintCoreNoRestrictedSyntaxRuleSetting =
172
+ | TtscLintRuleSetting
173
+ | readonly [TtscLintSeverity, ...TtscLintCoreNoRestrictedSyntaxSelector[]];
174
+
175
+ /**
176
+ * `no-fallthrough` rule options.
177
+ *
178
+ * Mirrors the ESLint core rule's options schema.
179
+ *
180
+ * @reference https://eslint.org/docs/latest/rules/no-fallthrough
181
+ */
182
+ export interface ITtscLintNoFallthroughRuleOptions {
183
+ /**
184
+ * Regular expression string that an intentional-fallthrough comment must
185
+ * match. Setting it replaces the default marker pattern
186
+ * (`/falls?\s?through/i`) entirely, so the standard `// falls through`
187
+ * spellings stop being accepted unless the custom pattern matches them.
188
+ *
189
+ * @default "falls?\\s?through" (case-insensitive)
190
+ */
191
+ commentPattern?: string;
192
+
193
+ /**
194
+ * Allow a case with no statements to be separated from the next label by
195
+ * blank lines. By default an empty case followed by a blank line is treated
196
+ * as an accidental fallthrough; adjacent labels (`case 0: case 1:`) are
197
+ * always allowed.
198
+ *
199
+ * @default false
200
+ */
201
+ allowEmptyCase?: boolean;
202
+
203
+ /**
204
+ * Report fallthrough marker comments on cases that cannot actually fall
205
+ * through (for example a `// falls through` after a `break`), since the
206
+ * comment documents behavior the code no longer has.
207
+ *
208
+ * @default false
209
+ */
210
+ reportUnusedFallthroughComment?: boolean;
211
+ }
212
+
213
+ /** `no-promise-executor-return` rule options. */
214
+ export interface ITtscLintCoreNoPromiseExecutorReturnRuleOptions {
215
+ /**
216
+ * Allow an executor to explicitly discard a value with the unary `void`
217
+ * operator, in either a concise arrow body or a `return void expression`
218
+ * statement. Other expressions that happen to have the `void` type remain
219
+ * reportable because their explicit return value is still ignored.
220
+ *
221
+ * @default false
222
+ */
223
+ allowVoid?: boolean;
224
+ }
225
+
226
+ /**
227
+ * `no-param-reassign` rule options.
228
+ *
229
+ * The ignore lists are meaningful only when property writes are enabled. The
230
+ * discriminated union preserves ESLint's schema: an explicit `props: false`
231
+ * object may not carry either ignore list. ESLint also accepts an ignore list
232
+ * with `props` omitted, although it stays inactive until `props` is `true`.
233
+ *
234
+ * @reference https://eslint.org/docs/latest/rules/no-param-reassign
235
+ */
236
+ export type ITtscLintCoreNoParamReassignRuleOptions =
237
+ | {
238
+ /**
239
+ * Report writes to properties reached through a parameter reference.
240
+ *
241
+ * @default false
242
+ */
243
+ props?: false;
244
+
245
+ ignorePropertyModificationsFor?: never;
246
+ ignorePropertyModificationsForRegex?: never;
247
+ }
248
+ | {
249
+ /** Report writes to properties reached through a parameter reference. */
250
+ props?: true;
251
+
252
+ /** Parameter names whose property writes are accepted. */
253
+ ignorePropertyModificationsFor?: string[];
254
+
255
+ /**
256
+ * Unicode regular-expression strings matched against parameter names
257
+ * whose property writes are accepted.
258
+ */
259
+ ignorePropertyModificationsForRegex?: string[];
260
+ };
261
+
262
+ /** Shared message and type-import switches for one restricted import entry. */
263
+ interface ITtscLintCoreNoRestrictedImportsEntryBase {
264
+ /** Text appended to the standard diagnostic. */
265
+ message?: string;
266
+
267
+ /** Permit whole type-only declarations and type-only named specifiers. */
268
+ allowTypeImports?: boolean;
269
+ }
270
+
271
+ /** Non-empty string collection required by structured pattern controls. */
272
+ type TtscLintCoreNoRestrictedImportsNonEmptyStrings = readonly [
273
+ string,
274
+ ...string[],
275
+ ];
276
+
277
+ /** Mutually exclusive imported-name controls accepted for an exact path. */
278
+ type TtscLintCoreNoRestrictedImportsPathNames =
279
+ | {
280
+ /** Imported names to reject; aliases are matched by their source name. */
281
+ importNames?: string[];
282
+ allowImportNames?: never;
283
+ }
284
+ | {
285
+ importNames?: never;
286
+ /** Reject every imported name outside this allowlist. */
287
+ allowImportNames: string[];
288
+ };
289
+
290
+ /** One exact path restriction in `no-restricted-imports`. */
291
+ export type TtscLintCoreNoRestrictedImportsPath =
292
+ | string
293
+ | (ITtscLintCoreNoRestrictedImportsEntryBase &
294
+ TtscLintCoreNoRestrictedImportsPathNames & {
295
+ /** Module specifier matched exactly. */
296
+ name: string;
297
+ });
298
+
299
+ /** Mutually exclusive imported-name controls accepted for a path pattern. */
300
+ type TtscLintCoreNoRestrictedImportsPatternNames =
301
+ | {
302
+ /** Imported names rejected by exact match. */
303
+ importNames?: TtscLintCoreNoRestrictedImportsNonEmptyStrings;
304
+ /** Imported names rejected by a regular expression. */
305
+ importNamePattern?: string;
306
+ allowImportNames?: never;
307
+ allowImportNamePattern?: never;
308
+ }
309
+ | {
310
+ importNames?: never;
311
+ importNamePattern?: never;
312
+ /** Reject every imported name outside this allowlist. */
313
+ allowImportNames: TtscLintCoreNoRestrictedImportsNonEmptyStrings;
314
+ allowImportNamePattern?: never;
315
+ }
316
+ | {
317
+ importNames?: never;
318
+ importNamePattern?: never;
319
+ allowImportNames?: never;
320
+ /** Reject every imported name that does not match this expression. */
321
+ allowImportNamePattern: string;
322
+ };
323
+
324
+ /** One gitignore-style group or regular-expression path restriction. */
325
+ export type ITtscLintCoreNoRestrictedImportsPattern =
326
+ ITtscLintCoreNoRestrictedImportsEntryBase &
327
+ TtscLintCoreNoRestrictedImportsPatternNames & {
328
+ /** Match module specifiers case-sensitively instead of the default fold. */
329
+ caseSensitive?: boolean;
330
+ } & (
331
+ | {
332
+ /** Ordered gitignore-style path patterns, including `!` negation. */
333
+ group: TtscLintCoreNoRestrictedImportsNonEmptyStrings;
334
+ regex?: never;
335
+ }
336
+ | {
337
+ group?: never;
338
+ /** Regular expression tested against the module specifier. */
339
+ regex: string;
340
+ }
341
+ );
342
+
343
+ /** Object form of the current ESLint `no-restricted-imports` options. */
344
+ export interface ITtscLintCoreNoRestrictedImportsRuleOptions {
345
+ /** Exact module specifiers to restrict. */
346
+ paths?: TtscLintCoreNoRestrictedImportsPath[];
347
+
348
+ /** Gitignore-style strings or structured pattern entries. */
349
+ patterns?: string[] | ITtscLintCoreNoRestrictedImportsPattern[];
350
+ }
351
+
352
+ /**
353
+ * Canonical setting for `no-restricted-imports`.
354
+ *
355
+ * ESLint accepts either positional path entries or one `{ paths, patterns }`
356
+ * object. Both forms remain available so existing configurations need no
357
+ * ttsc-specific reshaping.
358
+ */
359
+ export type TtscLintCoreNoRestrictedImportsRuleSetting =
360
+ | TtscLintRuleSetting
361
+ | readonly [TtscLintSeverity, ITtscLintCoreNoRestrictedImportsRuleOptions]
362
+ | readonly [
363
+ TtscLintSeverity,
364
+ TtscLintCoreNoRestrictedImportsPath,
365
+ ...TtscLintCoreNoRestrictedImportsPath[],
366
+ ];
367
+
368
+ /** `prefer-const` rule options. */
369
+ export interface ITtscLintCorePreferConstRuleOptions {
370
+ /**
371
+ * Report each const-eligible binding in a destructuring pattern (`"any"`), or
372
+ * report the pattern only when every binding is const-eligible (`"all"`).
373
+ *
374
+ * @default "any"
375
+ */
376
+ destructuring?: "any" | "all";
377
+
378
+ /**
379
+ * Ignore a declaration-only binding when it is read before its first
380
+ * assignment. This avoids a conflict with `no-use-before-define` policies
381
+ * that require the declaration to stay at its original location.
382
+ *
383
+ * @default false
384
+ */
385
+ ignoreReadBeforeAssign?: boolean;
386
+ }
387
+
388
+ /** `default-case` rule options. */
389
+ export interface ITtscLintCoreDefaultCaseRuleOptions {
390
+ /**
391
+ * Regular-expression string that marks an intentionally omitted default
392
+ * clause. It replaces the default `^no default$` pattern.
393
+ */
394
+ commentPattern?: string;
395
+ }
396
+
397
+ /** Relative order accepted by `grouped-accessor-pairs`. */
398
+ export type TtscLintCoreGroupedAccessorPairsOrder =
399
+ | "anyOrder"
400
+ | "getBeforeSet"
401
+ | "setBeforeGet";
402
+
403
+ /** Canonical positional setting for `grouped-accessor-pairs`. */
404
+ export type TtscLintCoreGroupedAccessorPairsRuleSetting =
405
+ | TtscLintRuleSetting
406
+ | readonly [TtscLintSeverity, TtscLintCoreGroupedAccessorPairsOrder];
407
+
408
+ /** `no-else-return` rule options. */
409
+ export interface ITtscLintCoreNoElseReturnRuleOptions {
410
+ /** Allow an `else if` after a branch that always returns. @default true */
411
+ allowElseIf?: boolean;
412
+ }
413
+
414
+ /** `no-extend-native` rule options. */
415
+ export interface ITtscLintCoreNoExtendNativeRuleOptions {
416
+ /** Native constructor names whose prototypes may be extended. @default [] */
417
+ exceptions?: readonly string[];
418
+ }
419
+
420
+ /** Operator spelling accepted in a `no-mixed-operators` group. */
421
+ export type TtscLintCoreNoMixedOperatorsOperator =
422
+ | "+"
423
+ | "-"
424
+ | "*"
425
+ | "/"
426
+ | "%"
427
+ | "**"
428
+ | "&"
429
+ | "|"
430
+ | "^"
431
+ | "~"
432
+ | "<<"
433
+ | ">>"
434
+ | ">>>"
435
+ | "=="
436
+ | "!="
437
+ | "==="
438
+ | "!=="
439
+ | ">"
440
+ | ">="
441
+ | "<"
442
+ | "<="
443
+ | "&&"
444
+ | "||"
445
+ | "in"
446
+ | "instanceof"
447
+ | "??"
448
+ | "?:";
449
+
450
+ /** `no-mixed-operators` rule options. */
451
+ export interface ITtscLintCoreNoMixedOperatorsRuleOptions {
452
+ /** Operator groups within which an unparenthesized mix is checked. */
453
+ groups?: readonly (readonly TtscLintCoreNoMixedOperatorsOperator[])[];
454
+
455
+ /** Allow different operators with the same precedence. @default true */
456
+ allowSamePrecedence?: boolean;
457
+ }
458
+
459
+ /** Canonical positional mode for `no-return-assign`. */
460
+ export type TtscLintCoreNoReturnAssignMode = "except-parens" | "always";
461
+
462
+ /** Canonical positional setting for `no-return-assign`. */
463
+ export type TtscLintCoreNoReturnAssignRuleSetting =
464
+ | TtscLintRuleSetting
465
+ | readonly [TtscLintSeverity, TtscLintCoreNoReturnAssignMode];