@inthedark/dxlint 0.1.4 → 0.1.6
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/bin/dxlint-linux-x64 +0 -0
- package/bin/dxlint-win32-x64.exe +0 -0
- package/package.json +1 -1
- package/std/ts/constants.dx +1 -1
- package/std/ts/expressions.dx +2 -2
- package/std/ts/layout/blocks.dx +16 -4
- package/std/ts/modules.dx +14 -2
- package/std/ts/names.dx +10 -1
- package/std/ts/problems/control-flow.dx +18 -7
- package/std/ts/problems/duplicates.dx +1 -1
- package/std/ts/problems/imports.dx +2 -1
- package/std/ts/restrictions.dx +4 -4
- package/std/ts/scoping/globals.dx +1 -1
- package/std/ts/scoping.dx +2 -2
- package/std/ts/structure/padding.dx +2 -0
- package/std/ts/structure.dx +1 -1
- package/std/ts/style/classes.dx +1 -1
- package/std/ts/style/comments.dx +34 -1
- package/std/ts/style/declarations.dx +1 -1
- package/std/ts/style/expressions.dx +10 -10
- package/std/ts/style/returns.dx +2 -2
- package/std/ts/style/signatures.dx +11 -11
- package/std/ts/style/types.dx +6 -6
- package/std/ts/suggestions/computed-keys.dx +1 -1
- package/std/ts/suggestions/control-flow.dx +1 -1
- package/std/ts/suggestions/curly.dx +22 -5
- package/std/ts/suggestions/errors.dx +2 -2
- package/std/ts/suggestions/expressions.dx +2 -2
- package/std/ts/suggestions/helpers.dx +1 -1
- package/std/ts/typed/optional-chains.dx +4 -4
- package/std/ts/typed/type-arguments.dx +17 -6
- package/std/ts/typed/type-conversions.dx +1 -1
- package/std/ts/values.dx +13 -9
package/bin/dxlint-linux-x64
CHANGED
|
Binary file
|
package/bin/dxlint-win32-x64.exe
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/std/ts/constants.dx
CHANGED
|
@@ -182,7 +182,7 @@ fn ts_constant_identity(n, operator) = {
|
|
|
182
182
|
walk (current) {
|
|
183
183
|
value bare: unparenthesised_node(current)
|
|
184
184
|
value when {
|
|
185
|
-
bare is ts_logical && bare.operator == operator then [bare.left.node, bare.right.node]
|
|
185
|
+
bare is ts_logical && "{bare.operator}" == "{operator}" then [bare.left.node, bare.right.node]
|
|
186
186
|
bare is ts_assignment && contains(["||=", "&&="], bare.operator)
|
|
187
187
|
&& slice(bare.operator, 0, 2) == operator then bare.right.node
|
|
188
188
|
else then null
|
package/std/ts/expressions.dx
CHANGED
|
@@ -128,7 +128,7 @@ fn logical_reference(n) = n != null && !logical_chain_top(n) && (n is (ts_member
|
|
|
128
128
|
fn logical_same_reference(a, b) = a.reference_key != null && a.reference_key == b.reference_key
|
|
129
129
|
fn logical_nullish(n) = if n is ts_null then false else if n is ts_identifier && n.text == "undefined" && n.resolved == "global" || n is ts_unary && n.operator == "void" && unparenthesised_node(n.argument.node) is ts_number && unparenthesised_node(n.argument.node).literal_value.value == 0 then true else null
|
|
130
130
|
fn logical_nullish_reference(reference, value) = if logical_reference(reference) && logical_nullish(value) != null then { reference: reference, undefined: logical_nullish(value), operator: "??" } else null
|
|
131
|
-
fn logical_nullish_comparison(n, op) = if n is ts_binary && n.operator == op then {
|
|
131
|
+
fn logical_nullish_comparison(n, op) = if n is ts_binary && "{n.operator}" == "{op}" then {
|
|
132
132
|
value n.left.node
|
|
133
133
|
reference: unparenthesised_node
|
|
134
134
|
value n.right.node
|
|
@@ -165,7 +165,7 @@ fn logical_existence(n) = {
|
|
|
165
165
|
} else null
|
|
166
166
|
fn logical_leftmost(value) = {
|
|
167
167
|
value value.left.node
|
|
168
|
-
walk (current) if current is ts_logical && current.operator == value.operator then current.left.node else null
|
|
168
|
+
walk (current) if current is ts_logical && "{current.operator}" == "{value.operator}" then current.left.node else null
|
|
169
169
|
last
|
|
170
170
|
}
|
|
171
171
|
fn logical_assignment_value(assigned, value) = if value is ts_logical && { value value; logical_leftmost: logical_leftmost; value logical_same_reference(assigned, logical_leftmost) } then { kind: "assignment", operator: value.operator "=" } else null
|
package/std/ts/layout/blocks.dx
CHANGED
|
@@ -242,6 +242,12 @@ in ts_colon rule es-switch-colon-spacing:after {
|
|
|
242
242
|
warn if after then "Expected space(s) after this colon." else "Unexpected space(s) after this colon."
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
+
# One level of indentation: a tab where the file indents with tabs, else the
|
|
246
|
+
# file's first indentation (two spaces if it has none).
|
|
247
|
+
fn layout_indent_unit(source) = if re_test(source, /\n\t/) then "\t" else {
|
|
248
|
+
value found: re_find(source, /\n +\S/)
|
|
249
|
+
value if found == null then " " else byte_slice(found, 1, byte_len(found) - 1)
|
|
250
|
+
}
|
|
245
251
|
@macro layout_brace_options {
|
|
246
252
|
default option style "1tbs" | "stroustrup" | "allman" = "1tbs" "brace layout"
|
|
247
253
|
option allowSingleLine boolean = false "allow single-line block bodies"
|
|
@@ -252,21 +258,26 @@ in ts_open_brace rule es-brace-style:open {
|
|
|
252
258
|
@layout_brace_options
|
|
253
259
|
when previous_token != null
|
|
254
260
|
when if style == "allman" then !space_before.line_break && !(allowSingleLine && parent.layout_brace_single) else space_before.line_break
|
|
255
|
-
|
|
261
|
+
let layout_open_start if style == "allman" && space_before.comments then offset else token_neighbours.before.end
|
|
262
|
+
fix at { start: layout_open_start, end: offset } if style == "allman" || !space_before.comments as if style == "allman" then "\n" indent else " "
|
|
256
263
|
warn if style == "allman" then "Opening curly brace appears on the same line as controlling statement." else "Opening curly brace does not appear on the same line as controlling statement."
|
|
257
264
|
}
|
|
258
265
|
in ts_open_brace rule es-brace-style:body {
|
|
259
266
|
@layout_brace_options
|
|
260
267
|
when next_token not ts_close_brace
|
|
261
268
|
when !space_after.line_break && !(allowSingleLine && parent.layout_brace_single)
|
|
262
|
-
|
|
269
|
+
# Unlike upstream's bare line break, the statement lands indented and the
|
|
270
|
+
# space before it goes.
|
|
271
|
+
let layout_body_end end_offset + byte_len(re_find(byte_slice(source, end_offset, token(node, "after").start), /^[ \t]*/) ?? "")
|
|
272
|
+
fix at { start: end_offset, end: layout_body_end } as "\n" indent layout_indent_unit(source)
|
|
263
273
|
warn "Statement inside of curly braces should be on next line."
|
|
264
274
|
}
|
|
265
275
|
in ts_close_brace rule es-brace-style:close {
|
|
266
276
|
@layout_brace_options
|
|
267
277
|
when previous_token not ts_open_brace
|
|
268
278
|
when !space_before.line_break && !(allowSingleLine && parent.layout_brace_single)
|
|
269
|
-
|
|
279
|
+
let layout_close_start offset - byte_len(re_find(byte_slice(source, token(node, "before").end, offset), /[ \t]*$/) ?? "")
|
|
280
|
+
fix at { start: layout_close_start, end: offset } as "\n" (opener.indent ?? indent)
|
|
270
281
|
warn "Closing curly brace should be on the same line as opening curly brace or on the line after the previous block."
|
|
271
282
|
}
|
|
272
283
|
in ts_close_brace rule es-brace-style:keyword {
|
|
@@ -274,7 +285,8 @@ in ts_close_brace rule es-brace-style:keyword {
|
|
|
274
285
|
when parent.layout_brace_keyword.nonempty ?? false
|
|
275
286
|
when contains(["else", "catch", "finally"], token(node, "after").text)
|
|
276
287
|
when space_after.line_break == (style == "1tbs")
|
|
277
|
-
|
|
288
|
+
let layout_keyword_end if style == "1tbs" || !space_after.comments then token(node, "after").start else end_offset
|
|
289
|
+
fix at { start: end_offset, end: layout_keyword_end } if style != "1tbs" || !space_after.comments as if style == "1tbs" then " " else "\n" indent
|
|
278
290
|
warn if style == "1tbs" then "Closing curly brace does not appear on the same line as the subsequent block." else "Closing curly brace appears on the same line as the subsequent block."
|
|
279
291
|
}
|
|
280
292
|
|
package/std/ts/modules.dx
CHANGED
|
@@ -37,7 +37,19 @@ import .ts/comments
|
|
|
37
37
|
star_excludes ["default", "="]
|
|
38
38
|
search order
|
|
39
39
|
globals {
|
|
40
|
-
|
|
40
|
+
# TypeScript 7 ships them in its platform package instead.
|
|
41
|
+
libraries [
|
|
42
|
+
"{{package_dir}}/typescript/lib/lib.{{name:lower}}.d.ts",
|
|
43
|
+
"{{package_dir}}/@typescript/typescript-win32-x64/lib/lib.{{name:lower}}.d.ts",
|
|
44
|
+
"{{package_dir}}/@typescript/typescript-win32-arm64/lib/lib.{{name:lower}}.d.ts",
|
|
45
|
+
"{{package_dir}}/@typescript/typescript-linux-x64/lib/lib.{{name:lower}}.d.ts",
|
|
46
|
+
"{{package_dir}}/@typescript/typescript-linux-arm64/lib/lib.{{name:lower}}.d.ts",
|
|
47
|
+
"{{package_dir}}/@typescript/typescript-linux-arm/lib/lib.{{name:lower}}.d.ts",
|
|
48
|
+
"{{package_dir}}/@typescript/typescript-darwin-x64/lib/lib.{{name:lower}}.d.ts",
|
|
49
|
+
"{{package_dir}}/@typescript/typescript-darwin-arm64/lib/lib.{{name:lower}}.d.ts",
|
|
50
|
+
]
|
|
51
|
+
# `/// <reference lib="x" />` asks for `lib:x`, wherever the release keeps it.
|
|
52
|
+
library_prefix "lib:"
|
|
41
53
|
library_option "lib"
|
|
42
54
|
default_libraries ["es2023", "dom"]
|
|
43
55
|
types_option "types"
|
|
@@ -256,7 +268,7 @@ in ts_reference_path let ts_module_path_reference {
|
|
|
256
268
|
|| re_test(path, /^[A-Za-z]:\//) then path else "./{path}"
|
|
257
269
|
}
|
|
258
270
|
in ts_reference_types let ts_module_types_reference "@types/{ts_module_reference}"
|
|
259
|
-
in ts_reference_lib let ts_module_lib_reference "
|
|
271
|
+
in ts_reference_lib let ts_module_lib_reference "lib:{ts_module_reference}"
|
|
260
272
|
in ts_reference_path {
|
|
261
273
|
globals all value, type, query from module ts_module_path_reference
|
|
262
274
|
}
|
package/std/ts/names.dx
CHANGED
|
@@ -85,6 +85,11 @@ in ts_rest { targets argument }
|
|
|
85
85
|
in ts_function, ts_arrow, ts_method, ts_function_type, ts_method_signature, ts_call_signature {
|
|
86
86
|
declares value, query parameter in nearest function hoisted
|
|
87
87
|
}
|
|
88
|
+
# Other files see these bodies only by entering them: the declared return
|
|
89
|
+
# type (or a constructor's or setter's role) stands for what they do, so an
|
|
90
|
+
# edit inside one concerns only the files that stepped in.
|
|
91
|
+
in ts_function, ts_arrow { opaque body when return_type != null }
|
|
92
|
+
in ts_method { opaque body when return_type != null || kind == "constructor" || kind == "set" }
|
|
88
93
|
in ts_parameter { targets name }
|
|
89
94
|
in ts_function, ts_method { declares value, query "arguments" in nearest function hoisted }
|
|
90
95
|
# A declaration's name lands in the enclosing block; an expression's only
|
|
@@ -142,9 +147,13 @@ in ts_identifier {
|
|
|
142
147
|
# `[key: string]: T` names nothing.
|
|
143
148
|
|| is ts_parameter.name && parent is ts_index_signature.parameter) {
|
|
144
149
|
when ts_name_outside_method != null { resolves value outside ts_name_outside_method }
|
|
145
|
-
when ts_name_outside_method == null { resolves value }
|
|
150
|
+
when ts_name_outside_method == null && !ts_name_type_key { resolves value }
|
|
151
|
+
# A computed key inside type syntax reads like `typeof`: type-only
|
|
152
|
+
# imports count.
|
|
153
|
+
when ts_name_outside_method == null && ts_name_type_key { resolves query }
|
|
146
154
|
}
|
|
147
155
|
}
|
|
156
|
+
in ts_identifier let ts_name_type_key name_type_access && containing(ts_computed_key) != null
|
|
148
157
|
in ts_type_reference { resolves type name }
|
|
149
158
|
# `export { x }` uses `x`; `export { x } from "m"` does not.
|
|
150
159
|
in ts_export_specifier { when parent.from == null { resolves value, type local } }
|
|
@@ -50,15 +50,15 @@ in ts_while.test, ts_do_while.test, ts_for.test rule es-no-constant-condition:lo
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
fn problem_condition_parts(n, operator) = {
|
|
53
|
-
value walk(unparenthesised_node(n), part => if part is ts_logical && part.operator == operator
|
|
53
|
+
value walk(unparenthesised_node(n), part => if part is ts_logical && "{part.operator}" == "{operator}"
|
|
54
54
|
then [unparenthesised_node(part.left.node), unparenthesised_node(part.right.node)] else [])
|
|
55
|
-
filter (part) part not ts_logical || part.operator != operator
|
|
55
|
+
filter (part) part not ts_logical || "{part.operator}" != "{operator}"
|
|
56
56
|
}
|
|
57
57
|
fn problem_condition_equal(a, b) = {
|
|
58
58
|
value left: unparenthesised_node(a)
|
|
59
59
|
value right: unparenthesised_node(b)
|
|
60
60
|
value kind_name(left) == kind_name(right) && (if left is ts_logical
|
|
61
|
-
&& contains(["&&", "||"], left.operator) && left.operator == right.operator then
|
|
61
|
+
&& contains(["&&", "||"], left.operator) && "{left.operator}" == "{right.operator}" then
|
|
62
62
|
problem_condition_equal(left.left.node, right.left.node) && problem_condition_equal(left.right.node, right.right.node)
|
|
63
63
|
|| problem_condition_equal(left.left.node, right.right.node) && problem_condition_equal(left.right.node, right.left.node)
|
|
64
64
|
else left.token_texts == right.token_texts)
|
|
@@ -220,15 +220,26 @@ in ts_switch {
|
|
|
220
220
|
# whose only statement is a block.
|
|
221
221
|
@macro last_comment(t) re_find(t, /(?:\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\/|\/\/[^\r\n]*)\s*$/)
|
|
222
222
|
@macro block_case /^\s*(?:case\b[\s\S]*?|default\s*):\s*\{([\s\S]*)\}\s*$/
|
|
223
|
-
|
|
223
|
+
# The previous case, not the previous sibling: comments are tree nodes (and
|
|
224
|
+
# siblings) when some rule targets comments.
|
|
225
|
+
in ts_case let previous_case { value parent.case.nodes; slice 0 index; last }
|
|
226
|
+
in ts_case let case_comment_in_block { value previous_case.text ?? ""; re_test @block_case }
|
|
224
227
|
in ts_case let case_comment_block_source
|
|
225
|
-
if case_comment_in_block then re_replace(
|
|
228
|
+
if case_comment_in_block then re_replace(previous_case.text, /\}\s*$/, "")
|
|
226
229
|
else ""
|
|
227
230
|
in ts_case let case_comment_in_block_text @last_comment(case_comment_block_source)
|
|
231
|
+
# Source between the previous case's last statement (or the case itself
|
|
232
|
+
# when empty) and this case, read from the text, comment nodes or not.
|
|
233
|
+
in ts_case let case_gap_start {
|
|
234
|
+
value previous: previous_case
|
|
235
|
+
value statement: last(previous.body.nodes)
|
|
236
|
+
value if statement != null then statement.end_offset else if previous != null then previous.end_offset else offset
|
|
237
|
+
}
|
|
238
|
+
in ts_case let case_gap byte_slice(source, case_gap_start, offset)
|
|
228
239
|
in ts_case let case_comment_source
|
|
229
|
-
if case_comment_in_block_text != null then case_comment_block_source else
|
|
240
|
+
if case_comment_in_block_text != null then case_comment_block_source else case_gap
|
|
230
241
|
in ts_case let case_comment @last_comment(case_comment_source)
|
|
231
|
-
in ts_case let case_comment_offset
|
|
242
|
+
in ts_case let case_comment_offset (if case_comment_in_block_text != null then previous_case.offset else case_gap_start) + byte_len(case_comment_source) - byte_len(case_comment.nonempty ?? "")
|
|
232
243
|
in ts_case rule es-no-fallthrough {
|
|
233
244
|
option allowEmptyCase boolean = false "allow empty cases separated by blank lines"
|
|
234
245
|
option commentPattern regex | null = null "comments that allow falling through (default: /falls?\\s?through/i)"
|
|
@@ -4,7 +4,7 @@ define {
|
|
|
4
4
|
|
|
5
5
|
# Getters and setters of one name pair up; anything else of the same name
|
|
6
6
|
# (in the same object, or the same static-ness of a class) is a duplicate.
|
|
7
|
-
in ts_method let accessor_kind if kind == "get" || kind == "set" then kind else "init"
|
|
7
|
+
in ts_method let accessor_kind if kind == "get" || kind == "set" then "{kind}" else "init"
|
|
8
8
|
in ts_property, ts_class_property let accessor_kind "init"
|
|
9
9
|
@macro duplicate_of(e) (e != null && e.name == static_name && (accessor_kind == "init" || e.kind == "init" || e.kind == accessor_kind))
|
|
10
10
|
# (`""` is a name: `type_of` tells it from null.)
|
|
@@ -28,7 +28,8 @@ in ts_call rule es-no-import-assign:call {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
in ts_import rule es-no-unassigned-import {
|
|
31
|
-
|
|
31
|
+
# `import type {} from` is erased: no side effect to question.
|
|
32
|
+
when default_import == null && namespace == null && count(specifier) == 0 && kind != "type"
|
|
32
33
|
warn "Imported module should be assigned"
|
|
33
34
|
}
|
|
34
35
|
|
package/std/ts/restrictions.dx
CHANGED
|
@@ -359,7 +359,7 @@ in ts_declarator rule es-sort-vars {
|
|
|
359
359
|
} as restriction_sorted_variables(bindings, ignoreCase)
|
|
360
360
|
}
|
|
361
361
|
in ts_identifier let restriction_sort_key_name text
|
|
362
|
-
in ts_computed_key let restriction_sort_key_name if expression is ts_identifier then expression else null
|
|
362
|
+
in ts_computed_key let restriction_sort_key_name if expression is ts_identifier then "{expression}" else null
|
|
363
363
|
in ts_property, ts_method {
|
|
364
364
|
let restriction_sort_computed key is ts_computed_key
|
|
365
365
|
let restriction_sort_key_fallback key.restriction_sort_key_name
|
|
@@ -438,7 +438,7 @@ in ts_call rule es-no-alert {
|
|
|
438
438
|
warn "Unexpected {name}."
|
|
439
439
|
}
|
|
440
440
|
in ts_labeled let restriction_target body.node
|
|
441
|
-
in ts_labeled let restriction_label_entry {name: label, target: restriction_target}
|
|
441
|
+
in ts_labeled let restriction_label_entry {name: "{label}", target: restriction_target}
|
|
442
442
|
in ts_statement, ts_case let restriction_label_targets (parent.restriction_label_targets.nonempty ?? []) (if is ts_labeled then [restriction_label_entry] else [])
|
|
443
443
|
in ts_break, ts_continue let restriction_target (find_last(restriction_label_targets, target => target.name == label)).target
|
|
444
444
|
in ts_labeled, ts_break, ts_continue let no_labels_checked true
|
|
@@ -639,7 +639,7 @@ in ts_property, ts_pattern_property {
|
|
|
639
639
|
let restriction_import_attribute_group parent.restriction_import_options == true && contains(["with", "assert"], static_name)
|
|
640
640
|
let restriction_name_pattern is ts_pattern_property || parent.flow_destructuring_target == true
|
|
641
641
|
let restriction_name_alias restriction_name_pattern && value != null && (value not ts_assignment_pattern || value.left != null)
|
|
642
|
-
let restriction_name_same value != null && key ==
|
|
642
|
+
let restriction_name_same value != null && "{key}" == "{value.left.nonempty ?? value}"
|
|
643
643
|
}
|
|
644
644
|
in ts_export_specifier {
|
|
645
645
|
let restriction_name_reexport parent.from != null
|
|
@@ -658,7 +658,7 @@ in ts_identifier, ts_private_name {
|
|
|
658
658
|
let restriction_name_assignment is ts_member.property && parent.write_site != null && parent.restriction_name_mutation
|
|
659
659
|
let restriction_name_renamed is ts_import_specifier.imported && parent.local != null || is ts_export_specifier.local && parent.restriction_name_export_alias && parent.restriction_name_reexport
|
|
660
660
|
let restriction_name_property is ts_node.key && (if restriction_name_pattern then !restriction_name_alias || restriction_name_same else parent is ts_property) || restriction_name_assignment
|
|
661
|
-
let restriction_name_length if parent is (ts_declarator, ts_parameter) then is (ts_declarator.name, ts_parameter.name) else if parent is ts_assignment_pattern then is ts_assignment_pattern.left else if restriction_name_pattern then (if is ts_node.key then !restriction_name_alias || restriction_name_same else !restriction_name_same) else if parent is ts_property then is ts_property.key else if parent is ts_import_specifier then is ts_import_specifier.local && (parent.imported.static_name.nonempty ?? parent.imported) != restriction_identifier_name else if parent is ts_import then is (ts_import.default_import, ts_import.namespace) else if parent is (ts_function, ts_arrow, ts_method, ts_class_property, ts_rest, ts_array_pattern) then true else if parent is ts_class then parent.restriction_name_declaration else if parent is ts_try then is ts_try.parameter else if parent is ts_member then restriction_name_assignment else false
|
|
661
|
+
let restriction_name_length if parent is (ts_declarator, ts_parameter) then is (ts_declarator.name, ts_parameter.name) else if parent is ts_assignment_pattern then is ts_assignment_pattern.left else if restriction_name_pattern then (if is ts_node.key then !restriction_name_alias || restriction_name_same else !restriction_name_same) else if parent is ts_property then is ts_property.key else if parent is ts_import_specifier then is ts_import_specifier.local && (parent.imported.static_name.nonempty ?? "{parent.imported}") != restriction_identifier_name else if parent is ts_import then is (ts_import.default_import, ts_import.namespace) else if parent is (ts_function, ts_arrow, ts_method, ts_class_property, ts_rest, ts_array_pattern) then true else if parent is ts_class then parent.restriction_name_declaration else if parent is ts_try then is ts_try.parameter else if parent is ts_member then restriction_name_assignment else false
|
|
662
662
|
}
|
|
663
663
|
in ts_identifier, ts_private_name rule es-id-denylist {
|
|
664
664
|
option names string[] = [] "restricted identifiers"
|
|
@@ -23,7 +23,7 @@ fn scoping_global_bindings(n) =
|
|
|
23
23
|
fn scoping_global_mentions(program) = {
|
|
24
24
|
value mentions: {
|
|
25
25
|
value ts_global_mentions(program)
|
|
26
|
-
map (mention) { name: mention.name, offset: mention.offset, comment: mention.comment }
|
|
26
|
+
map (mention) { name: "{mention.name}", offset: mention.offset, comment: mention.comment }
|
|
27
27
|
}
|
|
28
28
|
value roots: filter(program.scoping_lexical_scopes, scope => scoping_script_scope(scope) && scoping_value_scope(scope))
|
|
29
29
|
value script: ts_source_type(program) == "script"
|
package/std/ts/scoping.dx
CHANGED
|
@@ -50,7 +50,7 @@ in ts_node let arrow_callback_barrier
|
|
|
50
50
|
else is ts_super || is ts_meta_property && starts_with(text, "new") || any(children.arrow_callback_barrier, b => b == true)
|
|
51
51
|
fn arrow_callback_fix(source, n, lexical) = {
|
|
52
52
|
value parameters: n.parameter.nodes
|
|
53
|
-
value names: [] n.parameter.name
|
|
53
|
+
value names: map([] n.parameter.name, name => "{name}")
|
|
54
54
|
value distinct: unique(names)
|
|
55
55
|
value duplicates: count(distinct) != count(names)
|
|
56
56
|
value unsafe: n.body.scoping_receiver_read == true && !lexical || duplicates || first(names) == "this" || count(n.type_parameter) != 0
|
|
@@ -279,7 +279,7 @@ in ts_function rule es-func-name-matching {
|
|
|
279
279
|
when name != null && matched != null && target != null
|
|
280
280
|
when includeCommonJSModuleExports || !matched.commonjs
|
|
281
281
|
when descriptor_call || ts_identifier_name_valid(target)
|
|
282
|
-
when if mode == "always" then target != name else target == name
|
|
282
|
+
when if mode == "always" then "{target}" != "{name}" else "{target}" == "{name}"
|
|
283
283
|
report at matched.offset
|
|
284
284
|
warn "Function name `{name}` should{if mode == 'never' then ' not' else ''} match {if matched.property then 'property' else 'variable'} name `{target}`."
|
|
285
285
|
}
|
|
@@ -220,7 +220,9 @@ fn structure_padding_finding(source, pair, comments) = {
|
|
|
220
220
|
|
|
221
221
|
in structure_padding_owner rule es-padding-line-between-statements {
|
|
222
222
|
option options { blankLine: "any" | "always" | "never"; prev: string | { selector: string; lineMode?: "any" | "singleline" | "multiline" } | (string | { selector: string; lineMode?: "any" | "singleline" | "multiline" })[]; next: string | { selector: string; lineMode?: "any" | "singleline" | "multiline" } | (string | { selector: string; lineMode?: "any" | "singleline" | "multiline" })[] }[] = [] "ordered statement padding policies"
|
|
223
|
+
option typescriptBodies boolean = true "also pad namespace bodies, interfaces and type literals (false: only the statement lists ESLint core checks)"
|
|
223
224
|
when any(options, policy => policy.blankLine != "any")
|
|
225
|
+
when typescriptBodies || !(node is (ts_interface, ts_type_literal) || node is ts_block && parent is ts_namespace)
|
|
224
226
|
let prepared_options map(options, config => {
|
|
225
227
|
blankLine: config.blankLine,
|
|
226
228
|
prev: padding_prepare_selectors(config.prev),
|
package/std/ts/structure.dx
CHANGED
|
@@ -162,7 +162,7 @@ in ts_member rule es-dot-notation:keyword {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
in ts_conditional let structure_ternary_jsx if parent is ts_conditional then parent.structure_ternary_jsx else parent is ts_jsx_expression
|
|
165
|
-
in ts_binary, ts_logical let structure_operator operator
|
|
165
|
+
in ts_binary, ts_logical let structure_operator "{operator}"
|
|
166
166
|
in ts_conditional let structure_operator "?:"
|
|
167
167
|
in ts_binary, ts_logical let structure_operator_span { start: operator.offset, end: operator.end_offset }
|
|
168
168
|
in ts_conditional let structure_operator_span { start: (test.space_after).end, end: (test.space_after).end + 1 }
|
package/std/ts/style/classes.dx
CHANGED
|
@@ -134,7 +134,7 @@ in ts_class let no_extraneous_class_checked true
|
|
|
134
134
|
|
|
135
135
|
# Constructors that do nothing a missing one would not.
|
|
136
136
|
in ts_identifier let constructor_forwarding_key {spread: false, name: text}
|
|
137
|
-
in ts_rest, ts_spread let constructor_forwarding_key if argument is ts_identifier then {spread: true, name: argument} else null
|
|
137
|
+
in ts_rest, ts_spread let constructor_forwarding_key if argument is ts_identifier then {spread: true, name: "{argument}"} else null
|
|
138
138
|
in ts_parenthesized forward constructor_forwarding_key, constructor_super_call from expression
|
|
139
139
|
in ts_parameter let constructor_forwarding_key if init == null then name.constructor_forwarding_key else null
|
|
140
140
|
in ts_parameter let constructor_parameter_exempt is_parameter_property || count(decorator) > 0
|
package/std/ts/style/comments.dx
CHANGED
|
@@ -32,15 +32,48 @@ in ts_comment rule es-ban-linter-comment {
|
|
|
32
32
|
{ name: "eslint", pattern: /^(?:\/\/|\/\*)\s*eslint-(?:disable|enable)(?:-(?:line|next-line))?(?:\s|\*\/|$)/ },
|
|
33
33
|
{ name: "eslint", pattern: /^\/\*\s*(?:eslint|eslint-env|globals?|exported)(?:\s|\*\/)/ }
|
|
34
34
|
] "linter comments to report: a name for the message and a pattern over the whole comment"
|
|
35
|
+
option renames { [rule: string]: string } = {} "dxlint names for ESLint rule ids in converted suppressions, over the built-in mapping"
|
|
35
36
|
let format first(filter(formats, format => re_test(text, format.pattern)))
|
|
36
37
|
when format != null
|
|
37
38
|
let content re_replace(text, /^\/\/|^\/\*|\*\/$/, "")
|
|
38
39
|
let normalised re_replace(content, /^\s+|\s+$/, "")
|
|
39
|
-
|
|
40
|
+
# ESLint suppressions become dxlint's own; other linter comments go.
|
|
41
|
+
let suppression eslint_suppression(source, node, normalised, renames)
|
|
42
|
+
let edit if suppression == "keep" then null
|
|
43
|
+
else if suppression != null then { start: offset, end: end_offset, text: suppression } else linter_comment_edit(source, node)
|
|
40
44
|
warn "{format.name} comment detected: \"{if node is ts_line_comment then '// ' normalised else '/* ' normalised ' */'}\""
|
|
41
45
|
fix at edit if edit != null as edit.text
|
|
42
46
|
}
|
|
43
47
|
|
|
48
|
+
# `eslint-disable-next-line a, b -- why` as `dxlint-ignore es-a es-b`; the
|
|
49
|
+
# block forms become `dxlint-ignore-start` / `-end`. `dxlint-ignore` alone on
|
|
50
|
+
# its line covers the next line, after code its own: a next-line directive
|
|
51
|
+
# after code has no equivalent ("keep": reported, not fixed), and a same-line
|
|
52
|
+
# one alone on its line suppresses nothing (null: removed). Null for other
|
|
53
|
+
# comments too.
|
|
54
|
+
fn eslint_suppression(source, n, content, renames) = {
|
|
55
|
+
value kind: if re_test(content, /^eslint-(?:disable-next-line|disable-line|disable|enable)(?:\s|$)/)
|
|
56
|
+
then re_replace(content, /^eslint-(disable-next-line|disable-line|disable|enable)[\s\S]*$/, "$1") else null
|
|
57
|
+
value alone: re_test(byte_slice(source, position(n.offset).js_line_start, n.offset), /^[ \t]*$/)
|
|
58
|
+
value rest: re_replace(re_replace(content, /^eslint-[a-z-]+/, ""), /\s--[\s\S]*$/, "")
|
|
59
|
+
value ids: filter(split(trim(re_replace(rest, /[\s,]+/, " ")), " "), id => id != "")
|
|
60
|
+
value names: join(map(ids, id => " " eslint_rule_name(id, renames)))
|
|
61
|
+
value word: get({ disable: "dxlint-ignore-start", enable: "dxlint-ignore-end" }, kind ?? "")
|
|
62
|
+
?? (if kind == "disable-next-line" && alone || kind == "disable-line" && !alone then "dxlint-ignore" else null)
|
|
63
|
+
value if kind == "disable-next-line" && !alone then "keep"
|
|
64
|
+
else if word == null then null else if n is ts_line_comment then "// " word names else "/* " word names " */"
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
# An ESLint rule id as dxlint names it: the plugin goes (`@typescript-eslint/`,
|
|
68
|
+
# `import/`, ...), the language prefix comes.
|
|
69
|
+
fn eslint_rule_name(id, renames) = get(renames, id) ?? get({
|
|
70
|
+
"import/no-deprecated": "es-import-no-deprecated",
|
|
71
|
+
"license-header/header": "es-header"
|
|
72
|
+
}, id) ?? {
|
|
73
|
+
value bare: re_replace(id, /^.*\//, "")
|
|
74
|
+
value if contains(["eol-last", "linebreak-style", "no-trailing-spaces"], bare) then "shared-" bare else "es-" bare
|
|
75
|
+
}
|
|
76
|
+
|
|
44
77
|
# Only directives before the first code token are triple-slash references.
|
|
45
78
|
in ts_line_comment rule es-triple-slash-reference {
|
|
46
79
|
option lib ("always" | "never") = "always" "When lib directives are allowed."
|
|
@@ -72,7 +72,7 @@ in ts_declarator, ts_class_property, ts_parameter rule es-consistent-generic-con
|
|
|
72
72
|
let construction init.constructor_arguments
|
|
73
73
|
let annotation type.annotation_arguments
|
|
74
74
|
when construction != null
|
|
75
|
-
when if mode == "constructor" then annotation != null && annotation.name == construction.name && !annotation.typed_array && annotation.count > 0 && construction.count == 0 else type == null && construction.count > 0
|
|
75
|
+
when if mode == "constructor" then annotation != null && "{annotation.name}" == "{construction.name}" && !annotation.typed_array && annotation.count > 0 && construction.count == 0 else type == null && construction.count > 0
|
|
76
76
|
when mode != "constructor" || ts_compiler_option(node, "isolatedDeclarations") != true
|
|
77
77
|
let replacement generic_constructor_replacement(source, node, construction, annotation, mode)
|
|
78
78
|
warn if mode == "constructor" then "The generic type arguments should be specified as part of the constructor type arguments." else "The generic type arguments should be specified as part of the type annotation."
|
|
@@ -12,20 +12,20 @@ in ts_assignment rule es-no-multi-assign {
|
|
|
12
12
|
warn "Unexpected chained assignment."
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
in ts_member, ts_index let loop_collection_read if object not ts_this && write_site == null then object else null
|
|
15
|
+
in ts_member, ts_index let loop_collection_read if object not ts_this && write_site == null then "{object}" else null
|
|
16
16
|
in ts_identifier let loop_index_use { start: offset, end: end_offset, array: if is (ts_node.property, ts_node.index) then parent.loop_collection_read else null }
|
|
17
17
|
in ts_identifier let loop_index_uses [] references.loop_index_use
|
|
18
18
|
in ts_number let loop_zero literal_value.value == "0"
|
|
19
|
-
in ts_declarator let counted_loop_binding if name is ts_identifier && init.loop_zero == true then { name: name, uses: name.loop_index_uses } else null
|
|
19
|
+
in ts_declarator let counted_loop_binding if name is ts_identifier && init.loop_zero == true then { name: "{name}", uses: name.loop_index_uses } else null
|
|
20
20
|
in ts_variable_declaration let counted_loop_initialisation if kind != "const" && count(declaration) == 1 then first([] declaration.counted_loop_binding) else null
|
|
21
|
-
in ts_member let array_length_object if property is ts_identifier && property == "length" then object else null
|
|
22
|
-
in ts_index let array_length_object if index is ts_identifier && index == "length" then object else null
|
|
23
|
-
in ts_binary let counted_loop_test if operator == "<" then { name: left, array: right.array_length_object } else null
|
|
21
|
+
in ts_member let array_length_object if property is ts_identifier && property == "length" then "{object}" else null
|
|
22
|
+
in ts_index let array_length_object if index is ts_identifier && index == "length" then "{object}" else null
|
|
23
|
+
in ts_binary let counted_loop_test if operator == "<" then { name: "{left}", array: right.array_length_object } else null
|
|
24
24
|
in ts_number let loop_increment_unit literal_value.value == "1"
|
|
25
|
-
in ts_binary let counted_loop_increment if operator == "+" then { left: left, right: right, left_unit: left.loop_increment_unit, right_unit: right.loop_increment_unit } else null
|
|
26
|
-
in ts_update let incremented_loop_name if operator == "++" then argument else null
|
|
25
|
+
in ts_binary let counted_loop_increment if operator == "+" then { left: "{left}", right: "{right}", left_unit: left.loop_increment_unit, right_unit: right.loop_increment_unit } else null
|
|
26
|
+
in ts_update let incremented_loop_name if operator == "++" then "{argument}" else null
|
|
27
27
|
fn increments_name(sum, name) = sum != null && (sum.left == name && sum.right_unit == true || sum.right == name && sum.left_unit == true)
|
|
28
|
-
in ts_assignment let incremented_loop_name if operator == "+=" && right.loop_increment_unit == true || operator == "=" && increments_name(right.counted_loop_increment, left) then left else null
|
|
28
|
+
in ts_assignment let incremented_loop_name if operator == "+=" && right.loop_increment_unit == true || operator == "=" && increments_name(right.counted_loop_increment, "{left}") then "{left}" else null
|
|
29
29
|
in ts_for rule es-prefer-for-of {
|
|
30
30
|
let binding init.counted_loop_initialisation
|
|
31
31
|
let comparison test.counted_loop_test
|
|
@@ -37,7 +37,7 @@ in style_tree_node let assignment_node_start offset
|
|
|
37
37
|
in style_tree_node let assignment_call_start if parent is ts_parenthesized then parent.assignment_call_start else if parent is ts_call then parent.assignment_node_start else null
|
|
38
38
|
in ts_parenthesized let assignment_inner_start expression.assignment_value_start
|
|
39
39
|
in style_tree_node let assignment_value_start assignment_inner_start.nonempty ?? offset
|
|
40
|
-
in ts_parameter let assignment_property_name if is_parameter_property && name is ts_identifier then name else null
|
|
40
|
+
in ts_parameter let assignment_property_name if is_parameter_property && name is ts_identifier then "{name}" else null
|
|
41
41
|
in ts_method let assignment_constructor_properties [] parameter.assignment_property_name
|
|
42
42
|
in ts_method let assignment_is_constructor key == "constructor"
|
|
43
43
|
in ts_method, ts_function, ts_arrow let assignment_function_node { node: node, constructor: assignment_is_constructor == true, properties: assignment_constructor_properties.nonempty ?? [], call: if is ts_arrow then assignment_call_start else null, outer: parent.assignment_nearest_function }
|
|
@@ -47,7 +47,7 @@ in ts_class_property let assignment_property_node { init: init.assignment_value_
|
|
|
47
47
|
in style_tree_node let assignment_nearest_property if is ts_class_property then assignment_property_node else parent.assignment_nearest_property
|
|
48
48
|
in ts_identifier let assignment_parameter_value if reference_kind == "parameter" then text else null
|
|
49
49
|
in ts_as, ts_non_null, ts_parenthesized let assignment_parameter_value expression.assignment_parameter_value
|
|
50
|
-
in ts_member let assignment_this_name if object is ts_this then property else null
|
|
50
|
+
in ts_member let assignment_this_name if object is ts_this then "{property}" else null
|
|
51
51
|
in ts_index let assignment_this_name if object is ts_this then index.static_name else null
|
|
52
52
|
fn assignment_constructor(owner) = owner.node is ts_method && owner.constructor
|
|
53
53
|
fn assignment_field_initialiser(owner, property) = property != null && (owner == null || owner.node is ts_arrow && owner.call == property.init)
|
package/std/ts/style/returns.dx
CHANGED
|
@@ -107,11 +107,11 @@ in style_tree_node let boundary_parent_name if parent is ts_parenthesized then p
|
|
|
107
107
|
in ts_function let boundary_function_name if return_declaration then name.nonempty ?? "" else boundary_parent_name.nonempty ?? ""
|
|
108
108
|
in ts_arrow let boundary_function_name boundary_parent_name.nonempty ?? ""
|
|
109
109
|
in ts_method let boundary_function_name member_static_name.nonempty ?? ""
|
|
110
|
-
in ts_function, ts_method let boundary_overload_entry { name: boundary_function_name, empty: body == null, exported: parent is ts_export, default: parent.boundary_default_export == true }
|
|
110
|
+
in ts_function, ts_method let boundary_overload_entry { name: "{boundary_function_name}", empty: body == null, exported: parent is ts_export, default: parent.boundary_default_export == true }
|
|
111
111
|
in ts_export let boundary_default_export kind == "default"
|
|
112
112
|
in ts_export let boundary_overload_entry declaration.boundary_overload_entry
|
|
113
113
|
in style_tree_node let boundary_overload_entries if is ts_export then parent.boundary_overload_entries else [] children.boundary_overload_entry
|
|
114
|
-
in ts_function, ts_arrow, ts_method let boundary_has_overload any(parent.boundary_overload_entries, entry => entry.empty && (parent is ts_export && entry.exported && entry.default == parent.boundary_default_export && (entry.default || entry.name == boundary_function_name) || parent not ts_export && !entry.exported && entry.name == boundary_function_name))
|
|
114
|
+
in ts_function, ts_arrow, ts_method let boundary_has_overload any(parent.boundary_overload_entries, entry => entry.empty && (parent is ts_export && entry.exported && entry.default == parent.boundary_default_export && (entry.default || entry.name == "{boundary_function_name}") || parent not ts_export && !entry.exported && entry.name == "{boundary_function_name}"))
|
|
115
115
|
in ts_method let boundary_empty_method body == null
|
|
116
116
|
in ts_class_property let boundary_accessor contains([] modifier, "accessor")
|
|
117
117
|
in ts_function, ts_arrow, ts_method let boundary_report_site
|
|
@@ -8,8 +8,8 @@ fn signature_key_shape(key, name) = when {
|
|
|
8
8
|
key is (ts_identifier, ts_string, ts_number, ts_bigint, ts_boolean, ts_null) then if starts_with(name, '"') then "quoted" else "normal"
|
|
9
9
|
else then "expression"
|
|
10
10
|
}
|
|
11
|
-
in ts_function let overload_identity if name != null then { name: name, shape: "normal", static: null, call: false } else null
|
|
12
|
-
in ts_method, ts_method_signature let overload_identity { name: style_member_name, shape: { value key.member_key_node.nonempty ?? key.node; signature_key_shape style_member_name }, static: if is ts_method then is_static else null, call: false }
|
|
11
|
+
in ts_function let overload_identity if name != null then { name: "{name}", shape: "normal", static: null, call: false } else null
|
|
12
|
+
in ts_method, ts_method_signature let overload_identity { name: "{style_member_name}", shape: { value key.member_key_node.nonempty ?? key.node; signature_key_shape style_member_name }, static: if is ts_method then is_static else null, call: false }
|
|
13
13
|
in ts_call_signature let overload_identity { name: if kind == "new" then "new" else "call", shape: "normal", static: null, call: kind != "new" }
|
|
14
14
|
in ts_export forward overload_identity from declaration
|
|
15
15
|
in ts_function, ts_method, ts_method_signature, ts_call_signature, ts_export let overload_entry { identity: overload_identity, start: offset }
|
|
@@ -43,7 +43,7 @@ in ts_method_signature rule es-no-misused-new:constructor {
|
|
|
43
43
|
warn "Interfaces cannot be constructed, only classes."
|
|
44
44
|
}
|
|
45
45
|
in ts_method rule es-no-misused-new:class {
|
|
46
|
-
when key == "new" && body == null && return_type == ts_class.name
|
|
46
|
+
when key == "new" && body == null && "{return_type}" == "{ts_class.name}"
|
|
47
47
|
warn "Class cannot have method named `new`."
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -85,7 +85,7 @@ in style_tree_node let function_this_offset when {
|
|
|
85
85
|
else then { value children.function_this_offset; compact; first }
|
|
86
86
|
}
|
|
87
87
|
in ts_type_reference let function_base name == "Function"
|
|
88
|
-
in ts_interface let function_type_container { name: name, kind: "Interface", eligible: count(member) == 1 && (count(extends) == 0 || count(extends) == 1 && (first([] extends) == "Function" || first([] extends.function_base) == true)), this: function_this_offset }
|
|
88
|
+
in ts_interface let function_type_container { name: "{name}", kind: "Interface", eligible: count(member) == 1 && (count(extends) == 0 || count(extends) == 1 && (first([] extends) == "Function" || first([] extends.function_base) == true)), this: function_this_offset }
|
|
89
89
|
in ts_type_literal let function_type_container { name: "", kind: "Type literal", eligible: count(member) == 1, this: null }
|
|
90
90
|
in ts_interface let function_type_header_end {
|
|
91
91
|
value last_parameter: last(type_parameter.nodes)
|
|
@@ -209,9 +209,9 @@ in style_tree_node let unified_bare_type unified_inner_type.nonempty ?? text
|
|
|
209
209
|
in ts_identifier, ts_this let unified_parameter_name text
|
|
210
210
|
in ts_rest let unified_parameter_name argument.unified_parameter_name
|
|
211
211
|
in ts_parameter let unified_parameter { index: index, offset: offset, end: end_offset, line: line, name: name.unified_parameter_name, rest: name is ts_rest, optional: optional != null, type: type.unified_bare_type, raw_type: type, union: type.unified_union_members.nonempty ?? [] }
|
|
212
|
-
in ts_type_parameter let unified_type_parameter { name: name, constraint: constraint.unified_bare_type }
|
|
213
|
-
in ts_type_parameter let unified_type_name name
|
|
214
|
-
in ts_type_reference let unified_outer_type name
|
|
212
|
+
in ts_type_parameter let unified_type_parameter { name: "{name}", constraint: constraint.unified_bare_type }
|
|
213
|
+
in ts_type_parameter let unified_type_name "{name}"
|
|
214
|
+
in ts_type_reference let unified_outer_type "{name}"
|
|
215
215
|
in ts_array_type, ts_parenthesized_type let unified_outer_type type.unified_outer_type
|
|
216
216
|
in ts_parameter let unified_outer_type type.unified_outer_type
|
|
217
217
|
in ts_union let unified_union_children { value [] type.unified_union_members; fold ([]) (members, child) members child }
|
|
@@ -230,10 +230,10 @@ in ts_function, ts_method, ts_method_signature, ts_call_signature let unified_do
|
|
|
230
230
|
in style_tree_node let unified_after_line line + { value text; split "\n"; count } - 1 + { value space_after.text.nonempty ?? ""; split "\n"; count } - 1
|
|
231
231
|
in style_tree_node let unified_next_offset space_after.end
|
|
232
232
|
in ts_method let unified_head { offset: key.unified_next_offset, line: key.unified_after_line }
|
|
233
|
-
in ts_function let unified_key if body == null then name
|
|
234
|
-
in ts_method let unified_key if body == null && kind != "get" && kind != "set" && key != null then { kind: kind_name(key.node), name: key, static: contains([] modifier, "static") } else null
|
|
235
|
-
in ts_method_signature let unified_key if kind != "get" && kind != "set" && key != null then { kind: kind_name(key.node), name: key, static: false } else null
|
|
236
|
-
in ts_call_signature let unified_key kind
|
|
233
|
+
in ts_function let unified_key if body == null then "{name ?? 'default'}" else null
|
|
234
|
+
in ts_method let unified_key if body == null && kind != "get" && kind != "set" && key != null then { kind: kind_name(key.node), name: "{key}", static: contains([] modifier, "static") } else null
|
|
235
|
+
in ts_method_signature let unified_key if kind != "get" && kind != "set" && key != null then { kind: kind_name(key.node), name: "{key}", static: false } else null
|
|
236
|
+
in ts_call_signature let unified_key "{kind ?? 'call'}"
|
|
237
237
|
in ts_function, ts_method, ts_method_signature, ts_call_signature let unified_signature if unified_key == null then null else { key: unified_key, node: node, offset: offset, head: unified_head.nonempty ?? { offset: offset, line: line }, parameters: [] parameter.unified_parameter, types: [] type_parameter.unified_type_parameter, result: return_type.unified_bare_type, outer: [] parameter.unified_outer_type }
|
|
238
238
|
in ts_export let unified_signature declaration.unified_signature
|
|
239
239
|
in ts_program, ts_block, ts_class, ts_interface, ts_type_literal let unified_signatures [] children.unified_signature
|
package/std/ts/style/types.dx
CHANGED
|
@@ -124,8 +124,8 @@ in ts_type_parameter rule es-no-unnecessary-type-constraint {
|
|
|
124
124
|
warn "Constraining the generic type `{name}` to `{constraint}` does nothing and is unnecessary."
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
in ts_function let function_declaration { name: name, node: node, body: body != null }
|
|
128
|
-
in ts_method let function_declaration { name: key, node: node, body: body != null }
|
|
127
|
+
in ts_function let function_declaration { name: "{name}", node: node, body: body != null }
|
|
128
|
+
in ts_method let function_declaration { name: "{key}", node: node, body: body != null }
|
|
129
129
|
in ts_export forward function_declaration from declaration
|
|
130
130
|
in style_tree_node let function_siblings if is ts_export then parent.function_siblings else [] children.function_declaration
|
|
131
131
|
in ts_function, ts_method let overload_implementation body != null && any(parent.function_siblings, d => (d.node is ts_function) == (is ts_function) && d.name == function_declaration.name && !d.body)
|
|
@@ -214,7 +214,7 @@ in ts_template {
|
|
|
214
214
|
let enum_bitwise_operand enum_literal_value
|
|
215
215
|
}
|
|
216
216
|
in ts_identifier let enum_bitwise_operand contains(enum_scope.keys, text)
|
|
217
|
-
in ts_member, ts_index let enum_bitwise_operand object == enum_scope.name && contains(enum_scope.keys, static_name)
|
|
217
|
+
in ts_member, ts_index let enum_bitwise_operand "{object}" == "{enum_scope.name}" && contains(enum_scope.keys, static_name)
|
|
218
218
|
in ts_unary {
|
|
219
219
|
let enum_literal_value contains(["+", "-"], operator) && argument.enum_literal_value == true
|
|
220
220
|
let enum_bitwise_value if operator == "~" then argument.enum_bitwise_operand == true else contains(["+", "-"], operator) && argument.enum_bitwise_value == true
|
|
@@ -263,10 +263,10 @@ in ts_parameter rule es-parameter-properties {
|
|
|
263
263
|
warn "Property {name} should be declared as a class property."
|
|
264
264
|
}
|
|
265
265
|
in ts_member let plain_this_property object is ts_this && property is ts_identifier
|
|
266
|
-
in ts_assignment let parameter_assignment_name if left.plain_this_property == true && right is ts_identifier then right else null
|
|
266
|
+
in ts_assignment let parameter_assignment_name if left.plain_this_property == true && right is ts_identifier then "{right}" else null
|
|
267
267
|
in ts_expression_statement let leading_parameter_assignment if expression.parameter_assignment_name != null && (previous == null || previous.leading_parameter_assignment != null) then expression.parameter_assignment_name else null
|
|
268
268
|
in ts_block let leading_parameter_assignments [] body.leading_parameter_assignment
|
|
269
|
-
in ts_parameter let convertible_parameter if init == null && parameter_modifiers == "" then { name: name, annotation: type } else null
|
|
269
|
+
in ts_parameter let convertible_parameter if init == null && parameter_modifiers == "" then { name: "{name}", annotation: "{type}" } else null
|
|
270
270
|
in ts_method let property_conversion_constructor if key == "constructor" && body != null then { parameters: [] parameter.convertible_parameter, assignments: body.leading_parameter_assignments } else null
|
|
271
271
|
in ts_class let property_conversion_constructors [] member.property_conversion_constructor
|
|
272
272
|
fn conversion_parameter(parameters, name) = find(parameters, p => p.name == name)
|
|
@@ -275,7 +275,7 @@ in ts_class_property rule es-parameter-properties:class {
|
|
|
275
275
|
option prefer ("class-property" | "parameter-property") = "class-property" "Preferred property declaration."
|
|
276
276
|
when parameter_properties_checked
|
|
277
277
|
when prefer == "parameter-property" && key is ts_identifier && init == null
|
|
278
|
-
when property_conversion_matches(parent.property_conversion_constructors, key, type)
|
|
278
|
+
when property_conversion_matches(parent.property_conversion_constructors, "{key}", "{type}")
|
|
279
279
|
warn "Property {key} should be declared as a parameter property."
|
|
280
280
|
}
|
|
281
281
|
|
|
@@ -3,7 +3,7 @@ import .ts/expression-fixes
|
|
|
3
3
|
|
|
4
4
|
define {
|
|
5
5
|
|
|
6
|
-
in ts_computed_key let computed_literal_text if (expression.unwrapped_node.nonempty ?? expression.node) is (ts_string, ts_number) then expression.unwrapped_text.nonempty ?? expression else null
|
|
6
|
+
in ts_computed_key let computed_literal_text if (expression.unwrapped_node.nonempty ?? expression.node) is (ts_string, ts_number) then expression.unwrapped_text.nonempty ?? "{expression}" else null
|
|
7
7
|
in ts_method, ts_class_property let member_static contains([] modifier, "static")
|
|
8
8
|
in ts_property, ts_pattern_property let computed_exception parent is ts_object && parent.flow_destructuring_target != true && static_name == "__proto__"
|
|
9
9
|
in ts_method let computed_exception if parent is ts_class then static_name == (if member_static then "prototype" else "constructor") else parent is ts_object && parent.flow_destructuring_target != true && static_name == "__proto__"
|
|
@@ -30,7 +30,7 @@ in ts_block let guarded_iteration count([] body) == 0 || first(body.nodes) is ts
|
|
|
30
30
|
|
|
31
31
|
in ts_variable_declaration let async_resource_declaration kind == "await using"
|
|
32
32
|
in ts_for_of let asynchronous_iteration contains([] modifier, "await")
|
|
33
|
-
in ts_labeled let declared_label label
|
|
33
|
+
in ts_labeled let declared_label "{label}"
|
|
34
34
|
in ts_node let repeated_evaluation when {
|
|
35
35
|
parent is ts_function_like || parent is ts_for_of && parent.asynchronous_iteration == true then false
|
|
36
36
|
is (ts_for.body, ts_for.test, ts_for.update, ts_for_in.body, ts_for_of.body) || is (ts_for_in.left, ts_for_of.left) && async_resource_declaration == true || is (ts_while.body, ts_while.test, ts_do_while.body, ts_do_while.test) then true
|
|
@@ -98,10 +98,25 @@ fn curly_fix_allowed(n, block) = if !block then true else {
|
|
|
98
98
|
&& !starts_with(after.text, "/") && !starts_with(after.text, "`"))
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
value
|
|
101
|
+
# Removing braces also takes the space before `{` (when nothing else is
|
|
102
|
+
# there) and the whitespace left where `}` was, which upstream keeps.
|
|
103
|
+
fn curly_removal_start(source, n) = {
|
|
104
|
+
value before: n.token_neighbours.before
|
|
105
|
+
value if before != null && re_test(byte_slice(source, before.end, n.offset), /^[ \t]*$/) then before.end else n.offset
|
|
106
|
+
}
|
|
107
|
+
# What follows `}` on its line (`} else`) keeps the line `}` had, at its
|
|
108
|
+
# indentation.
|
|
109
|
+
fn curly_removal_keeps_line(source, n) = {
|
|
110
|
+
value after: n.token_neighbours.after
|
|
111
|
+
value after != null && !after.line_break && re_test(byte_slice(source, n.end_offset, after.start), /^[ \t]*$/)
|
|
112
|
+
&& re_test(byte_slice(source, n.first_token.end, n.last_token.start), /[\r\n][ \t]*$/)
|
|
113
|
+
}
|
|
114
|
+
fn curly_removal_end(source, n) = if curly_removal_keeps_line(source, n) then n.token_neighbours.after.start else n.end_offset
|
|
115
|
+
fn curly_removal(source, n) = {
|
|
116
|
+
value raw: byte_slice(source, n.first_token.end, n.last_token.start)
|
|
117
|
+
value interior: if curly_removal_keeps_line(source, n) then raw else trim_end(raw)
|
|
118
|
+
value text: if re_test(interior, /^[ \t]*[\r\n]/) then interior else " " trim_start(interior)
|
|
119
|
+
value if curly_removal_start(source, n) == n.offset then expression_fix_edges(n, trim_start(text)) else text
|
|
105
120
|
}
|
|
106
121
|
|
|
107
122
|
@macro suggestion_curly_policy {
|
|
@@ -113,7 +128,9 @@ fn curly_replacement(source, n, block) = if !block then "{{" n.text "}}" else {
|
|
|
113
128
|
let chain_required if mode == "all" || style != "consistent" then false else if mode == "multi" then curly_info.multi_consistent else if mode == "multi-line" then curly_info.multiline_consistent else curly_info.nested_consistent
|
|
114
129
|
let curly_expected if style == "consistent" && mode != "all" then if chain_required then 1 else 0 else body_expected
|
|
115
130
|
when curly_expected != -1 && (curly_expected == 1 && !curly_info.block || curly_expected == 0 && curly_info.block)
|
|
116
|
-
|
|
131
|
+
let curly_fix_start if curly_info.block then curly_removal_start(source, node) else offset
|
|
132
|
+
let curly_fix_end if curly_info.block then curly_removal_end(source, node) else end_offset
|
|
133
|
+
fix at { start: curly_fix_start, end: curly_fix_end } if curly_fix_allowed(node, curly_info.block) as if curly_info.block then curly_removal(source, node) else "{{" text "}}"
|
|
117
134
|
warn "{if curly_expected == 1 then 'Expected' else 'Unnecessary'} {{ after '{curly_info.name}'{if curly_info.condition then ' condition' else ''}."
|
|
118
135
|
}
|
|
119
136
|
in ts_if.consequent rule es-curly:if { @suggestion_curly_policy }
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
define {
|
|
4
4
|
|
|
5
|
-
in ts_throw let thrown_identifier if (argument.unwrapped_node.nonempty ?? argument.node) is ts_identifier then argument.unwrapped_text.nonempty ?? argument else null
|
|
5
|
+
in ts_throw let thrown_identifier if (argument.unwrapped_node.nonempty ?? argument.node) is ts_identifier then argument.unwrapped_text.nonempty ?? "{argument}" else null
|
|
6
6
|
in ts_block let first_throw first([] body.thrown_identifier)
|
|
7
|
-
in ts_try let catch_rethrows parameter is ts_identifier && handler.first_throw == parameter
|
|
7
|
+
in ts_try let catch_rethrows parameter is ts_identifier && handler.first_throw == "{parameter}"
|
|
8
8
|
|
|
9
9
|
in ts_try rule es-no-useless-catch {
|
|
10
10
|
when catch_rethrows && finalizer == null
|
|
@@ -79,7 +79,7 @@ in ts_conditional rule es-no-unneeded-ternary {
|
|
|
79
79
|
|
|
80
80
|
in ts_conditional rule es-no-unneeded-ternary:default-assignment {
|
|
81
81
|
option defaultAssignment boolean = true "allow conditional expressions used as default assignments"
|
|
82
|
-
when !defaultAssignment && (test.unwrapped_node.nonempty ?? test.node) is ts_identifier && (consequent.unwrapped_node.nonempty ?? consequent.node) is ts_identifier && (test.unwrapped_text.nonempty ?? test) == (consequent.unwrapped_text.nonempty ?? consequent)
|
|
82
|
+
when !defaultAssignment && (test.unwrapped_node.nonempty ?? test.node) is ts_identifier && (consequent.unwrapped_node.nonempty ?? consequent.node) is ts_identifier && (test.unwrapped_text.nonempty ?? "{test}") == (consequent.unwrapped_text.nonempty ?? "{consequent}")
|
|
83
83
|
warn "Unnecessary use of conditional expression for default assignment."
|
|
84
84
|
let operand alternate.node
|
|
85
85
|
let bare unparenthesised_node(operand)
|
|
@@ -111,7 +111,7 @@ fn suggestion_implicit_coercion(source, n) = {
|
|
|
111
111
|
value left: unparenthesised_node(n.left.node)
|
|
112
112
|
value right: unparenthesised_node(n.right.node)
|
|
113
113
|
value if n is ts_unary then when {
|
|
114
|
-
contains(["!", "-"], n.operator) && argument is ts_unary && argument.operator == n.operator then {
|
|
114
|
+
contains(["!", "-"], n.operator) && argument is ts_unary && "{argument.operator}" == "{n.operator}" then {
|
|
115
115
|
value inner: argument.argument.node
|
|
116
116
|
value if n.operator == "!" then {kind: "boolean", operator: "!!", recommendation: "Boolean(" suggestion_coercion_operand(inner) ")"}
|
|
117
117
|
else if !suggestion_coercion_numeric(inner) then {kind: "number", operator: "- -", recommendation: "Number(" suggestion_coercion_operand(inner) ")"}
|
|
@@ -5,7 +5,7 @@ define {
|
|
|
5
5
|
in ts_block let statement_count count([] body)
|
|
6
6
|
|
|
7
7
|
in ts_parenthesized let unwrapped_node expression.unwrapped_node.nonempty ?? expression.node
|
|
8
|
-
in ts_parenthesized let unwrapped_text expression.unwrapped_text.nonempty ?? expression
|
|
8
|
+
in ts_parenthesized let unwrapped_text expression.unwrapped_text.nonempty ?? "{expression}"
|
|
9
9
|
|
|
10
10
|
in ts_parenthesized let inner_comparison_tokens expression.unparenthesised_tokens
|
|
11
11
|
in ts_node let unparenthesised_tokens if is ts_parenthesized then inner_comparison_tokens else token_texts
|
|
@@ -18,15 +18,15 @@ in ts_call let optional_shape {
|
|
|
18
18
|
value if callee.optional_shape != null && { value args; all (shape) shape != null }
|
|
19
19
|
then ["call", callee.optional_shape, args, types] else null
|
|
20
20
|
}
|
|
21
|
-
in ts_unary let optional_shape if argument.optional_shape != null then ["unary", operator, argument.optional_shape] else null
|
|
22
|
-
in ts_binary let optional_shape if left.optional_shape != null && right.optional_shape != null then ["binary", operator, left.optional_shape, right.optional_shape] else null
|
|
21
|
+
in ts_unary let optional_shape if argument.optional_shape != null then ["unary", "{operator}", argument.optional_shape] else null
|
|
22
|
+
in ts_binary let optional_shape if left.optional_shape != null && right.optional_shape != null then ["binary", "{operator}", left.optional_shape, right.optional_shape] else null
|
|
23
23
|
in ts_template let optional_shape {
|
|
24
24
|
value quasis: { value quasi.nodes; map (quasi) quasi.text }
|
|
25
25
|
value expressions: { value expression.nodes; map (expression) expression.optional_shape }
|
|
26
26
|
value ["template", quasis, expressions]
|
|
27
27
|
}
|
|
28
28
|
in ts_parenthesized let optional_operands expression.optional_operands
|
|
29
|
-
fn optional_side(n, op) = if n is ts_logical && n.operator == op then n.optional_operands else [n]
|
|
29
|
+
fn optional_side(n, op) = if n is ts_logical && "{n.operator}" == "{op}" then n.optional_operands else [n]
|
|
30
30
|
in ts_logical let optional_operands {
|
|
31
31
|
value lhs: unparenthesised_node(left.node)
|
|
32
32
|
value rhs: unparenthesised_node(right.node)
|
|
@@ -283,7 +283,7 @@ in ts_logical rule es-prefer-optional-chain {
|
|
|
283
283
|
option requireNullish boolean = false "Require a nullable checked operand"
|
|
284
284
|
option allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing boolean = false "Allow fixes that may add undefined to the return type"
|
|
285
285
|
let enclosing { value node; walk (n) if n.parent is ts_parenthesized then n.parent.node else null; last }
|
|
286
|
-
when operator != "??" && !(enclosing.parent is ts_logical && enclosing.parent.operator == operator)
|
|
286
|
+
when operator != "??" && !(enclosing.parent is ts_logical && "{enclosing.parent.operator}" == "{operator}")
|
|
287
287
|
let opts {any: checkAny, unknown: checkUnknown, string: checkString, number: checkNumber, boolean: checkBoolean,
|
|
288
288
|
bigint: checkBigInt, requireNullish: requireNullish, boundary: node}
|
|
289
289
|
let operands { value optional_operands; map (operand) { value operand; unparenthesised_node; optional_operand operator } }
|
|
@@ -119,13 +119,12 @@ fn type_argument_widened_numeric(parts) = parts != null && count(parts) > 0
|
|
|
119
119
|
&& all(parts, arm => count(arm) > 0 && all(arm, part => type_argument_numeric_part(part)))
|
|
120
120
|
fn type_argument_enum_carriers(parts) = flat_map(parts ?? [],
|
|
121
121
|
arm => map(filter(arm, part => contains(part.traits, "enum")), part => part.carrier))
|
|
122
|
-
#
|
|
123
|
-
#
|
|
122
|
+
# A numeric enum is no stand-in for `number` (or another enum): removing it
|
|
123
|
+
# widens what the instantiation sees.
|
|
124
124
|
fn type_argument_numeric_carriers_same(a, b) = {
|
|
125
125
|
value ca: type_argument_enum_carriers(a)
|
|
126
126
|
value cb: type_argument_enum_carriers(b)
|
|
127
|
-
value count(ca) ==
|
|
128
|
-
|| count(ca) == count(cb) && all(ca, carrier => contains(cb, carrier))
|
|
127
|
+
value count(ca) == count(cb) && all(ca, carrier => contains(cb, carrier))
|
|
129
128
|
}
|
|
130
129
|
fn type_argument_numeric_same(a, b) = type_argument_numeric(a) && type_argument_numeric(b)
|
|
131
130
|
&& type_argument_numeric_carriers_same(a, b)
|
|
@@ -158,10 +157,20 @@ fn type_argument_equivalent(a, b, depth) = {
|
|
|
158
157
|
value if depth < 3 && elements_a != null && elements_a == elements_b && elements_a > 0
|
|
159
158
|
then type_argument_elements_same(a, b, elements_a, 0)
|
|
160
159
|
else type_argument_numeric_same(ca, cb)
|
|
161
|
-
|| type_argument_known(ca) && type_argument_known(cb)
|
|
160
|
+
|| type_argument_known(ca) && type_argument_known(cb) && type_argument_same_carriers(ca, cb)
|
|
162
161
|
&& value_accepts(a, b, "value", "value") == true
|
|
163
162
|
&& value_accepts(b, a, "value", "value") == true
|
|
164
163
|
}
|
|
164
|
+
# Each side one instantiation of the same declarations (`Map<K, V>` through
|
|
165
|
+
# any alias): mutual assignability then means the same type. Without it
|
|
166
|
+
# (`A & { x?: T }` against `A`), assignable both ways is not the same type.
|
|
167
|
+
fn type_argument_carrier_sites(parts) = map(type_argument_parts(parts),
|
|
168
|
+
part => if part.carrier_known && part.carrier != null then part.carrier.file ":" part.carrier.node else null)
|
|
169
|
+
fn type_argument_same_carriers(ca, cb) = count(ca) == 1 && count(cb) == 1 && {
|
|
170
|
+
value a: type_argument_carrier_sites(ca)
|
|
171
|
+
value b: type_argument_carrier_sites(cb)
|
|
172
|
+
value count(a) > 0 && count(a) == count(b) && all(a, site => site != null) && all(zip(a, b), pair => first(pair) == last(pair))
|
|
173
|
+
}
|
|
165
174
|
fn type_argument_same_handles(a, b) = {
|
|
166
175
|
value ca: value_constituents(a)
|
|
167
176
|
value cb: value_constituents(b)
|
|
@@ -235,7 +244,9 @@ fn type_argument_parameter_sites(n, site, signature) = if signature != null then
|
|
|
235
244
|
value constructor: find(site_field(n, site, "member") ?? [], member => member.name == "constructor")
|
|
236
245
|
value if constructor != null then site_field(n, constructor, "parameter") ?? [] else []
|
|
237
246
|
} else site_field(n, site, "parameter") ?? []
|
|
238
|
-
|
|
247
|
+
# Only a lone type argument can go: TypeScript wants every one without a
|
|
248
|
+
# default once any is written.
|
|
249
|
+
fn type_argument_inferred(n, site, signature, formal) = count(n.parent.type_argument.nodes) == 1 && {
|
|
239
250
|
value owner: n.parent.node
|
|
240
251
|
value pairs: zip(type_argument_parameter_sites(n, site, signature), owner.argument.nodes)
|
|
241
252
|
value pair: find(pairs, pair => pair != null && first(pair) != null && last(pair) != null
|
|
@@ -55,7 +55,7 @@ fn conversion_operator(n) = if n is (ts_binary, ts_assignment) then {
|
|
|
55
55
|
value inner: unparenthesised_node(n.argument.node)
|
|
56
56
|
value if n.operator == "+" && conversion_primitive(n.argument.node, "number", false) then
|
|
57
57
|
conversion_finding("number", "Using the unary + operator on a number", n.offset)
|
|
58
|
-
else if inner is ts_unary && inner.operator == n.operator then
|
|
58
|
+
else if inner is ts_unary && "{inner.operator}" == "{n.operator}" then
|
|
59
59
|
if n.operator == "!" && conversion_primitive(inner.argument.node, "boolean", false) then
|
|
60
60
|
conversion_finding("boolean", "Using !! on a boolean", n.offset)
|
|
61
61
|
else if n.operator == "~" && conversion_integers(inner.argument.node) then
|
package/std/ts/values.dx
CHANGED
|
@@ -4,14 +4,18 @@ import .ts/values/inspection
|
|
|
4
4
|
|
|
5
5
|
define {
|
|
6
6
|
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
# Runtime categories: no value is two of them, so `typeof x === "object"`
|
|
8
|
+
# rules every primitive out. Types are objects only by implication (below),
|
|
9
|
+
# which never makes an intersection impossible: a branded `string & { tag }`
|
|
10
|
+
# or `string & number[]` stays a string.
|
|
11
|
+
exclusive null, undefined, string, number, boolean, bigint, symbol, object
|
|
11
12
|
exclusive falsy, truthy
|
|
12
13
|
exclusive thenable, nonthenable
|
|
13
14
|
# TypeScript's `object` keyword takes every non-primitive: a shape with members is one.
|
|
14
15
|
trait shaped implies object
|
|
16
|
+
trait array implies object
|
|
17
|
+
trait tuple implies object
|
|
18
|
+
trait callable implies object
|
|
15
19
|
top unknown
|
|
16
20
|
dynamic any
|
|
17
21
|
keys text string, nonthenable
|
|
@@ -24,8 +28,8 @@ apparent boolean inherits instance "Boolean"
|
|
|
24
28
|
apparent bigint inherits instance "BigInt"
|
|
25
29
|
apparent symbol inherits instance "Symbol"
|
|
26
30
|
apparent callable inherits instance "Function"
|
|
27
|
-
product ts_tuple items fits
|
|
28
|
-
product ts_array items fits
|
|
31
|
+
product ts_tuple items fits truthy, tuple as { kind: "tuple" } inherits instance "Array" of ...items readonly inherits instance "ReadonlyArray" of ...items optional trait undefined, nullable, falsy, nonthenable count "length"
|
|
32
|
+
product ts_array items fits truthy, array as { kind: "array" } inherits instance "Array" of ...items readonly inherits instance "ReadonlyArray" of ...items
|
|
29
33
|
|
|
30
34
|
in ts_program { fits object, truthy in module }
|
|
31
35
|
in ts_namespace {
|
|
@@ -844,12 +848,12 @@ in ts_index {
|
|
|
844
848
|
}
|
|
845
849
|
}
|
|
846
850
|
in ts_function, ts_arrow, ts_function_type, ts_call_signature {
|
|
847
|
-
fits callable,
|
|
851
|
+
fits callable, truthy
|
|
848
852
|
}
|
|
849
853
|
in ts_function { fits constructible when !any(modifier.nodes, modifier => modifier.text == "async") }
|
|
850
854
|
in ts_method, ts_method_signature {
|
|
851
855
|
optional when optional != null
|
|
852
|
-
when kind != "get" && kind != "set" { fits callable,
|
|
856
|
+
when kind != "get" && kind != "set" { fits callable, truthy }
|
|
853
857
|
when kind == "get" { unwraps it.result }
|
|
854
858
|
when kind == "set" { unwraps parameter.type }
|
|
855
859
|
}
|
|
@@ -930,7 +934,7 @@ in ts_class, ts_interface {
|
|
|
930
934
|
carries type_parameter as { kind: "named", name: name.text }
|
|
931
935
|
when (name.text == "Array" || name.text == "ReadonlyArray") && ts_value_global_declaration(node, name.text) {
|
|
932
936
|
indexed repeated type_parameter strings
|
|
933
|
-
fits
|
|
937
|
+
fits truthy in members
|
|
934
938
|
}
|
|
935
939
|
}
|
|
936
940
|
in ts_type_reference {
|