@neralabs/rerail-pack-typescript 0.1.2 → 0.1.4
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 +268 -7
- package/licenses/eslint-plugin-vitest/UPSTREAM.md +4 -4
- package/licenses/typescript-eslint/UPSTREAM.md +1058 -4
- package/pack.json +29 -1
- package/package.json +1 -1
- package/rules/typescript-eslint-ban-tslint-comment.json +2 -2
- package/rules/typescript-eslint-consistent-type-definitions.json +1 -1
- package/rules/typescript-eslint-default-param-last.json +1 -1
- package/rules/typescript-eslint-no-array-constructor.json +1 -1
- package/rules/typescript-eslint-no-confusing-non-null-assertion.json +4 -4
- package/rules/typescript-eslint-no-dupe-class-members.json +1 -1
- package/rules/typescript-eslint-no-duplicate-enum-values.json +1 -1
- package/rules/typescript-eslint-no-empty-function.json +1 -1
- package/rules/typescript-eslint-no-empty-object-type.json +221 -0
- package/rules/typescript-eslint-no-extra-non-null-assertion.json +1 -1
- package/rules/typescript-eslint-no-import-type-side-effects.json +4 -4
- package/rules/typescript-eslint-no-namespace.json +1 -1
- package/rules/typescript-eslint-no-non-null-asserted-optional-chain.json +1 -1
- package/rules/typescript-eslint-no-non-null-assertion.json +3 -3
- package/rules/typescript-eslint-no-unnecessary-type-constraint.json +1 -1
- package/rules/typescript-eslint-no-unsafe-declaration-merging.json +250 -0
- package/rules/typescript-eslint-no-unsafe-function-type.json +1 -1
- package/rules/typescript-eslint-no-unused-expressions.json +1 -1
- package/rules/typescript-eslint-no-useless-empty-export.json +1 -1
- package/rules/typescript-eslint-prefer-as-const.json +1 -1
- package/rules/typescript-eslint-prefer-enum-initializers.json +1 -1
- package/rules/typescript-eslint-prefer-literal-enum-member.json +1 -1
- package/rules/typescript-eslint-prefer-namespace-keyword.json +1 -1
- package/rules/typescript-eslint-triple-slash-reference.json +146 -0
package/pack.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "typescript",
|
|
4
4
|
"name": "TypeScript",
|
|
5
5
|
"category": "language",
|
|
6
|
-
"covers": "
|
|
6
|
+
"covers": "24 typescript-eslint rules ported to Rerail, 13 of them on and 11 off until turned on, each scored against the tool's own recorded findings on its test fixtures.",
|
|
7
7
|
"reason": "matches TypeScript",
|
|
8
8
|
"match": {
|
|
9
9
|
"any": [
|
|
@@ -89,6 +89,12 @@
|
|
|
89
89
|
"group": "typescript-eslint",
|
|
90
90
|
"on": false
|
|
91
91
|
},
|
|
92
|
+
{
|
|
93
|
+
"id": "typescript-eslint-no-empty-object-type",
|
|
94
|
+
"document": "rules/typescript-eslint-no-empty-object-type.json",
|
|
95
|
+
"title": "typescript-eslint no-empty-object-type: Disallow accidentally using the \"empty object\" type",
|
|
96
|
+
"group": "typescript-eslint"
|
|
97
|
+
},
|
|
92
98
|
{
|
|
93
99
|
"id": "typescript-eslint-no-extra-non-null-assertion",
|
|
94
100
|
"document": "rules/typescript-eslint-no-extra-non-null-assertion.json",
|
|
@@ -137,6 +143,12 @@
|
|
|
137
143
|
"title": "typescript-eslint no-unnecessary-type-constraint: Disallow unnecessary constraints on generic types",
|
|
138
144
|
"group": "typescript-eslint"
|
|
139
145
|
},
|
|
146
|
+
{
|
|
147
|
+
"id": "typescript-eslint-no-unsafe-declaration-merging",
|
|
148
|
+
"document": "rules/typescript-eslint-no-unsafe-declaration-merging.json",
|
|
149
|
+
"title": "typescript-eslint no-unsafe-declaration-merging: Disallow unsafe declaration merging",
|
|
150
|
+
"group": "typescript-eslint"
|
|
151
|
+
},
|
|
140
152
|
{
|
|
141
153
|
"id": "typescript-eslint-no-unsafe-function-type",
|
|
142
154
|
"document": "rules/typescript-eslint-no-unsafe-function-type.json",
|
|
@@ -181,6 +193,22 @@
|
|
|
181
193
|
"document": "rules/typescript-eslint-prefer-namespace-keyword.json",
|
|
182
194
|
"title": "typescript-eslint prefer-namespace-keyword: Require using `namespace` keyword over `module` keyword to declare custom TypeScript modules",
|
|
183
195
|
"group": "typescript-eslint"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"id": "typescript-eslint-triple-slash-reference",
|
|
199
|
+
"document": "rules/typescript-eslint-triple-slash-reference.json",
|
|
200
|
+
"title": "typescript-eslint triple-slash-reference: Disallow certain triple slash directives in favor of ES6-style import declarations",
|
|
201
|
+
"group": "typescript-eslint",
|
|
202
|
+
"examples": {
|
|
203
|
+
"caught": {
|
|
204
|
+
"path": "src/setup.ts",
|
|
205
|
+
"text": "/// <reference path=\"./globals.d.ts\" />\n\nexport function ready(): boolean {\n return typeof window !== \"undefined\";\n}\n"
|
|
206
|
+
},
|
|
207
|
+
"passes": {
|
|
208
|
+
"path": "src/setup.ts",
|
|
209
|
+
"text": "import \"./globals.js\";\n\nexport function ready(): boolean {\n return typeof window !== \"undefined\";\n}\n"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
184
212
|
}
|
|
185
213
|
]
|
|
186
214
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "typescript-eslint-ban-tslint-comment",
|
|
4
4
|
"revision": 3,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Remove TSLint enable and disable comments; TSLint is deprecated and they no longer do anything.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"violation": {
|
|
29
29
|
"anchor": "witness.span",
|
|
30
30
|
"code": "@typescript-eslint/ban-tslint-comment",
|
|
31
|
-
"message": "
|
|
31
|
+
"message": "Delete the \"$TEXT\" comment; TSLint is deprecated and nothing reads it.",
|
|
32
32
|
"fix": "",
|
|
33
33
|
"suppress": {
|
|
34
34
|
"eslint": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"format":"rerail.policy/v1","id":"typescript-eslint-consistent-type-definitions","revision":5,"mode":"steer","description":"
|
|
1
|
+
{"format":"rerail.policy/v1","id":"typescript-eslint-consistent-type-definitions","revision":5,"mode":"steer","description":"Use an interface instead of a type alias to define TypeScript object types.","scope":{"include":["**/*.ts","**/*.tsx","**/*.mts","**/*.cts"],"exclude":[]},"clauses":[{"id":"options","define":{"options":{"option":{"type":"string","nullable":true,"default":null}}}},{"id":"shared","define":{"language":"typescript","utils":{"r1":{"any":[{"has":{"kind":"type_parameters","pattern":"$TP","stopBy":"neighbor"}},{"not":{"has":{"kind":"type_parameters","stopBy":"neighbor"}}}]},"r2":{"inside":{"has":{"regex":"^global$","stopBy":"neighbor"},"kind":"ambient_declaration","stopBy":"end"}},"r3":{"has":{"kind":"type_identifier","pattern":"$N","stopBy":"neighbor"}},"r4":{"has":{"kind":"extends_type_clause","stopBy":"neighbor"}},"r5":{"has":{"kind":"interface_body","pattern":"$B","stopBy":"neighbor"}}}}},{"id":"interface-over-type","forbid":{"ast":{"language":"typescript","rule":{"kind":"type_alias_declaration","all":[{"matches":"r3"},{"has":{"matches":"object-type","stopBy":"neighbor"}},{"matches":"r1"}]},"utils":{"object-type":{"any":[{"kind":"object_type","pattern":"$B","not":{"has":{"kind":"index_signature","stopBy":"neighbor","has":{"kind":"mapped_type_clause","stopBy":"neighbor"}}}},{"kind":"parenthesized_type","has":{"matches":"object-type","stopBy":"neighbor"}}]}},"when":{"option":{"option":{"in":[null,"interface"]}}}}},"violation":{"anchor":"capture.N","code":"@typescript-eslint/consistent-type-definitions","message":"Use an `interface` instead of a `type`.","fix":"interface $N$TP $B","suppress":{"eslint":{"rules":["@typescript-eslint/consistent-type-definitions"]},"oxlint":{"rules":["consistent-type-definitions"]},"biome":{"rules":["lint/style/useConsistentTypeDefinitions"]}}}},{"id":"type-over-interface","forbid":{"ast":{"language":"typescript","rule":{"kind":"interface_declaration","all":[{"matches":"r3"},{"matches":"r5"},{"matches":"r1"},{"not":{"any":[{"matches":"r4"},{"inside":{"kind":"export_statement","stopBy":"neighbor","has":{"regex":"^default$","stopBy":"neighbor"}}},{"matches":"r2"}]}}]},"when":{"option":{"option":"type"}}}},"violation":{"anchor":"capture.N","code":"@typescript-eslint/consistent-type-definitions","message":"Use a `type` instead of an `interface`.","fix":"type $N$TP = $B","suppress":{"eslint":{"rules":["@typescript-eslint/consistent-type-definitions"]},"oxlint":{"rules":["consistent-type-definitions"]},"biome":{"rules":["lint/style/useConsistentTypeDefinitions"]}}}},{"id":"type-over-interface-unfixed","forbid":{"ast":{"language":"typescript","rule":{"kind":"interface_declaration","all":[{"matches":"r3"},{"any":[{"matches":"r4"},{"matches":"r2"}]}]},"when":{"option":{"option":"type"}}}},"violation":{"anchor":"capture.N","code":"@typescript-eslint/consistent-type-definitions","message":"Use a `type` instead of an `interface`.","suppress":{"eslint":{"rules":["@typescript-eslint/consistent-type-definitions"]},"oxlint":{"rules":["consistent-type-definitions"]},"biome":{"rules":["lint/style/useConsistentTypeDefinitions"]}}}},{"id":"type-over-interface-export-default","forbid":{"ast":{"language":"typescript","rule":{"kind":"export_statement","all":[{"has":{"regex":"^default$","stopBy":"neighbor"}},{"has":{"kind":"interface_declaration","stopBy":"neighbor","all":[{"matches":"r3"},{"matches":"r5"},{"matches":"r1"},{"not":{"any":[{"matches":"r4"},{"matches":"r2"}]}}]}}]},"when":{"option":{"option":"type"}}}},"violation":{"anchor":"capture.N","code":"@typescript-eslint/consistent-type-definitions","message":"Use a `type` instead of an `interface`.","fix":"type $N$TP = $B\nexport default $N","suppress":{"eslint":{"rules":["@typescript-eslint/consistent-type-definitions"]},"oxlint":{"rules":["consistent-type-definitions"]},"biome":{"rules":["lint/style/useConsistentTypeDefinitions"]}}}}]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "typescript-eslint-default-param-last",
|
|
4
4
|
"revision": 4,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Put defaulted and optional parameters after required ones in TypeScript functions; callers otherwise can't omit them.",
|
|
7
7
|
"scope": { "include": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"], "exclude": [] },
|
|
8
8
|
"clauses": [
|
|
9
9
|
{
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "typescript-eslint-no-array-constructor",
|
|
4
4
|
"revision": 4,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Use an array literal instead of Array() or new Array() in TypeScript; the constructor treats a single number argument as a length.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "typescript-eslint-no-confusing-non-null-assertion",
|
|
4
4
|
"revision": 3,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Avoid a non-null assertion right before =, ==, ===, in or instanceof; it reads like != or a negated test.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"violation": {
|
|
70
70
|
"anchor": "witness.span",
|
|
71
71
|
"code": "@typescript-eslint/no-confusing-non-null-assertion",
|
|
72
|
-
"message": "
|
|
72
|
+
"message": "Wrap the asserted left side in parentheses, `(a!) = b`, so it can't be read as `a != b`.",
|
|
73
73
|
"suppress": {
|
|
74
74
|
"eslint": {
|
|
75
75
|
"rules": [
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"violation": {
|
|
140
140
|
"anchor": "witness.span",
|
|
141
141
|
"code": "@typescript-eslint/no-confusing-non-null-assertion",
|
|
142
|
-
"message": "
|
|
142
|
+
"message": "Wrap the asserted left side in parentheses, `(a!) == b`, so it can't be read as `a !== b`.",
|
|
143
143
|
"suppress": {
|
|
144
144
|
"eslint": {
|
|
145
145
|
"rules": [
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
"violation": {
|
|
211
211
|
"anchor": "witness.span",
|
|
212
212
|
"code": "@typescript-eslint/no-confusing-non-null-assertion",
|
|
213
|
-
"message": "
|
|
213
|
+
"message": "Wrap the asserted left side in parentheses, `(a!) $OP b`, so it can't be read as `!(a $OP b)`.",
|
|
214
214
|
"suppress": {
|
|
215
215
|
"eslint": {
|
|
216
216
|
"rules": [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"format":"rerail.policy/v1","id":"typescript-eslint-no-dupe-class-members","revision":7,"mode":"steer","description":"
|
|
1
|
+
{"format":"rerail.policy/v1","id":"typescript-eslint-no-dupe-class-members","revision":7,"mode":"steer","description":"Remove duplicate member names in a TypeScript class; the later one silently overwrites the earlier.","scope":{"include":["**/*.ts","**/*.tsx","**/*.mts","**/*.cts"],"exclude":[]},"clauses":[{"id":"duplicate-member","forbid":{"ast":{"language":"typescript","rule":{"all":[{"matches":"member"},{"pattern":"$P"},{"any":[{"has":{"stopBy":"neighbor","matches":"key","not":{"kind":"computed_property_name"},"pattern":"$K"}},{"has":{"stopBy":"neighbor","matches":"key","kind":"computed_property_name","has":{"stopBy":"neighbor","not":{"regex":"^[\\[\\]]$"},"pattern":"$K"}}}]},{"any":[{"all":[{"matches":"static"},{"matches":"get"},{"count":{"follows":{"stopBy":"end","all":[{"matches":"member"},{"matches":"static"},{"not":{"matches":"set"}}],"pattern":"$Q","compare":{"left":"Q","op":"eq","right":"P","text":"key"}},"min":1}}]},{"all":[{"matches":"static"},{"matches":"set"},{"count":{"follows":{"stopBy":"end","all":[{"matches":"member"},{"matches":"static"},{"not":{"matches":"get"}}],"pattern":"$Q","compare":{"left":"Q","op":"eq","right":"P","text":"key"}},"min":1}}]},{"all":[{"matches":"static"},{"all":[{"not":{"matches":"get"}},{"not":{"matches":"set"}}]},{"count":{"follows":{"stopBy":"end","all":[{"matches":"member"},{"matches":"static"}],"pattern":"$Q","compare":{"left":"Q","op":"eq","right":"P","text":"key"}},"min":1}}]},{"all":[{"not":{"matches":"static"}},{"matches":"get"},{"count":{"follows":{"stopBy":"end","all":[{"matches":"member"},{"not":{"matches":"static"}},{"not":{"matches":"set"}}],"pattern":"$Q","compare":{"left":"Q","op":"eq","right":"P","text":"key"}},"min":1}}]},{"all":[{"not":{"matches":"static"}},{"matches":"set"},{"count":{"follows":{"stopBy":"end","all":[{"matches":"member"},{"not":{"matches":"static"}},{"not":{"matches":"get"}}],"pattern":"$Q","compare":{"left":"Q","op":"eq","right":"P","text":"key"}},"min":1}}]},{"all":[{"not":{"matches":"static"}},{"all":[{"not":{"matches":"get"}},{"not":{"matches":"set"}}]},{"count":{"follows":{"stopBy":"end","all":[{"matches":"member"},{"not":{"matches":"static"}}],"pattern":"$Q","compare":{"left":"Q","op":"eq","right":"P","text":"key"}},"min":1}}]}]}]},"utils":{"member":{"all":[{"any":[{"kind":"method_definition"},{"kind":"public_field_definition"}]},{"inside":{"kind":"class_body","stopBy":"neighbor"}},{"not":{"matches":"ctor"}},{"not":{"has":{"stopBy":"neighbor","regex":"^abstract$","not":{"kind":"property_identifier"}}}},{"not":{"has":{"stopBy":"neighbor","regex":"^accessor$","not":{"kind":"property_identifier"}}}},{"not":{"has":{"stopBy":"neighbor","kind":"computed_property_name"}}}]},"key":{"any":[{"kind":"property_identifier"},{"kind":"string"},{"kind":"number"},{"kind":"computed_property_name"},{"kind":"private_property_identifier"}],"not":{"follows":{"stopBy":"end","regex":"^[=(]$"}}},"static":{"has":{"stopBy":"neighbor","regex":"^static$","not":{"kind":"property_identifier"}}},"get":{"kind":"method_definition","has":{"stopBy":"neighbor","regex":"^get$","not":{"kind":"property_identifier"}}},"set":{"kind":"method_definition","has":{"stopBy":"neighbor","regex":"^set$","not":{"kind":"property_identifier"}}},"ctor":{"kind":"method_definition","not":{"has":{"stopBy":"neighbor","regex":"^static$","not":{"kind":"property_identifier"}}},"has":{"stopBy":"neighbor","matches":"key","any":[{"kind":"property_identifier","regex":"^constructor$"},{"kind":"string","value":{"eq":"constructor"}}]}}},"transform":{"KT":{"substring":{"source":"$K","value":true}}}}},"violation":{"anchor":"capture.K","code":"@typescript-eslint/no-dupe-class-members","message":"Rename or remove one of the class members named '$KT'; the later one overwrites the earlier.","suppress":{"eslint":{"rules":["@typescript-eslint/no-dupe-class-members"]},"oxlint":{"rules":["no-dupe-class-members"]},"biome":{"rules":["lint/suspicious/noDuplicateClassMembers"]}}}}]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "typescript-eslint-no-duplicate-enum-values",
|
|
4
4
|
"revision": 6,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Give each TypeScript enum member a distinct value; duplicates make members indistinguishable at runtime.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"format":"rerail.policy/v1","id":"typescript-eslint-no-empty-function","revision":7,"mode":"steer","description":"
|
|
1
|
+
{"format":"rerail.policy/v1","id":"typescript-eslint-no-empty-function","revision":7,"mode":"steer","description":"Avoid empty TypeScript functions, methods and arrows; add the missing code or a comment explaining why it is empty.","scope":{"include":["**/*.ts","**/*.tsx","**/*.mts","**/*.cts"],"exclude":[]},"clauses":[{"id":"options","define":{"options":{"allow":{"type":"array","items":"string","default":[]}}}},{"id":"shared","define":{"language":"typescript","utils":{"r1":{"any":[{"kind":"identifier"},{"kind":"property_identifier"}]},"r2":{"any":[{"kind":"property_identifier","pattern":"$NAME"},{"kind":"number","pattern":"$NAME"},{"kind":"string","pattern":"$NAME"},{"has":{"any":[{"kind":"string"},{"kind":"number"},{"kind":"template_string","not":{"has":{"kind":"template_substitution"}}}],"pattern":"$NAME"},"kind":"computed_property_name"}]},"r3":{"all":[{"kind":"method_definition"},{"not":{"has":{"not":{"matches":"r1"},"regex":"^static$"}}},{"has":{"any":[{"kind":"property_identifier","regex":"^constructor$"},{"has":{"kind":"string_fragment","regex":"^constructor$"},"kind":"string"}],"field":"name"}},{"inside":{"kind":"class_body"}}]},"r4":{"any":[{"kind":"function_expression"},{"kind":"function_declaration"}]},"r5":{"has":{"not":{"matches":"r1"},"regex":"^async$"}},"r6":{"any":[{"matches":"r13"},{"regex":"^"}]},"r7":{"not":{"inside":{"any":[{"kind":"pair"},{"kind":"public_field_definition"}],"field":"value","stopBy":{"not":{"kind":"parenthesized_expression"}}}}},"r8":{"has":{"field":"name","kind":"identifier","pattern":"$FID"}},"r9":{"kind":"private_property_identifier","pattern":"$PN"},"r10":{"any":[{"kind":"generator_function"},{"kind":"generator_function_declaration"}]},"r11":{"has":{"not":{"matches":"r1"},"pattern":"$$ST","regex":"^static$"}},"r12":{"follows":{"kind":"decorator","stopBy":{"not":{"kind":"comment"}}}},"r13":{"has":{"not":{"matches":"r1"},"pattern":"$$AS","regex":"^async$"}},"r14":{"any":[{"has":{"pattern":"$$GN","regex":"^\\*$"}},{"regex":"^"}]},"r15":{"all":[{"matches":"r4"},{"not":{"matches":"r5"}}]},"r16":{"has":{"not":{"matches":"r1"},"regex":"^get$"}},"r17":{"has":{"not":{"matches":"r1"},"regex":"^set$"}}}}},{"id":"method","forbid":{"ast":{"language":"typescript","rule":{"kind":"statement_block","regex":"^\\{\\s*\\}","inside":{"field":"body","all":[{"kind":"method_definition"},{"not":{"matches":"r3"}},{"any":[{"matches":"r16"},{"matches":"r17"},{"has":{"regex":"^\\*$"}},{"all":[{"matches":"r5"},{"not":{"has":{"regex":"^\\*$"}}}]},{"$option":"allow","cases":{"[\"methods\"]":[]},"default":[{"all":[{"not":{"matches":"r16"}},{"not":{"matches":"r17"}},{"not":{"has":{"regex":"^\\*$"}}},{"not":{"matches":"r5"}}]}],"spread":true}]},{"any":[{"matches":"r11"},{"kind":"method_definition"}]},{"any":[{"matches":"r13"},{"kind":"method_definition"}]},{"any":[{"has":{"regex":"^\\*$","pattern":"$$GN"}},{"kind":"method_definition"}]},{"any":[{"has":{"regex":"^[gs]et$","not":{"matches":"r1"},"pattern":"$$KW"}},{"has":{"field":"parameters","pattern":"$$KW"}}]},{"any":[{"has":{"field":"name","matches":"r9"}},{"has":{"field":"name","matches":"r2"}},{"regex":"^"}]},{"$option":"allow","cases":{"[\"decoratedFunctions\"]":[{"not":{"$option":"allow","cases":{"[\"overrideMethods\"]":{"has":{"kind":"override_modifier"}}},"default":{"matches":"r12"}}}],"[\"overrideMethods\"]":[{"not":{"$option":"allow","cases":{"[\"overrideMethods\"]":{"has":{"kind":"override_modifier"}}},"default":{"matches":"r12"}}}]},"default":[],"spread":true}]}},"transform":{"STW":{"replace":{"source":"$ST","replace":"^.+$","by":"static "}},"PW":{"replace":{"source":"$PN","replace":"^.+$","by":"private "}},"PNQ":{"replace":{"source":"$PN","replace":"^(.+)$","by":" ${1}"}},"ASW":{"replace":{"source":"$AS","replace":"^.+$","by":"async "}},"GNW":{"replace":{"source":"$GN","replace":"^.+$","by":"generator "}},"NQ":{"replace":{"source":"$NAME","value":true,"replace":"(?s)^(.*)$","by":" '${1}'"}},"KWW":{"replace":{"source":"$KW","replace":"(?s)^\\(.*$","by":"method"}},"KWX":{"replace":{"source":"$KWW","replace":"^([gs])et$","by":"${1}etter"}}}}},"violation":{"anchor":"witness.span","code":"@typescript-eslint/no-empty-function","message":"Add code to this empty $STW$PW$ASW$GNW$KWX$NQ$PNQ, or a comment explaining why it is empty.","suppress":{"eslint":{"rules":["@typescript-eslint/no-empty-function"]},"oxlint":{"rules":["no-empty-function"]},"biome":{"rules":["lint/suspicious/noEmptyBlockStatements"]}}}},{"id":"constructor","forbid":{"ast":{"language":"typescript","rule":{"kind":"statement_block","regex":"^\\{\\s*\\}","inside":{"field":"body","all":[{"matches":"r3"},{"not":{"has":{"field":"parameters","has":{"any":[{"kind":"required_parameter"},{"kind":"optional_parameter"}],"has":{"any":[{"kind":"accessibility_modifier"},{"kind":"override_modifier"},{"regex":"^readonly$","not":{"matches":"r1"}}]}}}}},{"$option":"allow","cases":{"[\"private-constructors\"]":[{"not":{"has":{"kind":"accessibility_modifier","regex":{"$option":"allow","cases":{"[\"protected-constructors\"]":"^protected$"},"default":"^private$"}}}}],"[\"protected-constructors\"]":[{"not":{"has":{"kind":"accessibility_modifier","regex":{"$option":"allow","cases":{"[\"protected-constructors\"]":"^protected$"},"default":"^private$"}}}}]},"default":[],"spread":true}]}},"when":{"option":{"allow":{"in":[[],["methods"],["private-constructors"],["protected-constructors"],["decoratedFunctions"],["overrideMethods"]]}}}}},"violation":{"anchor":"witness.span","code":"@typescript-eslint/no-empty-function","message":"Add code to this empty constructor, or a comment explaining why it is empty.","suppress":{"eslint":{"rules":["@typescript-eslint/no-empty-function"]},"oxlint":{"rules":["no-empty-function"]},"biome":{"rules":["lint/suspicious/noEmptyBlockStatements"]}}}},{"id":"member-function","forbid":{"ast":{"language":"typescript","rule":{"kind":"statement_block","regex":"^\\{\\s*\\}","inside":{"field":"body","all":[{"any":[{"matches":"r15"},{"all":[{"matches":"r4"},{"matches":"r5"}]},{"matches":"r10"},{"kind":"arrow_function"}]},{"matches":"r6"},{"matches":"r14"},{"inside":{"field":"value","stopBy":{"not":{"kind":"parenthesized_expression"}},"any":[{"kind":"pair"},{"kind":"public_field_definition"}],"all":[{"any":[{"matches":"r11"},{"regex":"^"}]},{"any":[{"all":[{"kind":"pair"},{"any":[{"has":{"field":"key","matches":"r9"}},{"has":{"field":"key","matches":"r2"}},{"has":{"field":"value","matches":"r8"}},{"regex":"^"}]}]},{"all":[{"kind":"public_field_definition"},{"any":[{"has":{"field":"name","matches":"r9"}},{"has":{"field":"name","matches":"r2"}},{"has":{"field":"value","matches":"r8"}},{"regex":"^"}]}]}]}]}}]}},"transform":{"STW":{"replace":{"source":"$ST","replace":"^.+$","by":"static "}},"PW":{"replace":{"source":"$PN","replace":"^.+$","by":"private "}},"PNQ":{"replace":{"source":"$PN","replace":"^(.+)$","by":" ${1}"}},"ASW":{"replace":{"source":"$AS","replace":"^.+$","by":"async "}},"GNW":{"replace":{"source":"$GN","replace":"^.+$","by":"generator "}},"NQ":{"replace":{"source":"$NAME","value":true,"replace":"(?s)^(.*)$","by":" '${1}'"}},"FQ":{"replace":{"source":"$FID","replace":"^(.+)$","by":" '${1}'"}}}}},"violation":{"anchor":"witness.span","code":"@typescript-eslint/no-empty-function","message":"Add code to this empty $STW$PW$ASW$GNWmethod$NQ$PNQ$FQ, or a comment explaining why it is empty.","suppress":{"eslint":{"rules":["@typescript-eslint/no-empty-function"]},"oxlint":{"rules":["no-empty-function"]},"biome":{"rules":["lint/suspicious/noEmptyBlockStatements"]}}}},{"id":"function","forbid":{"ast":{"language":"typescript","rule":{"kind":"statement_block","regex":"^\\{\\s*\\}","inside":{"field":"body","all":[{"any":[{"matches":"r15"},{"all":[{"matches":"r4"},{"matches":"r5"}]},{"matches":"r10"}]},{"matches":"r7"},{"matches":"r6"},{"matches":"r14"},{"any":[{"matches":"r8"},{"regex":"^"}]}]}},"transform":{"ASW":{"replace":{"source":"$AS","replace":"^.+$","by":"async "}},"GNW":{"replace":{"source":"$GN","replace":"^.+$","by":"generator "}},"FQ":{"replace":{"source":"$FID","replace":"^(.+)$","by":" '${1}'"}}}}},"violation":{"anchor":"witness.span","code":"@typescript-eslint/no-empty-function","message":"Add code to this empty $ASW$GNWfunction$FQ, or a comment explaining why it is empty.","suppress":{"eslint":{"rules":["@typescript-eslint/no-empty-function"]},"oxlint":{"rules":["no-empty-function"]},"biome":{"rules":["lint/suspicious/noEmptyBlockStatements"]}}}},{"id":"arrow-function","forbid":{"ast":{"language":"typescript","rule":{"kind":"statement_block","regex":"^\\{\\s*\\}","inside":{"field":"body","all":[{"kind":"arrow_function"},{"matches":"r7"},{"matches":"r6"}]}},"transform":{"ASW":{"replace":{"source":"$AS","replace":"^.+$","by":"async "}}}}},"violation":{"anchor":"witness.span","code":"@typescript-eslint/no-empty-function","message":"Add code to this empty $ASWarrow function, or a comment explaining why it is empty.","suppress":{"eslint":{"rules":["@typescript-eslint/no-empty-function"]},"oxlint":{"rules":["no-empty-function"]},"biome":{"rules":["lint/suspicious/noEmptyBlockStatements"]}}}}]}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "typescript-eslint-no-empty-object-type",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Avoid empty TypeScript interfaces and the empty object type; both accept any non-nullish value, so use object, unknown or the extended type instead.",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "shared",
|
|
16
|
+
"define": {
|
|
17
|
+
"language": "typescript",
|
|
18
|
+
"utils": {
|
|
19
|
+
"member": {
|
|
20
|
+
"any": [
|
|
21
|
+
{
|
|
22
|
+
"kind": "property_signature"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"kind": "method_signature"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"kind": "call_signature"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"kind": "construct_signature"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"kind": "index_signature"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"reported-parent": {
|
|
39
|
+
"any": [
|
|
40
|
+
{
|
|
41
|
+
"kind": "parenthesized_type",
|
|
42
|
+
"inside": {
|
|
43
|
+
"matches": "reported-parent"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"kind": "adding_type_annotation"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"kind": "ambient_declaration"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"kind": "array_type"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"kind": "as_expression"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"kind": "conditional_type"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"kind": "constraint"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"kind": "constructor_type"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"kind": "default_type"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"kind": "flow_maybe_type"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"kind": "function_type"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"kind": "implements_clause"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"kind": "index_signature"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"kind": "index_type_query"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"kind": "infer_type"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"kind": "lookup_type"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"kind": "mapped_type_clause"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"kind": "omitting_type_annotation"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"kind": "opting_type_annotation"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"kind": "optional_type"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"kind": "readonly_type"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"kind": "rest_type"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"kind": "satisfies_expression"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"kind": "template_type"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"kind": "tuple_type"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"kind": "type_alias_declaration"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"kind": "type_annotation"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"kind": "type_arguments"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"kind": "type_predicate"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"kind": "union_type"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"id": "empty-interface",
|
|
140
|
+
"forbid": {
|
|
141
|
+
"ast": {
|
|
142
|
+
"language": "typescript",
|
|
143
|
+
"rule": {
|
|
144
|
+
"kind": "interface_declaration",
|
|
145
|
+
"all": [
|
|
146
|
+
{
|
|
147
|
+
"has": {
|
|
148
|
+
"field": "name",
|
|
149
|
+
"pattern": "$NAME"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"has": {
|
|
154
|
+
"field": "body",
|
|
155
|
+
"not": {
|
|
156
|
+
"has": {
|
|
157
|
+
"matches": "member"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"not": {
|
|
164
|
+
"has": {
|
|
165
|
+
"kind": "extends_type_clause",
|
|
166
|
+
"has": {
|
|
167
|
+
"regex": "^,$"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"violation": {
|
|
177
|
+
"anchor": "capture.NAME",
|
|
178
|
+
"code": "@typescript-eslint/no-empty-object-type",
|
|
179
|
+
"message": "An empty interface allows any non-nullish value, and one extending a single type is equivalent to that supertype: use `object`, `unknown` or a type alias instead.",
|
|
180
|
+
"suppress": {
|
|
181
|
+
"eslint": {
|
|
182
|
+
"rules": [
|
|
183
|
+
"@typescript-eslint/no-empty-object-type"
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"id": "empty-object-type",
|
|
191
|
+
"forbid": {
|
|
192
|
+
"ast": {
|
|
193
|
+
"language": "typescript",
|
|
194
|
+
"rule": {
|
|
195
|
+
"kind": "object_type",
|
|
196
|
+
"not": {
|
|
197
|
+
"has": {
|
|
198
|
+
"matches": "member"
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"inside": {
|
|
202
|
+
"matches": "reported-parent"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"violation": {
|
|
208
|
+
"anchor": "witness.span",
|
|
209
|
+
"code": "@typescript-eslint/no-empty-object-type",
|
|
210
|
+
"message": "The `{}` (\"empty object\") type allows any non-nullish value, including literals like `0` and `\"\"`: use `object` for any object or `unknown` for any value.",
|
|
211
|
+
"suppress": {
|
|
212
|
+
"eslint": {
|
|
213
|
+
"rules": [
|
|
214
|
+
"@typescript-eslint/no-empty-object-type"
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "typescript-eslint-no-extra-non-null-assertion",
|
|
4
4
|
"revision": 4,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Remove repeated non-null assertions and ones placed before an optional chain; they add nothing.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "typescript-eslint-no-import-type-side-effects",
|
|
4
4
|
"revision": 3,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Use a top-level import type when every imported name is an inline type import; otherwise a side-effect import stays at runtime.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"violation": {
|
|
107
107
|
"anchor": "witness.span",
|
|
108
108
|
"code": "@typescript-eslint/no-import-type-side-effects",
|
|
109
|
-
"message": "
|
|
109
|
+
"message": "Replace the inline `type` qualifiers with one top-level `import type` so the whole import is erased.",
|
|
110
110
|
"suppress": {
|
|
111
111
|
"eslint": {
|
|
112
112
|
"rules": [
|
|
@@ -233,7 +233,7 @@
|
|
|
233
233
|
"violation": {
|
|
234
234
|
"anchor": "witness.span",
|
|
235
235
|
"code": "@typescript-eslint/no-import-type-side-effects",
|
|
236
|
-
"message": "
|
|
236
|
+
"message": "Replace the inline `type` qualifiers with one top-level `import type` so the whole import is erased.",
|
|
237
237
|
"fix": "import type { $A } from $S;",
|
|
238
238
|
"suppress": {
|
|
239
239
|
"eslint": {
|
|
@@ -355,7 +355,7 @@
|
|
|
355
355
|
"violation": {
|
|
356
356
|
"anchor": "witness.span",
|
|
357
357
|
"code": "@typescript-eslint/no-import-type-side-effects",
|
|
358
|
-
"message": "
|
|
358
|
+
"message": "Replace the inline `type` qualifiers with one top-level `import type` so the whole import is erased.",
|
|
359
359
|
"fix": "import type { $A as $B } from $S;",
|
|
360
360
|
"suppress": {
|
|
361
361
|
"eslint": {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "typescript-eslint-no-namespace",
|
|
4
4
|
"revision": 7,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Use ES module imports and exports instead of TypeScript namespaces and custom modules; global augmentations, named module declarations and .d.ts files are exempt.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "typescript-eslint-no-non-null-asserted-optional-chain",
|
|
4
4
|
"revision": 4,
|
|
5
5
|
"mode": "steer",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Don't put a non-null assertion on an optional chain; the chain can return undefined by design, so the assertion hides a real case.",
|
|
7
7
|
"scope": {
|
|
8
8
|
"include": [
|
|
9
9
|
"**/*.ts",
|