@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,276 @@
1
+ /** Case-style keys accepted by `unicorn/filename-case`. */
2
+ export type TtscLintUnicornFilenameCaseName = "camelCase" | "camelCaseWithAcronyms" | "kebabCase" | "snakeCase" | "pascalCase";
3
+ /**
4
+ * Options for `unicorn/filename-case`.
5
+ *
6
+ * `case` and `cases` are mutually exclusive: configure either the single
7
+ * enforced style or a map of allowed styles. With neither configured — or with
8
+ * every `cases` entry disabled — the rule enforces kebab-case.
9
+ *
10
+ * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
11
+ */
12
+ export interface ITtscLintUnicornFilenameCaseRuleOptions {
13
+ /** The single filename and directory name case style. @default "kebabCase" */
14
+ case?: TtscLintUnicornFilenameCaseName;
15
+ /** The allowed filename and directory name case styles. */
16
+ cases?: Partial<Readonly<Record<TtscLintUnicornFilenameCaseName, boolean>>>;
17
+ /**
18
+ * Regular-expression strings; a file is exempt when any pattern matches any
19
+ * segment of its project-relative path.
20
+ */
21
+ ignore?: readonly string[];
22
+ /**
23
+ * Treat additional dot-separated parts of a filename as file extensions,
24
+ * checking only the stem before the first dot.
25
+ *
26
+ * @default true
27
+ */
28
+ multipleFileExtensions?: boolean;
29
+ /** Check directory names. @default true */
30
+ checkDirectories?: boolean;
31
+ }
32
+ /**
33
+ * Options for `unicorn/better-regex`.
34
+ *
35
+ * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/better-regex.md
36
+ */
37
+ export interface ITtscLintUnicornBetterRegexRuleOptions {
38
+ /**
39
+ * Sort and merge adjacent character-class ranges (e.g. `[d-ea-c]` ->
40
+ * `[a-e]`). Defaults to `true`; set `false` to keep the source order and only
41
+ * apply the length-reducing shorthands.
42
+ */
43
+ sortCharacterClasses?: boolean;
44
+ }
45
+ /**
46
+ * Options for `unicorn/template-indent`.
47
+ *
48
+ * Each selection list replaces the corresponding default list. `indent` is
49
+ * either a positive number of spaces or the exact non-empty whitespace string
50
+ * added after the opening template's source-line margin.
51
+ *
52
+ * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/template-indent.md
53
+ */
54
+ export interface ITtscLintUnicornTemplateIndentRuleOptions {
55
+ /** Block-comment contents that select the immediately following template. */
56
+ comments?: readonly string[];
57
+ /** Function paths whose direct template-literal arguments are checked. */
58
+ functions?: readonly string[];
59
+ /** Positive space count or exact whitespace unit used inside the template. */
60
+ indent?: number | string;
61
+ /** AST selectors whose matching template literals are checked. */
62
+ selectors?: readonly string[];
63
+ /** Identifier or dotted member paths used as checked template tags. */
64
+ tags?: readonly string[];
65
+ }
66
+ /**
67
+ * Per-module style policy for `unicorn/import-style`.
68
+ *
69
+ * `false` removes every restriction from the module. An object maps style names
70
+ * (`unassigned`, `default`, `namespace`, `named`) to booleans; with
71
+ * `extendDefaultStyles` the flags merge over the module's built-in entry. A
72
+ * module whose four canonical styles are all explicitly `false` is reported as
73
+ * misconfigured on every reference — use `no-restricted-imports` to ban a
74
+ * module outright.
75
+ */
76
+ export type TtscLintUnicornImportStyleModuleStyles = false | Readonly<Record<string, boolean>>;
77
+ /**
78
+ * Options for `unicorn/import-style`.
79
+ *
80
+ * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/import-style.md
81
+ */
82
+ export interface ITtscLintUnicornImportStyleRuleOptions {
83
+ /** Check static `import` declarations. @default true */
84
+ checkImport?: boolean;
85
+ /** Check dynamic `import()` expressions. @default true */
86
+ checkDynamicImport?: boolean;
87
+ /** Check `export … from` declarations. @default false */
88
+ checkExportFrom?: boolean;
89
+ /** Check `require(…)` calls. @default true */
90
+ checkRequire?: boolean;
91
+ /** Merge `styles` into the built-in per-module table. @default true */
92
+ extendDefaultStyles?: boolean;
93
+ /**
94
+ * Allowed import styles per module name. `node:`-prefixed references inherit
95
+ * the bare module name's policy.
96
+ */
97
+ styles?: Readonly<Record<string, TtscLintUnicornImportStyleModuleStyles>>;
98
+ }
99
+ /**
100
+ * Global-variable policy for one `unicorn/isolated-functions` override.
101
+ *
102
+ * `true` / `"writable"` / `"writeable"` permit writes, `false` / `"readonly"`
103
+ * permit reads only, and `"off"` forbids the global entirely inside isolated
104
+ * scopes.
105
+ */
106
+ export type TtscLintUnicornIsolatedFunctionsGlobalPolicy = boolean | "readonly" | "writable" | "writeable" | "off";
107
+ /**
108
+ * Options for `unicorn/isolated-functions`.
109
+ *
110
+ * Each list replaces the corresponding default. A function is treated as
111
+ * isolated when a call to a name in `functions` receives it as an argument,
112
+ * when it matches one of the `selectors`, or when one of the `comments` markers
113
+ * precedes it; `overrideGlobals` retunes which global names may be read or
114
+ * written inside isolated scopes.
115
+ *
116
+ * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/isolated-functions.md
117
+ */
118
+ export interface ITtscLintUnicornIsolatedFunctionsRuleOptions {
119
+ /**
120
+ * Callee names whose call arguments are isolated functions.
121
+ *
122
+ * @default ["makeSynchronous", "workerize"]
123
+ */
124
+ functions?: readonly string[];
125
+ /**
126
+ * AST selectors whose matching functions are isolated.
127
+ *
128
+ * @default [ ]
129
+ */
130
+ selectors?: readonly string[];
131
+ /**
132
+ * Comment markers that isolate the function they immediately precede.
133
+ *
134
+ * @default ["@isolated"]
135
+ */
136
+ comments?: readonly string[];
137
+ /**
138
+ * Per-name overrides for which globals may be read or written inside isolated
139
+ * scopes.
140
+ */
141
+ overrideGlobals?: Readonly<Record<string, TtscLintUnicornIsolatedFunctionsGlobalPolicy>>;
142
+ }
143
+ /** Import categories accepted by `unicorn/prevent-abbreviations`. */
144
+ export type TtscLintUnicornPreventAbbreviationsImportMode = boolean | "internal";
145
+ /**
146
+ * Replacement patch for one discouraged name.
147
+ *
148
+ * `false` disables every replacement for the name. An object enables or
149
+ * disables individual replacement spellings.
150
+ */
151
+ export type TtscLintUnicornPreventAbbreviationsReplacement = false | Readonly<Record<string, boolean>>;
152
+ /** Options for `unicorn/consistent-function-scoping`. */
153
+ export interface ITtscLintUnicornConsistentFunctionScopingRuleOptions {
154
+ /** Also check arrow functions for movable definitions. @default true */
155
+ checkArrowFunctions?: boolean;
156
+ }
157
+ /** Options for `unicorn/prevent-abbreviations`. */
158
+ export interface ITtscLintUnicornPreventAbbreviationsRuleOptions {
159
+ /** Also check property definitions and writes. @default false */
160
+ checkProperties?: boolean;
161
+ /** Check lexical bindings. @default true */
162
+ checkVariables?: boolean;
163
+ /**
164
+ * Check default and namespace imports from all modules, internal modules, or
165
+ * no modules.
166
+ *
167
+ * @default "internal"
168
+ */
169
+ checkDefaultAndNamespaceImports?: TtscLintUnicornPreventAbbreviationsImportMode;
170
+ /**
171
+ * Check unaliased named imports from all modules, internal modules, or no
172
+ * modules.
173
+ *
174
+ * @default "internal"
175
+ */
176
+ checkShorthandImports?: TtscLintUnicornPreventAbbreviationsImportMode;
177
+ /** Check bindings introduced by shorthand object destructuring. @default false */
178
+ checkShorthandProperties?: boolean;
179
+ /** Check the physical source filename. @default true */
180
+ checkFilenames?: boolean;
181
+ /** Merge `replacements` into the canonical default table. @default true */
182
+ extendDefaultReplacements?: boolean;
183
+ /** Add, remove, or replace discouraged-name mappings. */
184
+ replacements?: Readonly<Record<string, TtscLintUnicornPreventAbbreviationsReplacement>>;
185
+ /** Merge `allowList` into the canonical default allow list. @default true */
186
+ extendDefaultAllowList?: boolean;
187
+ /** Case-sensitive full names to allow or remove from the allow list. */
188
+ allowList?: Readonly<Record<string, boolean>>;
189
+ /** Regular-expression strings matched against a complete name or basename. */
190
+ ignore?: readonly string[];
191
+ }
192
+ /**
193
+ * One replacement entry for `unicorn/string-content`.
194
+ *
195
+ * The object form of a `patterns` value. A plain string value is shorthand for
196
+ * `{ suggest: value }`.
197
+ */
198
+ export interface ITtscLintUnicornStringContentPatternOptions {
199
+ /** Replacement text applied to every match of the pattern. */
200
+ suggest: string;
201
+ /**
202
+ * Apply the replacement automatically; `false` reports the diagnostic with an
203
+ * opt-in editor suggestion instead.
204
+ *
205
+ * @default true
206
+ */
207
+ fix?: boolean;
208
+ /**
209
+ * Match the pattern case-sensitively.
210
+ *
211
+ * @default true
212
+ */
213
+ caseSensitive?: boolean;
214
+ /**
215
+ * Custom diagnostic message; `{{match}}` and `{{suggest}}` placeholders
216
+ * interpolate the pattern source and replacement text.
217
+ */
218
+ message?: string;
219
+ }
220
+ /**
221
+ * Options for `unicorn/string-content`.
222
+ *
223
+ * The rule has no default patterns: without a configured `patterns` object it
224
+ * reports nothing. Each key is a regular-expression source matched against
225
+ * string-literal values and template-quasi raw text; the FIRST matching pattern
226
+ * per node wins and every occurrence is replaced.
227
+ *
228
+ * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/string-content.md
229
+ */
230
+ export interface ITtscLintUnicornStringContentRuleOptions {
231
+ /** Regular-expression sources mapped to replacement text or an entry object. */
232
+ patterns?: Readonly<Record<string, string | ITtscLintUnicornStringContentPatternOptions>>;
233
+ /** AST selectors that replace the default Literal/TemplateElement targets. */
234
+ selectors?: readonly string[];
235
+ }
236
+ /**
237
+ * Explicit target runtimes for `unicorn/no-unnecessary-polyfills`.
238
+ *
239
+ * A Browserslist query string, an array of such queries, or a core-js-compat
240
+ * targets object (engine name to a version string or number, plus the special
241
+ * `browsers` / `esmodules` keys). Resolved with the `production` environment
242
+ * against the linted file's directory, exactly as upstream passes the value to
243
+ * core-js-compat.
244
+ */
245
+ export type TtscLintUnicornNoUnnecessaryPolyfillsTargets = string | readonly string[] | Readonly<Record<string, string | number | boolean | readonly string[]>>;
246
+ /**
247
+ * Options for `unicorn/no-unnecessary-polyfills`.
248
+ *
249
+ * Without this option the rule resolves targets from Browserslist config
250
+ * discovery and, as a last resort, the nearest `package.json` `engines` field.
251
+ * Set `targets` to pin the baseline explicitly; it mirrors upstream's required
252
+ * `targets` schema property.
253
+ *
254
+ * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-polyfills.md
255
+ */
256
+ export interface ITtscLintUnicornNoUnnecessaryPolyfillsRuleOptions {
257
+ /** Browserslist query, array of queries, or a core-js-compat targets object. */
258
+ targets: TtscLintUnicornNoUnnecessaryPolyfillsTargets;
259
+ }
260
+ /** Options for `unicorn/no-typeof-undefined`. */
261
+ export interface ITtscLintUnicornNoTypeofUndefinedRuleOptions {
262
+ /** Also report undeclared global identifiers. @default false */
263
+ checkGlobalVariables?: boolean;
264
+ }
265
+ /** Options for `unicorn/prefer-number-properties`. */
266
+ export interface ITtscLintUnicornPreferNumberPropertiesRuleOptions {
267
+ /** Also replace the global `Infinity` binding. @default false */
268
+ checkInfinity?: boolean;
269
+ /** Also replace the global `NaN` binding. @default false */
270
+ checkNaN?: boolean;
271
+ }
272
+ /** Options for `unicorn/text-encoding-identifier-case`. */
273
+ export interface ITtscLintUnicornTextEncodingIdentifierCaseRuleOptions {
274
+ /** Prefer `utf-8` instead of `utf8` outside dash-required APIs. @default false */
275
+ withDash?: boolean;
276
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ITtscLintUnicornRuleOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITtscLintUnicornRuleOptions.js","sourceRoot":"","sources":["../../../src/structures/rules/ITtscLintUnicornRuleOptions.ts"],"names":[],"mappings":""}
@@ -1,4 +1,5 @@
1
- import type { TtscLintRuleSetting } from "../TtscLintRuleSetting";
1
+ import type { TtscLintRuleOptionsSetting, TtscLintRuleSetting } from "../TtscLintRuleSetting";
2
+ import type { ITtscLintUnicornBetterRegexRuleOptions, ITtscLintUnicornConsistentFunctionScopingRuleOptions, ITtscLintUnicornFilenameCaseRuleOptions, ITtscLintUnicornImportStyleRuleOptions, ITtscLintUnicornIsolatedFunctionsRuleOptions, ITtscLintUnicornNoTypeofUndefinedRuleOptions, ITtscLintUnicornNoUnnecessaryPolyfillsRuleOptions, ITtscLintUnicornPreferNumberPropertiesRuleOptions, ITtscLintUnicornPreventAbbreviationsRuleOptions, ITtscLintUnicornStringContentRuleOptions, ITtscLintUnicornTemplateIndentRuleOptions, ITtscLintUnicornTextEncodingIdentifierCaseRuleOptions } from "./ITtscLintUnicornRuleOptions";
2
3
  /**
3
4
  * Modernization and style rules from `eslint-plugin-unicorn`.
4
5
  *
@@ -7,7 +8,8 @@ import type { TtscLintRuleSetting } from "../TtscLintRuleSetting";
7
8
  * counterparts, forbid known anti-patterns, and pin a consistent style for
8
9
  * things ESLint core and `typescript/*` leave underspecified.
9
10
  *
10
- * Pure-AST; no checker dependencies.
11
+ * Most rules are pure AST checks. Binding-aware rules use the TypeScript
12
+ * checker when lexical identity is part of the upstream contract.
11
13
  *
12
14
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn
13
15
  */
@@ -18,7 +20,7 @@ export interface ITtscLintUnicornRules {
18
20
  *
19
21
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/better-regex.md
20
22
  */
21
- "unicorn/better-regex"?: TtscLintRuleSetting;
23
+ "unicorn/better-regex"?: TtscLintRuleOptionsSetting<ITtscLintUnicornBetterRegexRuleOptions>;
22
24
  /**
23
25
  * Enforce a canonical parameter name (`error`) in `catch` clauses.
24
26
  *
@@ -53,8 +55,9 @@ export interface ITtscLintUnicornRules {
53
55
  */
54
56
  "unicorn/consistent-empty-array-spread"?: TtscLintRuleSetting;
55
57
  /**
56
- * Enforce a consistent comparison form (`< 0` vs `=== -1`, `>= 0` vs `!==
57
- * -1`) for `indexOf` / `findIndex` existence checks.
58
+ * Compare a `const` bound to `indexOf` / `lastIndexOf` / `findIndex` /
59
+ * `findLastIndex` against the `-1` sentinel (`=== -1` / `!== -1`) rather than
60
+ * against zero (`< 0`, `>= 0`, `> -1`).
58
61
  *
59
62
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-existence-index-check.md
60
63
  */
@@ -65,10 +68,10 @@ export interface ITtscLintUnicornRules {
65
68
  *
66
69
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-function-scoping.md
67
70
  */
68
- "unicorn/consistent-function-scoping"?: TtscLintRuleSetting;
71
+ "unicorn/consistent-function-scoping"?: TtscLintRuleOptionsSetting<ITtscLintUnicornConsistentFunctionScopingRuleOptions>;
69
72
  /**
70
- * Enforce a consistent style (always `\${` or always `$\{`) when escaping
71
- * `${` in template literals.
73
+ * Enforce the `\${` spelling over `$\{` when escaping `${` in template
74
+ * literals.
72
75
  *
73
76
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-template-literal-escape.md
74
77
  */
@@ -116,25 +119,26 @@ export interface ITtscLintUnicornRules {
116
119
  "unicorn/explicit-length-check"?: TtscLintRuleSetting;
117
120
  /**
118
121
  * Enforce a single case style (kebab / camel / snake / pascal) for source
119
- * filenames.
122
+ * filenames and directory names.
120
123
  *
121
124
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
122
125
  */
123
- "unicorn/filename-case"?: TtscLintRuleSetting;
126
+ "unicorn/filename-case"?: TtscLintRuleOptionsSetting<ITtscLintUnicornFilenameCaseRuleOptions>;
124
127
  /**
125
128
  * Restrict each module's allowed import styles (named only, default only,
126
129
  * namespace only).
127
130
  *
128
131
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/import-style.md
129
132
  */
130
- "unicorn/import-style"?: TtscLintRuleSetting;
133
+ "unicorn/import-style"?: TtscLintRuleOptionsSetting<ITtscLintUnicornImportStyleRuleOptions>;
131
134
  /**
132
- * Reject references to outer-scope variables inside functions marked as
133
- * isolated (e.g., the body of a web worker).
135
+ * Reject references to outer-scope variables (and `this` / `super`) inside
136
+ * functions that run outside their defining context (e.g., the body of a web
137
+ * worker or a `page.evaluate` payload).
134
138
  *
135
139
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/isolated-functions.md
136
140
  */
137
- "unicorn/isolated-functions"?: TtscLintRuleSetting;
141
+ "unicorn/isolated-functions"?: TtscLintRuleOptionsSetting<ITtscLintUnicornIsolatedFunctionsRuleOptions>;
138
142
  /**
139
143
  * Require `new` when calling builtin constructors like `Error`, `Map`, `Set`,
140
144
  * `Date` — and forbid `new` on primitive wrappers like `String`, `Number`,
@@ -387,7 +391,7 @@ export interface ITtscLintUnicornRules {
387
391
  *
388
392
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-typeof-undefined.md
389
393
  */
390
- "unicorn/no-typeof-undefined"?: TtscLintRuleSetting;
394
+ "unicorn/no-typeof-undefined"?: TtscLintRuleOptionsSetting<ITtscLintUnicornNoTypeofUndefinedRuleOptions>;
391
395
  /**
392
396
  * Reject `1` as the explicit depth argument of `Array#flat`; the default is
393
397
  * already `1`.
@@ -414,7 +418,7 @@ export interface ITtscLintUnicornRules {
414
418
  *
415
419
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-polyfills.md
416
420
  */
417
- "unicorn/no-unnecessary-polyfills"?: TtscLintRuleSetting;
421
+ "unicorn/no-unnecessary-polyfills"?: TtscLintRuleOptionsSetting<ITtscLintUnicornNoUnnecessaryPolyfillsRuleOptions>;
418
422
  /**
419
423
  * Reject `.length` / `Infinity` as the end argument to `slice`; omit it to
420
424
  * slice to the end.
@@ -512,8 +516,8 @@ export interface ITtscLintUnicornRules {
512
516
  */
513
517
  "unicorn/no-zero-fractions"?: TtscLintRuleSetting;
514
518
  /**
515
- * Enforce one consistent case for the prefix and digits of hex / binary /
516
- * octal literals (`0xFF` over `0xff`).
519
+ * Enforce one consistent case for a numeric literal's radix prefix, hex
520
+ * digits, and exponent (`0xFF` over `0xff`, `1e10` over `1E10`).
517
521
  *
518
522
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/number-literal-case.md
519
523
  */
@@ -757,7 +761,7 @@ export interface ITtscLintUnicornRules {
757
761
  *
758
762
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-properties.md
759
763
  */
760
- "unicorn/prefer-number-properties"?: TtscLintRuleSetting;
764
+ "unicorn/prefer-number-properties"?: TtscLintRuleOptionsSetting<ITtscLintUnicornPreferNumberPropertiesRuleOptions>;
761
765
  /**
762
766
  * Prefer `Object.fromEntries` over `reduce`-into-object patterns.
763
767
  *
@@ -819,8 +823,8 @@ export interface ITtscLintUnicornRules {
819
823
  */
820
824
  "unicorn/prefer-set-size"?: TtscLintRuleSetting;
821
825
  /**
822
- * Prefer the simpler operand on the left of `&&` / `||` so the short-circuit
823
- * reads in evaluation order.
826
+ * Place identifier and strict-comparison gates before complex conditions in
827
+ * boolean `&&` / `||` chains, preserving short-circuit evaluation safety.
824
828
  *
825
829
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-simple-condition-first.md
826
830
  */
@@ -908,12 +912,14 @@ export interface ITtscLintUnicornRules {
908
912
  */
909
913
  "unicorn/prefer-type-error"?: TtscLintRuleSetting;
910
914
  /**
911
- * Reject common identifier abbreviations (`btn`, `arr`, `idx`) and replace
912
- * them with their long forms.
915
+ * Replace discouraged words in bindings, compound names, properties, and
916
+ * filenames according to the canonical replacement table. The legacy rule ID
917
+ * retains the final upstream behavior from before its June 2026 rename to
918
+ * `name-replacements`.
913
919
  *
914
- * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prevent-abbreviations.md
920
+ * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/42abe74908e8/docs/rules/prevent-abbreviations.md
915
921
  */
916
- "unicorn/prevent-abbreviations"?: TtscLintRuleSetting;
922
+ "unicorn/prevent-abbreviations"?: TtscLintRuleOptionsSetting<ITtscLintUnicornPreventAbbreviationsRuleOptions>;
917
923
  /**
918
924
  * Enforce a single style (always leading `./` vs. never) for relative URLs
919
925
  * passed to `new URL`.
@@ -954,12 +960,13 @@ export interface ITtscLintUnicornRules {
954
960
  */
955
961
  "unicorn/require-post-message-target-origin"?: TtscLintRuleSetting;
956
962
  /**
957
- * Enforce or replace configured string-content patterns (e.g., curly quotes
958
- * for straight ones).
963
+ * Rewrite configured `patterns` inside string literals and template quasis
964
+ * (e.g., curly quotes for straight ones). No default patterns: a bare
965
+ * severity reports nothing.
959
966
  *
960
967
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/string-content.md
961
968
  */
962
- "unicorn/string-content"?: TtscLintRuleSetting;
969
+ "unicorn/string-content"?: TtscLintRuleOptionsSetting<ITtscLintUnicornStringContentRuleOptions>;
963
970
  /**
964
971
  * Enforce a consistent presence/absence of `{}` braces around `case` clauses
965
972
  * inside `switch`.
@@ -968,26 +975,27 @@ export interface ITtscLintUnicornRules {
968
975
  */
969
976
  "unicorn/switch-case-braces"?: TtscLintRuleSetting;
970
977
  /**
971
- * Enforce a consistent position for `break` (or `return` / `throw`) inside
972
- * `case` clauses.
978
+ * Require a terminating `break`, `continue`, `return`, or `throw` to sit
979
+ * inside a `case` clause's sole block instead of immediately after it.
973
980
  *
974
981
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/switch-case-break-position.md
975
982
  */
976
983
  "unicorn/switch-case-break-position"?: TtscLintRuleSetting;
977
984
  /**
978
- * Re-indent the body of tagged template literals (`html`, `gql`, `sql`) to
979
- * the indentation of the opening backtick.
985
+ * Normalize selected multiline template bodies while preserving substitutions
986
+ * and raw escape spelling.
980
987
  *
981
988
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/template-indent.md
982
989
  */
983
- "unicorn/template-indent"?: TtscLintRuleSetting;
990
+ "unicorn/template-indent"?: TtscLintRuleOptionsSetting<ITtscLintUnicornTemplateIndentRuleOptions>;
984
991
  /**
985
- * Enforce a canonical case for text-encoding identifiers `"utf-8"` (not
986
- * `"UTF-8"` / `"utf8"`).
992
+ * Enforce canonical text-encoding identifiers: dash-less `"utf8"` by default,
993
+ * dashed `"utf-8"` for APIs that require it or when `withDash` is enabled,
994
+ * and lowercase `"ascii"`.
987
995
  *
988
996
  * @reference https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/text-encoding-identifier-case.md
989
997
  */
990
- "unicorn/text-encoding-identifier-case"?: TtscLintRuleSetting;
998
+ "unicorn/text-encoding-identifier-case"?: TtscLintRuleOptionsSetting<ITtscLintUnicornTextEncodingIdentifierCaseRuleOptions>;
991
999
  /**
992
1000
  * Require `throw new Error(...)` over `throw Error(...)`.
993
1001
  *
@@ -1,6 +1,7 @@
1
1
  export * from "./ITtscLintBoundariesRuleOptions";
2
2
  export * from "./ITtscLintBoundariesRules";
3
3
  export * from "./ITtscLintContributorRules";
4
+ export * from "./ITtscLintCoreRuleOptions";
4
5
  export * from "./ITtscLintCoreRules";
5
6
  export * from "./ITtscLintCypressRuleOptions";
6
7
  export * from "./ITtscLintCypressRules";
@@ -26,6 +27,8 @@ export * from "./ITtscLintStorybookRules";
26
27
  export * from "./ITtscLintTanstackQueryRules";
27
28
  export * from "./ITtscLintTestingLibraryRuleOptions";
28
29
  export * from "./ITtscLintTestingLibraryRules";
30
+ export * from "./ITtscLintTypeScriptRuleOptions";
29
31
  export * from "./ITtscLintTypeScriptRules";
32
+ export * from "./ITtscLintUnicornRuleOptions";
30
33
  export * from "./ITtscLintUnicornRules";
31
34
  export * from "./ITtscLintVitestRules";
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./ITtscLintBoundariesRuleOptions"), exports);
18
18
  __exportStar(require("./ITtscLintBoundariesRules"), exports);
19
19
  __exportStar(require("./ITtscLintContributorRules"), exports);
20
+ __exportStar(require("./ITtscLintCoreRuleOptions"), exports);
20
21
  __exportStar(require("./ITtscLintCoreRules"), exports);
21
22
  __exportStar(require("./ITtscLintCypressRuleOptions"), exports);
22
23
  __exportStar(require("./ITtscLintCypressRules"), exports);
@@ -42,7 +43,9 @@ __exportStar(require("./ITtscLintStorybookRules"), exports);
42
43
  __exportStar(require("./ITtscLintTanstackQueryRules"), exports);
43
44
  __exportStar(require("./ITtscLintTestingLibraryRuleOptions"), exports);
44
45
  __exportStar(require("./ITtscLintTestingLibraryRules"), exports);
46
+ __exportStar(require("./ITtscLintTypeScriptRuleOptions"), exports);
45
47
  __exportStar(require("./ITtscLintTypeScriptRules"), exports);
48
+ __exportStar(require("./ITtscLintUnicornRuleOptions"), exports);
46
49
  __exportStar(require("./ITtscLintUnicornRules"), exports);
47
50
  __exportStar(require("./ITtscLintVitestRules"), exports);
48
51
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structures/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,6DAA2C;AAC3C,8DAA4C;AAC5C,uDAAqC;AACrC,gEAA8C;AAC9C,0DAAwC;AACxC,mEAAiD;AACjD,6DAA2C;AAC3C,uDAAqC;AACrC,wDAAsC;AACtC,0DAAwC;AACxC,yDAAuC;AACvC,6DAA2C;AAC3C,0DAAwC;AACxC,kEAAgD;AAChD,4DAA0C;AAC1C,8DAA4C;AAC5C,wDAAsC;AACtC,yDAAuC;AACvC,4DAA0C;AAC1C,mDAAiC;AACjC,2DAAyC;AACzC,wDAAsC;AACtC,kEAAgD;AAChD,4DAA0C;AAC1C,gEAA8C;AAC9C,uEAAqD;AACrD,iEAA+C;AAC/C,6DAA2C;AAC3C,0DAAwC;AACxC,yDAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structures/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,6DAA2C;AAC3C,8DAA4C;AAC5C,6DAA2C;AAC3C,uDAAqC;AACrC,gEAA8C;AAC9C,0DAAwC;AACxC,mEAAiD;AACjD,6DAA2C;AAC3C,uDAAqC;AACrC,wDAAsC;AACtC,0DAAwC;AACxC,yDAAuC;AACvC,6DAA2C;AAC3C,0DAAwC;AACxC,kEAAgD;AAChD,4DAA0C;AAC1C,8DAA4C;AAC5C,wDAAsC;AACtC,yDAAuC;AACvC,4DAA0C;AAC1C,mDAAiC;AACjC,2DAAyC;AACzC,wDAAsC;AACtC,kEAAgD;AAChD,4DAA0C;AAC1C,gEAA8C;AAC9C,uEAAqD;AACrD,iEAA+C;AAC/C,mEAAiD;AACjD,6DAA2C;AAC3C,gEAA8C;AAC9C,0DAAwC;AACxC,yDAAuC"}