@ttsc/lint 0.18.3 → 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.
- package/README.md +95 -43
- package/go.mod +5 -4
- package/internal/rulecode/rulecode.go +88 -0
- package/lib/index.d.ts +10 -1
- package/lib/index.js +45 -17
- package/lib/index.js.map +1 -1
- package/lib/structures/ITtscLintConfig.d.ts +3 -0
- package/lib/structures/TtscLintRuleSetting.d.ts +3 -2
- package/lib/structures/format/ITtscLintFormat.d.ts +3 -2
- package/lib/structures/format/ITtscLintFormatSortImports.d.ts +20 -4
- package/lib/structures/rules/ITtscLintBoundariesRuleOptions.d.ts +80 -8
- package/lib/structures/rules/ITtscLintBoundariesRules.d.ts +6 -8
- package/lib/structures/rules/ITtscLintContributorRules.d.ts +18 -2
- package/lib/structures/rules/ITtscLintCoreRuleOptions.d.ts +347 -0
- package/lib/structures/rules/ITtscLintCoreRuleOptions.js +3 -0
- package/lib/structures/rules/ITtscLintCoreRuleOptions.js.map +1 -0
- package/lib/structures/rules/ITtscLintCoreRules.d.ts +101 -67
- package/lib/structures/rules/ITtscLintRegexpRules.d.ts +7 -2
- package/lib/structures/rules/ITtscLintRuleOptionsMap.d.ts +53 -7
- package/lib/structures/rules/ITtscLintRules.d.ts +6 -2
- package/lib/structures/rules/ITtscLintSolidRules.d.ts +0 -8
- package/lib/structures/rules/ITtscLintTypeScriptRuleOptions.d.ts +206 -0
- package/lib/structures/rules/ITtscLintTypeScriptRuleOptions.js +8 -0
- package/lib/structures/rules/ITtscLintTypeScriptRuleOptions.js.map +1 -0
- package/lib/structures/rules/ITtscLintTypeScriptRules.d.ts +55 -42
- package/lib/structures/rules/ITtscLintUnicornRuleOptions.d.ts +276 -0
- package/lib/structures/rules/ITtscLintUnicornRuleOptions.js +3 -0
- package/lib/structures/rules/ITtscLintUnicornRuleOptions.js.map +1 -0
- package/lib/structures/rules/ITtscLintUnicornRules.d.ts +44 -36
- package/lib/structures/rules/index.d.ts +3 -0
- package/lib/structures/rules/index.js +3 -0
- package/lib/structures/rules/index.js.map +1 -1
- package/linthost/ast_helpers.go +521 -23
- package/linthost/ast_selector_matcher.go +1628 -0
- package/linthost/ast_selector_parser.go +628 -0
- package/linthost/comment_scan.go +154 -0
- package/linthost/compile.go +129 -79
- package/linthost/config.go +352 -88
- package/linthost/config_format.go +15 -1
- package/linthost/contrib_adapter.go +129 -25
- package/linthost/declaration_rules.go +12 -11
- package/linthost/directives.go +9 -67
- package/linthost/dispatch.go +37 -3
- package/linthost/engine.go +368 -53
- package/linthost/escape_string.go +77 -0
- package/linthost/fix.go +133 -23
- package/linthost/flags_gen.go +18 -17
- package/linthost/format.go +73 -167
- package/linthost/format_editor_settings.go +134 -26
- package/linthost/grapheme_tables_gen.go +1920 -0
- package/linthost/host.go +160 -61
- package/linthost/literal_escape_scan.go +117 -0
- package/linthost/lsp.go +545 -98
- package/linthost/numeric_literal_precision.go +228 -0
- package/linthost/polyfill_browserslist.go +1439 -0
- package/linthost/polyfill_browserslist_config.go +603 -0
- package/linthost/polyfill_corejs.go +750 -0
- package/linthost/polyfill_data.go +113 -0
- package/linthost/polyfill_data_gen.json +39868 -0
- package/linthost/print_nodes_array.go +7 -1
- package/linthost/print_nodes_object.go +7 -1
- package/linthost/project_engine.go +151 -0
- package/linthost/project_rules.go +78 -0
- package/linthost/regex_clean.go +191 -0
- package/linthost/regex_tree.go +1544 -0
- package/linthost/regex_tree_optimizer.go +1685 -0
- package/linthost/regexp_cache.go +44 -0
- package/linthost/rule_codes.go +105 -0
- package/linthost/rule_codes.json +745 -0
- package/linthost/rules_ban_ts_comment.go +312 -0
- package/linthost/rules_boundaries.go +128 -43
- package/linthost/rules_boundaries_dependencies.go +1013 -0
- package/linthost/rules_core_extra.go +62 -92
- package/linthost/rules_cypress.go +1 -1
- package/linthost/rules_default_case.go +87 -11
- package/linthost/rules_dupes.go +38 -13
- package/linthost/rules_empty.go +188 -20
- package/linthost/rules_escape.go +62 -48
- package/linthost/rules_format_arrow_parens.go +19 -5
- package/linthost/rules_format_bracket_spacing.go +1 -1
- package/linthost/rules_format_clause_join.go +1 -1
- package/linthost/rules_format_declaration_header.go +31 -19
- package/linthost/rules_format_indent.go +1 -1
- package/linthost/rules_format_jsdoc.go +1 -1
- package/linthost/rules_format_orphan_semi.go +1 -1
- package/linthost/rules_format_parameter_properties.go +17 -7
- package/linthost/rules_format_print_width.go +1 -1
- package/linthost/rules_format_quote_props.go +1 -1
- package/linthost/rules_format_quotes.go +1 -1
- package/linthost/rules_format_semi.go +106 -79
- package/linthost/rules_format_sort_imports.go +79 -45
- package/linthost/rules_format_statement_split.go +1 -1
- package/linthost/rules_format_ternary_nullish_parens.go +1 -1
- package/linthost/rules_format_trailing_comma.go +64 -1
- package/linthost/rules_format_whitespace.go +1 -1
- package/linthost/rules_functional.go +21 -22
- package/linthost/rules_gap.go +80 -3
- package/linthost/rules_grouped_accessor_pairs.go +84 -25
- package/linthost/rules_guard_for_in.go +64 -147
- package/linthost/rules_jsx_a11y.go +232 -22
- package/linthost/rules_logic.go +84 -38
- package/linthost/rules_nextjs.go +105 -16
- package/linthost/rules_no_class_assign.go +70 -0
- package/linthost/rules_no_duplicate_imports.go +266 -0
- package/linthost/rules_no_else_return.go +156 -38
- package/linthost/rules_no_extend_native.go +113 -17
- package/linthost/rules_no_fallthrough.go +1013 -0
- package/linthost/rules_no_func_assign.go +70 -0
- package/linthost/rules_no_import_assign.go +278 -86
- package/linthost/rules_no_inner_declarations.go +186 -0
- package/linthost/rules_no_loop_func.go +438 -53
- package/linthost/rules_no_mixed_operators.go +208 -52
- package/linthost/rules_no_param_reassign.go +376 -61
- package/linthost/rules_no_promise_executor_return.go +156 -0
- package/linthost/rules_no_restricted_imports.go +1013 -57
- package/linthost/rules_no_restricted_syntax.go +190 -26
- package/linthost/rules_no_useless_constructor.go +6 -36
- package/linthost/rules_problems.go +154 -311
- package/linthost/rules_promise.go +2578 -109
- package/linthost/rules_react_extras.go +71 -45
- package/linthost/rules_react_hooks.go +18 -2
- package/linthost/rules_react_perf.go +1 -0
- package/linthost/rules_react_refresh.go +1 -1
- package/linthost/rules_regexp.go +230 -14
- package/linthost/rules_security.go +45 -19
- package/linthost/rules_self.go +21 -1
- package/linthost/rules_solid.go +13 -7
- package/linthost/rules_storybook.go +1 -1
- package/linthost/rules_suggestions.go +490 -84
- package/linthost/rules_testing_library.go +12 -1
- package/linthost/rules_ts.go +227 -54
- package/linthost/rules_ts_async.go +0 -131
- package/linthost/rules_ts_no_base_to_string.go +3 -4
- package/linthost/rules_ts_no_misused_promises.go +817 -0
- package/linthost/rules_ts_no_restricted_types.go +320 -34
- package/linthost/rules_ts_no_unnecessary_qualifier.go +132 -55
- package/linthost/rules_ts_no_unsafe_assignment.go +608 -60
- package/linthost/rules_ts_require_array_sort_compare.go +5 -5
- package/linthost/rules_ts_switch_exhaustiveness_check.go +556 -86
- package/linthost/rules_unicorn_better_regex.go +224 -16
- package/linthost/rules_unicorn_consistent_destructuring.go +1002 -7
- package/linthost/rules_unicorn_consistent_existence_index_check.go +208 -29
- package/linthost/rules_unicorn_consistent_function_scoping.go +1041 -8
- package/linthost/rules_unicorn_consistent_template_literal_escape.go +178 -7
- package/linthost/rules_unicorn_escape_case.go +30 -19
- package/linthost/rules_unicorn_filename_case.go +763 -16
- package/linthost/rules_unicorn_import_style.go +783 -17
- package/linthost/rules_unicorn_isolated_functions.go +934 -14
- package/linthost/rules_unicorn_no_hex_escape.go +26 -11
- package/linthost/rules_unicorn_no_typeof_undefined.go +234 -25
- package/linthost/rules_unicorn_no_unnecessary_polyfills.go +376 -21
- package/linthost/rules_unicorn_no_unused_properties.go +756 -19
- package/linthost/rules_unicorn_number_literal_case.go +58 -39
- package/linthost/rules_unicorn_prefer_at.go +7 -3
- package/linthost/rules_unicorn_prefer_number_properties.go +381 -48
- package/linthost/rules_unicorn_prefer_optional_catch_binding.go +24 -24
- package/linthost/rules_unicorn_prefer_simple_condition_first.go +597 -19
- package/linthost/rules_unicorn_prefer_string_raw.go +147 -16
- package/linthost/rules_unicorn_prevent_abbreviations.go +1963 -95
- package/linthost/rules_unicorn_string_content.go +611 -15
- package/linthost/rules_unicorn_switch_case_break_position.go +172 -15
- package/linthost/rules_unicorn_template_indent.go +923 -18
- package/linthost/rules_unicorn_text_encoding_identifier_case.go +202 -42
- package/linthost/rules_unicorn_throw_new_error.go +218 -26
- package/linthost/rules_var.go +829 -142
- package/linthost/string_length.go +222 -0
- package/package.json +4 -3
- package/rule/project.go +145 -0
- package/rule/rule.go +58 -1
- package/src/index.ts +58 -17
- package/src/structures/ITtscLintConfig.ts +3 -0
- package/src/structures/TtscLintRuleSetting.ts +3 -2
- package/src/structures/format/ITtscLintFormat.ts +3 -2
- package/src/structures/format/ITtscLintFormatSortImports.ts +21 -4
- package/src/structures/rules/ITtscLintBoundariesRuleOptions.ts +122 -8
- package/src/structures/rules/ITtscLintBoundariesRules.ts +6 -8
- package/src/structures/rules/ITtscLintContributorRules.ts +18 -2
- package/src/structures/rules/ITtscLintCoreRuleOptions.ts +465 -0
- package/src/structures/rules/ITtscLintCoreRules.ts +122 -67
- package/src/structures/rules/ITtscLintRegexpRules.ts +7 -2
- package/src/structures/rules/ITtscLintRuleOptionsMap.ts +88 -7
- package/src/structures/rules/ITtscLintRules.ts +7 -2
- package/src/structures/rules/ITtscLintSolidRules.ts +0 -9
- package/src/structures/rules/ITtscLintTypeScriptRuleOptions.ts +248 -0
- package/src/structures/rules/ITtscLintTypeScriptRules.ts +64 -42
- package/src/structures/rules/ITtscLintUnicornRuleOptions.ts +350 -0
- package/src/structures/rules/ITtscLintUnicornRules.ts +60 -36
- package/src/structures/rules/index.ts +3 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options shapes for the configurable rules in {@link ITtscLintTypeScriptRules}.
|
|
3
|
+
*
|
|
4
|
+
* @reference https://typescript-eslint.io/rules/
|
|
5
|
+
*/
|
|
6
|
+
/** Identifies a type or value declared in a project file. */
|
|
7
|
+
export interface ITtscLintFileTypeOrValueSpecifier {
|
|
8
|
+
/** Select project-file declarations. */
|
|
9
|
+
from: "file";
|
|
10
|
+
/** Match one or more declared names. */
|
|
11
|
+
name: string | readonly string[];
|
|
12
|
+
/** Restrict the match to this project-relative declaration file. */
|
|
13
|
+
path?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Identifies a type or value declared by TypeScript's default libraries. */
|
|
16
|
+
export interface ITtscLintLibTypeOrValueSpecifier {
|
|
17
|
+
/** Select TypeScript default-library declarations. */
|
|
18
|
+
from: "lib";
|
|
19
|
+
/** Match one or more declared names. */
|
|
20
|
+
name: string | readonly string[];
|
|
21
|
+
}
|
|
22
|
+
/** Identifies a type or value declared by an installed package. */
|
|
23
|
+
export interface ITtscLintPackageTypeOrValueSpecifier {
|
|
24
|
+
/** Select package declarations. */
|
|
25
|
+
from: "package";
|
|
26
|
+
/** Match one or more declared names. */
|
|
27
|
+
name: string | readonly string[];
|
|
28
|
+
/** Require declarations from this package or ambient module. */
|
|
29
|
+
package: string;
|
|
30
|
+
}
|
|
31
|
+
/** Identifies a type or value by name and, preferably, declaration source. */
|
|
32
|
+
export type TtscLintTypeOrValueSpecifier = string | ITtscLintFileTypeOrValueSpecifier | ITtscLintLibTypeOrValueSpecifier | ITtscLintPackageTypeOrValueSpecifier;
|
|
33
|
+
/** One structured replacement policy in `typescript/no-restricted-types`. */
|
|
34
|
+
export interface ITtscLintTypeScriptNoRestrictedTypesTypeConfig {
|
|
35
|
+
/** Custom text appended to the standard diagnostic. */
|
|
36
|
+
message: string;
|
|
37
|
+
/** Replacement applied automatically by `ttsc fix`. */
|
|
38
|
+
fixWith?: string;
|
|
39
|
+
/** Replacement choices exposed as opt-in editor suggestions. */
|
|
40
|
+
suggest?: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
/** Policy value for one normalized type spelling. */
|
|
43
|
+
export type TtscLintTypeScriptNoRestrictedTypesTypeValue = boolean | string | ITtscLintTypeScriptNoRestrictedTypesTypeConfig | null;
|
|
44
|
+
/** Options for `typescript/no-restricted-types`. */
|
|
45
|
+
export interface ITtscLintTypeScriptNoRestrictedTypesRuleOptions {
|
|
46
|
+
/**
|
|
47
|
+
* Type spellings to reject. Whitespace is ignored in both keys and source
|
|
48
|
+
* spellings; `false` and `null` entries explicitly disable a key.
|
|
49
|
+
*/
|
|
50
|
+
types?: Readonly<Record<string, TtscLintTypeScriptNoRestrictedTypesTypeValue>>;
|
|
51
|
+
}
|
|
52
|
+
/** Options for `typescript/no-floating-promises`. */
|
|
53
|
+
export interface ITtscLintTypeScriptNoFloatingPromisesRuleOptions {
|
|
54
|
+
/** Functions whose returned Promises may be discarded safely. */
|
|
55
|
+
allowForKnownSafeCalls?: readonly TtscLintTypeOrValueSpecifier[];
|
|
56
|
+
/** Promise types whose values may be discarded safely. */
|
|
57
|
+
allowForKnownSafePromises?: readonly TtscLintTypeOrValueSpecifier[];
|
|
58
|
+
/** Also inspect catchable structural thenables. Defaults to `false`. */
|
|
59
|
+
checkThenables?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Ignore immediately invoked function-expression results. Defaults to
|
|
62
|
+
* `false`.
|
|
63
|
+
*/
|
|
64
|
+
ignoreIIFE?: boolean;
|
|
65
|
+
/** Treat `void` as an explicit discard marker. Defaults to `true`. */
|
|
66
|
+
ignoreVoid?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Policy for one `@ts-<directive>` comment kind in `typescript/ban-ts-comment`.
|
|
70
|
+
*
|
|
71
|
+
* - `true` — report every use of the directive.
|
|
72
|
+
* - `false` — allow the directive unconditionally.
|
|
73
|
+
* - `"allow-with-description"` — allow the directive when it is followed by a
|
|
74
|
+
* description of at least `minimumDescriptionLength` characters.
|
|
75
|
+
* - `{ descriptionFormat }` — additionally require the description to match the
|
|
76
|
+
* given regular expression (evaluated with Go's RE2 `regexp` syntax, which
|
|
77
|
+
* covers the usual patterns such as `"^: TS\\d+ because .+$"`).
|
|
78
|
+
*/
|
|
79
|
+
export type TtscLintTypeScriptBanTsCommentDirectiveConfig = boolean | "allow-with-description" | {
|
|
80
|
+
/**
|
|
81
|
+
* Regular expression the directive description must match. Matched
|
|
82
|
+
* against the raw text following the directive, including its leading
|
|
83
|
+
* whitespace, so anchored patterns usually start with `^: `.
|
|
84
|
+
*/
|
|
85
|
+
descriptionFormat: string;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* `typescript/ban-ts-comment` rule options.
|
|
89
|
+
*
|
|
90
|
+
* Absent directive keys keep the upstream recommended defaults: `@ts-check` is
|
|
91
|
+
* allowed, `@ts-expect-error` is allowed with a description, and `@ts-ignore` /
|
|
92
|
+
* `@ts-nocheck` are reported.
|
|
93
|
+
*/
|
|
94
|
+
export interface ITtscLintTypeScriptBanTsCommentRuleOptions {
|
|
95
|
+
/**
|
|
96
|
+
* Minimum description length (counted in Unicode 16.0 extended grapheme
|
|
97
|
+
* clusters, so one emoji is one character) for directives configured as
|
|
98
|
+
* `"allow-with-description"` or `{ descriptionFormat }`.
|
|
99
|
+
*
|
|
100
|
+
* @default 3
|
|
101
|
+
*/
|
|
102
|
+
minimumDescriptionLength?: number;
|
|
103
|
+
/**
|
|
104
|
+
* Policy for `@ts-check` pragma comments.
|
|
105
|
+
*
|
|
106
|
+
* @default false
|
|
107
|
+
*/
|
|
108
|
+
"ts-check"?: TtscLintTypeScriptBanTsCommentDirectiveConfig;
|
|
109
|
+
/**
|
|
110
|
+
* Policy for `@ts-expect-error` directive comments.
|
|
111
|
+
*
|
|
112
|
+
* @default "allow-with-description"
|
|
113
|
+
*/
|
|
114
|
+
"ts-expect-error"?: TtscLintTypeScriptBanTsCommentDirectiveConfig;
|
|
115
|
+
/**
|
|
116
|
+
* Policy for `@ts-ignore` directive comments.
|
|
117
|
+
*
|
|
118
|
+
* @default true
|
|
119
|
+
*/
|
|
120
|
+
"ts-ignore"?: TtscLintTypeScriptBanTsCommentDirectiveConfig;
|
|
121
|
+
/**
|
|
122
|
+
* Policy for `@ts-nocheck` pragma comments.
|
|
123
|
+
*
|
|
124
|
+
* @default true
|
|
125
|
+
*/
|
|
126
|
+
"ts-nocheck"?: TtscLintTypeScriptBanTsCommentDirectiveConfig;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Positions governed by `checksVoidReturn` in `typescript/no-misused-promises`.
|
|
130
|
+
*
|
|
131
|
+
* Omitted keys default to `true`.
|
|
132
|
+
*/
|
|
133
|
+
export interface ITtscLintTypeScriptNoMisusedPromisesChecksVoidReturnOptions {
|
|
134
|
+
/** Check Promise-returning callbacks passed as call/construct arguments. */
|
|
135
|
+
arguments?: boolean;
|
|
136
|
+
/** Check Promise-returning JSX attribute expressions. */
|
|
137
|
+
attributes?: boolean;
|
|
138
|
+
/** Check Promise-returning methods against extended/implemented types. */
|
|
139
|
+
inheritedMethods?: boolean;
|
|
140
|
+
/** Check Promise-returning functions in contextually typed properties. */
|
|
141
|
+
properties?: boolean;
|
|
142
|
+
/** Check Promise-returning functions returned from void-function factories. */
|
|
143
|
+
returns?: boolean;
|
|
144
|
+
/** Check Promise-returning functions assigned to variables. */
|
|
145
|
+
variables?: boolean;
|
|
146
|
+
}
|
|
147
|
+
/** `typescript/no-misused-promises` rule options. */
|
|
148
|
+
export interface ITtscLintTypeScriptNoMisusedPromisesRuleOptions {
|
|
149
|
+
/**
|
|
150
|
+
* Check thenables used in boolean condition and predicate positions.
|
|
151
|
+
*
|
|
152
|
+
* @default true
|
|
153
|
+
*/
|
|
154
|
+
checksConditionals?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Check thenables spread into object literals.
|
|
157
|
+
*
|
|
158
|
+
* @default true
|
|
159
|
+
*/
|
|
160
|
+
checksSpreads?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Check Promise-returning functions where a void return is expected.
|
|
163
|
+
*
|
|
164
|
+
* @default true
|
|
165
|
+
*/
|
|
166
|
+
checksVoidReturn?: boolean | ITtscLintTypeScriptNoMisusedPromisesChecksVoidReturnOptions;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* `typescript/switch-exhaustiveness-check` rule options.
|
|
170
|
+
*
|
|
171
|
+
* The defaults require every enumerable union member to have an explicit
|
|
172
|
+
* `case`, allow a redundant `default` on an already exhaustive switch, and do
|
|
173
|
+
* not require a `default` for open types such as `string` or `number`.
|
|
174
|
+
*
|
|
175
|
+
* @reference https://typescript-eslint.io/rules/switch-exhaustiveness-check
|
|
176
|
+
*/
|
|
177
|
+
export interface ITtscLintTypeScriptSwitchExhaustivenessCheckRuleOptions {
|
|
178
|
+
/**
|
|
179
|
+
* Allow a `default` clause on a switch whose finite members are already
|
|
180
|
+
* covered explicitly.
|
|
181
|
+
*
|
|
182
|
+
* @default true
|
|
183
|
+
*/
|
|
184
|
+
allowDefaultCaseForExhaustiveSwitch?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Treat a real `default` clause or matching trailing comment as coverage for
|
|
187
|
+
* otherwise missing finite members.
|
|
188
|
+
*
|
|
189
|
+
* @default false
|
|
190
|
+
*/
|
|
191
|
+
considerDefaultExhaustiveForUnions?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Regular expression matched against the trimmed body of the last comment
|
|
194
|
+
* after the final `case`. The default marker is `/^no default$/iu`.
|
|
195
|
+
*
|
|
196
|
+
* Custom patterns use Go's RE2 `regexp` syntax.
|
|
197
|
+
*/
|
|
198
|
+
defaultCaseCommentPattern?: string;
|
|
199
|
+
/**
|
|
200
|
+
* Require a real `default` clause or matching trailing comment when the
|
|
201
|
+
* discriminant contains an open, non-literal type.
|
|
202
|
+
*
|
|
203
|
+
* @default false
|
|
204
|
+
*/
|
|
205
|
+
requireDefaultForNonUnion?: boolean;
|
|
206
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Options shapes for the configurable rules in {@link ITtscLintTypeScriptRules}.
|
|
4
|
+
*
|
|
5
|
+
* @reference https://typescript-eslint.io/rules/
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
//# sourceMappingURL=ITtscLintTypeScriptRuleOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ITtscLintTypeScriptRuleOptions.js","sourceRoot":"","sources":["../../../src/structures/rules/ITtscLintTypeScriptRuleOptions.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { TtscLintRuleSetting } from "../TtscLintRuleSetting";
|
|
1
|
+
import type { TtscLintRuleOptionsSetting, TtscLintRuleSetting } from "../TtscLintRuleSetting";
|
|
2
|
+
import type { ITtscLintTypeScriptBanTsCommentRuleOptions, ITtscLintTypeScriptNoFloatingPromisesRuleOptions, ITtscLintTypeScriptNoMisusedPromisesRuleOptions, ITtscLintTypeScriptNoRestrictedTypesRuleOptions, ITtscLintTypeScriptSwitchExhaustivenessCheckRuleOptions } from "./ITtscLintTypeScriptRuleOptions";
|
|
2
3
|
/**
|
|
3
4
|
* TypeScript-only rules and `@typescript-eslint` plugin equivalents, exposed
|
|
4
5
|
* under the `typescript/*` namespace.
|
|
@@ -38,24 +39,33 @@ export interface ITtscLintTypeScriptRules {
|
|
|
38
39
|
*/
|
|
39
40
|
"typescript/array-type"?: TtscLintRuleSetting;
|
|
40
41
|
/**
|
|
41
|
-
* Reject `await`
|
|
42
|
+
* Reject non-awaitable ordinary `await` operands and native Promise
|
|
43
|
+
* aggregator members.
|
|
42
44
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
+
* Also reject sync-only `for await...of` and `await using` constructs.
|
|
46
|
+
*
|
|
47
|
+
* Type-aware. The Checker resolves Promise and well-known-symbol protocols,
|
|
48
|
+
* including each Promise aggregator input's synchronous iterator yield type.
|
|
49
|
+
* Ordinary `await` findings offer an opt-in editor suggestion, while
|
|
50
|
+
* automatic fix and fix-all paths leave the source unchanged.
|
|
45
51
|
*
|
|
46
52
|
* @reference https://typescript-eslint.io/rules/await-thenable
|
|
47
53
|
*/
|
|
48
54
|
"typescript/await-thenable"?: TtscLintRuleSetting;
|
|
49
55
|
/**
|
|
50
|
-
* Reject `@ts
|
|
56
|
+
* Reject `@ts-<directive>` comments, or require them to carry a description.
|
|
51
57
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
58
|
+
* With the upstream recommended defaults, `@ts-ignore` and `@ts-nocheck` are
|
|
59
|
+
* reported, `@ts-check` is allowed, and `@ts-expect-error` is allowed when
|
|
60
|
+
* followed by a description of at least three characters. Each directive is
|
|
61
|
+
* individually configurable as `boolean`, `"allow-with-description"`, or `{
|
|
62
|
+
* descriptionFormat }`, with `minimumDescriptionLength` governing the
|
|
63
|
+
* description-required forms. Banned `@ts-ignore` findings offer replacement
|
|
64
|
+
* with `@ts-expect-error` only as an opt-in editor suggestion.
|
|
55
65
|
*
|
|
56
66
|
* @reference https://typescript-eslint.io/rules/ban-ts-comment
|
|
57
67
|
*/
|
|
58
|
-
"typescript/ban-ts-comment"?:
|
|
68
|
+
"typescript/ban-ts-comment"?: TtscLintRuleOptionsSetting<ITtscLintTypeScriptBanTsCommentRuleOptions>;
|
|
59
69
|
/**
|
|
60
70
|
* Reject `// tslint:disable` and related TSLint directive comments left
|
|
61
71
|
* behind from the legacy TSLint era.
|
|
@@ -278,12 +288,13 @@ export interface ITtscLintTypeScriptRules {
|
|
|
278
288
|
*
|
|
279
289
|
* Type-aware via the Checker. A floating promise loses its rejection channel
|
|
280
290
|
* and runs out of order with surrounding code. Acceptable sinks are `await`,
|
|
281
|
-
*
|
|
282
|
-
* `
|
|
291
|
+
* callable rejection handlers, assignment, the `void` operator by default,
|
|
292
|
+
* and `return`. A `.finally(...)` call is clean only when its receiver was
|
|
293
|
+
* already handled.
|
|
283
294
|
*
|
|
284
295
|
* @reference https://typescript-eslint.io/rules/no-floating-promises
|
|
285
296
|
*/
|
|
286
|
-
"typescript/no-floating-promises"?:
|
|
297
|
+
"typescript/no-floating-promises"?: TtscLintRuleOptionsSetting<ITtscLintTypeScriptNoFloatingPromisesRuleOptions>;
|
|
287
298
|
/**
|
|
288
299
|
* Reject `for (const k in arr)` where `arr` is statically typed as an array
|
|
289
300
|
* or tuple.
|
|
@@ -355,15 +366,13 @@ export interface ITtscLintTypeScriptRules {
|
|
|
355
366
|
/**
|
|
356
367
|
* Reject Promise values supplied where a non-Promise was expected.
|
|
357
368
|
*
|
|
358
|
-
* Covers conditional
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
* `Array#forEach`, JSX event handlers), where the returned Promise is
|
|
362
|
-
* silently dropped.
|
|
369
|
+
* Covers conditional and predicate positions, Promise object spreads,
|
|
370
|
+
* synchronous disposal, and Promise-returning functions in void-return
|
|
371
|
+
* argument, JSX, inherited-method, property, return, and variable contexts.
|
|
363
372
|
*
|
|
364
373
|
* @reference https://typescript-eslint.io/rules/no-misused-promises
|
|
365
374
|
*/
|
|
366
|
-
"typescript/no-misused-promises"?:
|
|
375
|
+
"typescript/no-misused-promises"?: TtscLintRuleOptionsSetting<ITtscLintTypeScriptNoMisusedPromisesRuleOptions>;
|
|
367
376
|
/**
|
|
368
377
|
* Reject spread expressions whose operand is syntactically wrong for the
|
|
369
378
|
* surrounding context.
|
|
@@ -434,19 +443,13 @@ export interface ITtscLintTypeScriptRules {
|
|
|
434
443
|
*/
|
|
435
444
|
"typescript/no-redundant-type-constituents"?: TtscLintRuleSetting;
|
|
436
445
|
/**
|
|
437
|
-
* Reject
|
|
438
|
-
*
|
|
439
|
-
* and
|
|
440
|
-
* explicit call signatures convey the intended type without the
|
|
441
|
-
* runtime-boxing semantics that the wrapper names imply.
|
|
442
|
-
*
|
|
443
|
-
* AST-only baseline: shadow guard reuses the same file-scope check as
|
|
444
|
-
* `no-wrapper-object-types` so a user-declared `interface String {}` is not
|
|
445
|
-
* flagged as the global wrapper.
|
|
446
|
+
* Reject the exact type spellings configured in the `types` map. The rule is
|
|
447
|
+
* a no-op without options. Entries can carry a custom message, an automatic
|
|
448
|
+
* replacement, and editor-only replacement suggestions.
|
|
446
449
|
*
|
|
447
450
|
* @reference https://typescript-eslint.io/rules/no-restricted-types
|
|
448
451
|
*/
|
|
449
|
-
"typescript/no-restricted-types"?:
|
|
452
|
+
"typescript/no-restricted-types"?: TtscLintRuleOptionsSetting<ITtscLintTypeScriptNoRestrictedTypesRuleOptions>;
|
|
450
453
|
/**
|
|
451
454
|
* Reject `require(...)` calls and `import x = require(...)` declarations.
|
|
452
455
|
*
|
|
@@ -559,7 +562,8 @@ export interface ITtscLintTypeScriptRules {
|
|
|
559
562
|
"typescript/no-unnecessary-type-assertion"?: TtscLintRuleSetting;
|
|
560
563
|
/**
|
|
561
564
|
* Reject `<T extends unknown>` and similar constraints that match everything.
|
|
562
|
-
* Autofixable: drops the constraint
|
|
565
|
+
* Autofixable: drops the constraint while retaining the disambiguating comma
|
|
566
|
+
* required by single-parameter generic arrows in TSX, MTS, and CTS files.
|
|
563
567
|
*
|
|
564
568
|
* @reference https://typescript-eslint.io/rules/no-unnecessary-type-constraint
|
|
565
569
|
*/
|
|
@@ -575,11 +579,14 @@ export interface ITtscLintTypeScriptRules {
|
|
|
575
579
|
*/
|
|
576
580
|
"typescript/no-unsafe-argument"?: TtscLintRuleSetting;
|
|
577
581
|
/**
|
|
578
|
-
* Reject
|
|
579
|
-
*
|
|
580
|
-
*
|
|
582
|
+
* Reject direct and nested `any` values escaping through assignment
|
|
583
|
+
* boundaries. Covers annotated and inferred variables, reassignments,
|
|
584
|
+
* defaults, class members, contextual properties, spreads, and
|
|
585
|
+
* destructuring.
|
|
581
586
|
*
|
|
582
|
-
* Type-aware via the Checker.
|
|
587
|
+
* Type-aware via the Checker. Matching generic references are compared
|
|
588
|
+
* recursively with cycle protection. `any` may flow into `unknown`, including
|
|
589
|
+
* a corresponding nested generic argument. The rule has no options.
|
|
583
590
|
*
|
|
584
591
|
* @reference https://typescript-eslint.io/rules/no-unsafe-assignment
|
|
585
592
|
*/
|
|
@@ -724,7 +731,12 @@ export interface ITtscLintTypeScriptRules {
|
|
|
724
731
|
*/
|
|
725
732
|
"typescript/parameter-properties"?: TtscLintRuleSetting;
|
|
726
733
|
/**
|
|
727
|
-
* Prefer `as const` over `as "literal"
|
|
734
|
+
* Prefer `as const` over literal type assertions (`as "literal"`,
|
|
735
|
+
* `<"literal">`) and matching literal type annotations on variable and
|
|
736
|
+
* class-property declarations. Literals are compared by raw source spelling.
|
|
737
|
+
* Assertions are autofixable. Annotation findings expose an editor quick fix
|
|
738
|
+
* that removes the annotation and appends `as const`; `ttsc fix` never
|
|
739
|
+
* applies that suggestion automatically.
|
|
728
740
|
*
|
|
729
741
|
* @reference https://typescript-eslint.io/rules/prefer-as-const
|
|
730
742
|
*/
|
|
@@ -1022,18 +1034,19 @@ export interface ITtscLintTypeScriptRules {
|
|
|
1022
1034
|
*/
|
|
1023
1035
|
"typescript/strict-boolean-expressions"?: TtscLintRuleSetting;
|
|
1024
1036
|
/**
|
|
1025
|
-
* Require every member of a
|
|
1026
|
-
* explicit `case
|
|
1037
|
+
* Require every enumerable member of a discriminant to be covered by an
|
|
1038
|
+
* explicit `case`.
|
|
1027
1039
|
*
|
|
1028
|
-
* Type-aware via the Checker.
|
|
1029
|
-
*
|
|
1030
|
-
*
|
|
1031
|
-
*
|
|
1032
|
-
*
|
|
1040
|
+
* Type-aware via the Checker. Singleton literals, literal unions, enums,
|
|
1041
|
+
* nullish members, bigint and boolean literals, unique symbols, constrained
|
|
1042
|
+
* generics, and literal pieces of intersections are enumerable. Open
|
|
1043
|
+
* primitive pieces remain unenumerated without hiding adjacent finite
|
|
1044
|
+
* members. Under the default options, a `default` clause does not replace
|
|
1045
|
+
* explicit finite-member coverage.
|
|
1033
1046
|
*
|
|
1034
1047
|
* @reference https://typescript-eslint.io/rules/switch-exhaustiveness-check
|
|
1035
1048
|
*/
|
|
1036
|
-
"typescript/switch-exhaustiveness-check"?:
|
|
1049
|
+
"typescript/switch-exhaustiveness-check"?: TtscLintRuleOptionsSetting<ITtscLintTypeScriptSwitchExhaustivenessCheckRuleOptions>;
|
|
1037
1050
|
/**
|
|
1038
1051
|
* Reject `/// <reference path="..." />`, `/// <reference types="" />`, and
|
|
1039
1052
|
* `/// <reference lib="" />` directives.
|