@neralabs/rerail-pack-typescript 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +8 -0
  3. package/README.md +36 -0
  4. package/licenses/eslint-plugin-vitest/LICENSE +21 -0
  5. package/licenses/eslint-plugin-vitest/UPSTREAM.md +103 -0
  6. package/licenses/typescript-eslint/LICENSE +21 -0
  7. package/licenses/typescript-eslint/UPSTREAM.md +1607 -0
  8. package/pack.json +189 -0
  9. package/package.json +30 -0
  10. package/rules/typescript-eslint-ban-tslint-comment.json +33 -0
  11. package/rules/typescript-eslint-consistent-type-definitions.json +1 -0
  12. package/rules/typescript-eslint-default-param-last.json +55 -0
  13. package/rules/typescript-eslint-no-array-constructor.json +238 -0
  14. package/rules/typescript-eslint-no-confusing-non-null-assertion.json +190 -0
  15. package/rules/typescript-eslint-no-dupe-class-members.json +1 -0
  16. package/rules/typescript-eslint-no-duplicate-enum-values.json +178 -0
  17. package/rules/typescript-eslint-no-empty-function.json +1 -0
  18. package/rules/typescript-eslint-no-extra-non-null-assertion.json +84 -0
  19. package/rules/typescript-eslint-no-import-type-side-effects.json +336 -0
  20. package/rules/typescript-eslint-no-namespace.json +157 -0
  21. package/rules/typescript-eslint-no-non-null-asserted-optional-chain.json +173 -0
  22. package/rules/typescript-eslint-no-non-null-assertion.json +195 -0
  23. package/rules/typescript-eslint-no-unnecessary-type-constraint.json +66 -0
  24. package/rules/typescript-eslint-no-unsafe-function-type.json +50 -0
  25. package/rules/typescript-eslint-no-unused-expressions.json +1 -0
  26. package/rules/typescript-eslint-no-useless-empty-export.json +38 -0
  27. package/rules/typescript-eslint-no-wrapper-object-types.json +568 -0
  28. package/rules/typescript-eslint-prefer-as-const.json +224 -0
  29. package/rules/typescript-eslint-prefer-enum-initializers.json +26 -0
  30. package/rules/typescript-eslint-prefer-literal-enum-member.json +1 -0
  31. package/rules/typescript-eslint-prefer-namespace-keyword.json +98 -0
