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