@@ -0,0 +1,224 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "typescript-eslint-prefer-as-const",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "typescript-eslint 8.70.1 @typescript-eslint/prefer-as-const, default options. Port of typescript-eslint's `prefer-as-const` rule (https://typescript-eslint.io/rules/prefer-as-const). Flags a literal type that repeats the raw text of the literal it asserts (`x as 'a'`, `<'a'>x`) or annotates (`let v: 'a' = 'a'`, class fields); assertions are fixed to `const`.",
7
+ "scope": {
8
+ "include": [
9
+ "**/*.ts",
10
+ "**/*.tsx",
11
+ "**/*.mts",
12
+ "**/*.cts",
13
+ "**/*.js",
14
+ "**/*.jsx",
15
+ "**/*.mjs",
16
+ "**/*.cjs"
17
+ ],
18
+ "exclude": []
19
+ },
20
+ "clauses": [
21
+ {
22
+ "id": "literal-assertion",
23
+ "forbid": {
24
+ "ast": {
25
+ "language": "typescript",
26
+ "rule": {
27
+ "all": [
28
+ {
29
+ "kind": "literal_type",
30
+ "pattern": "$T"
31
+ },
32
+ {
33
+ "matches": "literal-type"
34
+ },
35
+ {
36
+ "any": [
37
+ {
38
+ "inside": {
39
+ "kind": "as_expression",
40
+ "stopBy": "neighbor",
41
+ "has": {
42
+ "matches": "value-literal",
43
+ "stopBy": "neighbor"
44
+ }
45
+ }
46
+ },
47
+ {
48
+ "inside": {
49
+ "kind": "type_arguments",
50
+ "stopBy": "neighbor",
51
+ "inside": {
52
+ "kind": "type_assertion",
53
+ "stopBy": "neighbor",
54
+ "has": {
55
+ "matches": "value-literal",
56
+ "stopBy": "neighbor"
57
+ }
58
+ }
59
+ }
60
+ }
61
+ ]
62
+ },
63
+ {
64
+ "compare": {
65
+ "left": "T",
66
+ "op": "eq",
67
+ "right": "V"
68
+ }
69
+ }
70
+ ]
71
+ },
72
+ "utils": {
73
+ "literal-type": {
74
+ "has": {
75
+ "any": [
76
+ {
77
+ "kind": "string"
78
+ },
79
+ {
80
+ "kind": "number"
81
+ },
82
+ {
83
+ "kind": "true"
84
+ },
85
+ {
86
+ "kind": "false"
87
+ }
88
+ ],
89
+ "stopBy": "neighbor"
90
+ }
91
+ },
92
+ "value-literal": {
93
+ "any": [
94
+ {
95
+ "kind": "string"
96
+ },
97
+ {
98
+ "kind": "number"
99
+ },
100
+ {
101
+ "kind": "true"
102
+ },
103
+ {
104
+ "kind": "false"
105
+ }
106
+ ],
107
+ "pattern": "$V"
108
+ }
109
+ }
110
+ }
111
+ },
112
+ "violation": {
113
+ "anchor": "witness.span",
114
+ "code": "@typescript-eslint/prefer-as-const",
115
+ "message": "Expected a `const` instead of a literal type assertion.",
116
+ "fix": "const",
117
+ "suppress": {
118
+ "eslint": {
119
+ "rules": [
120
+ "@typescript-eslint/prefer-as-const"
121
+ ]
122
+ }
123
+ }
124
+ }
125
+ },
126
+ {
127
+ "id": "literal-annotation",
128
+ "forbid": {
129
+ "ast": {
130
+ "language": "typescript",
131
+ "rule": {
132
+ "all": [
133
+ {
134
+ "kind": "literal_type",
135
+ "pattern": "$T"
136
+ },
137
+ {
138
+ "matches": "literal-type"
139
+ },
140
+ {
141
+ "inside": {
142
+ "kind": "type_annotation",
143
+ "stopBy": "neighbor",
144
+ "inside": {
145
+ "any": [
146
+ {
147
+ "kind": "variable_declarator"
148
+ },
149
+ {
150
+ "kind": "public_field_definition"
151
+ }
152
+ ],
153
+ "stopBy": "neighbor",
154
+ "has": {
155
+ "matches": "value-literal",
156
+ "stopBy": "neighbor"
157
+ }
158
+ }
159
+ }
160
+ },
161
+ {
162
+ "compare": {
163
+ "left": "T",
164
+ "op": "eq",
165
+ "right": "V"
166
+ }
167
+ }
168
+ ]
169
+ },
170
+ "utils": {
171
+ "literal-type": {
172
+ "has": {
173
+ "any": [
174
+ {
175
+ "kind": "string"
176
+ },
177
+ {
178
+ "kind": "number"
179
+ },
180
+ {
181
+ "kind": "true"
182
+ },
183
+ {
184
+ "kind": "false"
185
+ }
186
+ ],
187
+ "stopBy": "neighbor"
188
+ }
189
+ },
190
+ "value-literal": {
191
+ "any": [
192
+ {
193
+ "kind": "string"
194
+ },
195
+ {
196
+ "kind": "number"
197
+ },
198
+ {
199
+ "kind": "true"
200
+ },
201
+ {
202
+ "kind": "false"
203
+ }
204
+ ],
205
+ "pattern": "$V"
206
+ }
207
+ }
208
+ }
209
+ },
210
+ "violation": {
211
+ "anchor": "witness.span",
212
+ "code": "@typescript-eslint/prefer-as-const",
213
+ "message": "Expected a `const` assertion instead of a literal type annotation.",
214
+ "suppress": {
215
+ "eslint": {
216
+ "rules": [
217
+ "@typescript-eslint/prefer-as-const"
218
+ ]
219
+ }
220
+ }
221
+ }
222
+ }
223
+ ]
224
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "typescript-eslint-prefer-enum-initializers",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "Port of typescript-eslint's `prefer-enum-initializers` rule (https://typescript-eslint.io/rules/prefer-enum-initializers). Flags enum members without an initializer.",
7
+ "scope": { "include": ["**/*"], "exclude": [] },
8
+ "clauses": [
9
+ {
10
+ "id": "enum-member-without-initializer",
11
+ "forbid": {
12
+ "ast": {
13
+ "language": "typescript",
14
+ "rule": {
15
+ "all": [
16
+ { "any": [{ "kind": "property_identifier" }, { "kind": "string" }, { "kind": "computed_property_name" }] },
17
+ { "pattern": "$NAME" }
18
+ ],
19
+ "inside": { "kind": "enum_body", "stopBy": "neighbor" }
20
+ }
21
+ }
22
+ },
23
+ "violation": { "anchor": "witness.span", "code": "@typescript-eslint/prefer-enum-initializers", "message": "The value of the member '$NAME' should be explicitly defined." }
24
+ }
25
+ ]
26
+ }
@@ -0,0 +1 @@
1
+ {"format":"rerail.policy/v1","id":"typescript-eslint-prefer-literal-enum-member","revision":2,"mode":"steer","description":"Port of typescript-eslint's `prefer-literal-enum-member` rule (https://typescript-eslint.io/rules/prefer-literal-enum-member). Reports an enum member initialized with anything but a literal, a template literal without substitutions, or a signed one. Options are declared in the `options` define (the rule's defaults); a variant is a config patch.","scope":{"include":["**/*"],"exclude":[]},"clauses":[{"id":"options","define":{"options":{"allowBitwiseExpressions":{"type":"boolean","nullable":true,"default":null}}}},{"id":"shared","define":{"language":"typescript","utils":{"r1":{"any":[{"kind":"comment"},{"regex":"^(&|\\^|<<|>>|>>>|\\|)$"},{"regex":"^[-+~()]$"}]},"r2":{"has":{"kind":"string_fragment","pattern":"$SM","stopBy":"neighbor"},"kind":"string"},"r3":{"has":{"kind":"identifier","pattern":"$EN","stopBy":"neighbor"}},"r4":{"has":{"regex":"^(&|\\^|<<|>>|>>>|\\|)$","stopBy":"neighbor"}}}}},{"id":"non-literal-member","forbid":{"ast":{"language":"typescript","utils":{"literal":{"any":[{"kind":"number"},{"kind":"string"},{"kind":"true"},{"kind":"false"},{"kind":"null"},{"kind":"regex"},{"kind":"template_string","not":{"has":{"kind":"template_substitution","stopBy":"neighbor"}}}]},"allowed":{"any":[{"kind":"parenthesized_expression","all":[{"not":{"has":{"not":{"matches":"r1"},"all":[{"not":{"matches":"allowed"}}],"stopBy":"neighbor"}}}]},{"matches":"literal"},{"kind":"unary_expression","all":[{"has":{"regex":"^[-+]$","stopBy":"neighbor"}},{"not":{"has":{"not":{"matches":"r1"},"all":[{"not":{"matches":"allowed"}}],"stopBy":"neighbor"}}}]},{"$option":"allowBitwiseExpressions","cases":{"true":[{"kind":"unary_expression","all":[{"has":{"regex":"^~$","stopBy":"neighbor"}},{"not":{"has":{"not":{"matches":"r1"},"all":[{"not":{"matches":"allowed-bitwise"}}],"stopBy":"neighbor"}}}]}]},"default":[],"spread":true},{"$option":"allowBitwiseExpressions","cases":{"true":[{"kind":"binary_expression","all":[{"matches":"r4"},{"not":{"has":{"not":{"matches":"r1"},"all":[{"not":{"matches":"allowed-bitwise"}}],"stopBy":"neighbor"}}}]}]},"default":[],"spread":true}]},"allowed-bitwise":{"any":[{"kind":"parenthesized_expression","all":[{"not":{"has":{"not":{"matches":"r1"},"all":[{"not":{"matches":"allowed-bitwise"}}],"stopBy":"neighbor"}}}]},{"matches":"literal"},{"kind":"unary_expression","all":[{"has":{"regex":"^[-+]$","stopBy":"neighbor"}},{"not":{"has":{"not":{"matches":"r1"},"all":[{"not":{"matches":"allowed-bitwise"}}],"stopBy":"neighbor"}}}]},{"kind":"unary_expression","all":[{"has":{"regex":"^~$","stopBy":"neighbor"}},{"not":{"has":{"not":{"matches":"r1"},"all":[{"not":{"matches":"allowed-bitwise"}}],"stopBy":"neighbor"}}}]},{"kind":"binary_expression","all":[{"matches":"r4"},{"not":{"has":{"not":{"matches":"r1"},"all":[{"not":{"matches":"allowed-bitwise"}}],"stopBy":"neighbor"}}}]},{"matches":"self-member"}]},"member-named":{"any":[{"kind":"property_identifier","pattern":"$SM"},{"matches":"r2"},{"kind":"enum_assignment","has":{"any":[{"kind":"property_identifier","pattern":"$SM"},{"matches":"r2"}],"stopBy":"neighbor"}}]},"self-member":{"any":[{"kind":"identifier","pattern":"$SM","inside":{"stopBy":"end","kind":"enum_body","has":{"matches":"member-named","stopBy":"neighbor"}}},{"all":[{"any":[{"kind":"member_expression","has":{"kind":"property_identifier","pattern":"$SM","stopBy":"neighbor"}},{"kind":"subscript_expression","has":{"stopBy":"neighbor","matches":"r2"}}]},{"matches":"r3"},{"inside":{"stopBy":"end","kind":"enum_declaration","all":[{"matches":"r3"},{"has":{"kind":"enum_body","has":{"matches":"member-named","stopBy":"neighbor"},"stopBy":"neighbor"}}]}}]}]}},"rule":{"kind":"enum_assignment","all":[{"has":{"any":[{"kind":"property_identifier"},{"kind":"string"},{"kind":"computed_property_name"},{"kind":"number"}],"pattern":"$NAME","precedes":{"regex":"^=$","stopBy":"end"},"stopBy":"neighbor"}},{"has":{"not":{"kind":"comment"},"follows":{"regex":"^=$","stopBy":"end"},"all":[{"not":{"matches":"allowed"}}],"stopBy":"neighbor"}}]}}},"violation":{"anchor":"capture.NAME","code":"@typescript-eslint/prefer-literal-enum-member","message":{"$option":"allowBitwiseExpressions","cases":{"true":"Explicit enum value must only be a literal value (string or number) or a bitwise expression."},"default":"Explicit enum value must only be a literal value (string or number)."}}}]}
@@ -0,0 +1,98 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "typescript-eslint-prefer-namespace-keyword",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "Port of typescript-eslint's `prefer-namespace-keyword` rule (https://typescript-eslint.io/rules/prefer-namespace-keyword). Flags `module Name {}` declarations with an identifier name; reports the whole declaration (from `declare` when present) and fixes the keyword.",
7
+ "scope": {
8
+ "include": [
9
+ "**/*"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "declared-module-keyword",
16
+ "forbid": {
17
+ "ast": {
18
+ "language": "typescript",
19
+ "rule": {
20
+ "all": [
21
+ {
22
+ "regex": "^module$",
23
+ "precedes": {
24
+ "any": [
25
+ {
26
+ "kind": "identifier"
27
+ },
28
+ {
29
+ "kind": "nested_identifier"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "inside": {
36
+ "kind": "module",
37
+ "pattern": "$M",
38
+ "inside": {
39
+ "kind": "ambient_declaration",
40
+ "pattern": "$D"
41
+ }
42
+ }
43
+ }
44
+ ]
45
+ }
46
+ }
47
+ },
48
+ "violation": {
49
+ "anchor": "capture.D",
50
+ "code": "@typescript-eslint/prefer-namespace-keyword",
51
+ "message": "Use 'namespace' instead of 'module' to declare custom TypeScript modules.",
52
+ "fix": "namespace"
53
+ }
54
+ },
55
+ {
56
+ "id": "module-keyword",
57
+ "forbid": {
58
+ "ast": {
59
+ "language": "typescript",
60
+ "rule": {
61
+ "all": [
62
+ {
63
+ "regex": "^module$",
64
+ "precedes": {
65
+ "any": [
66
+ {
67
+ "kind": "identifier"
68
+ },
69
+ {
70
+ "kind": "nested_identifier"
71
+ }
72
+ ]
73
+ }
74
+ },
75
+ {
76
+ "inside": {
77
+ "kind": "module",
78
+ "pattern": "$M",
79
+ "not": {
80
+ "inside": {
81
+ "kind": "ambient_declaration"
82
+ }
83
+ }
84
+ }
85
+ }
86
+ ]
87
+ }
88
+ }
89
+ },
90
+ "violation": {
91
+ "anchor": "capture.M",
92
+ "code": "@typescript-eslint/prefer-namespace-keyword",
93
+ "message": "Use 'namespace' instead of 'module' to declare custom TypeScript modules.",
94
+ "fix": "namespace"
95
+ }
96
+ }
97
+ ]
98
+ }