@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,195 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "typescript-eslint-no-non-null-assertion",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "typescript-eslint 8.70.1 @typescript-eslint/no-non-null-assertion, default options. Port of typescript-eslint's `no-non-null-assertion` rule (https://typescript-eslint.io/rules/no-non-null-assertion). Flags every non-null assertion `x!`. Where the grammar misparses a prefix operator applied to an assertion (`!x!` as `(!x)!`), the finding starts at the real operand.",
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": "non-null-assertion",
23
+ "forbid": {
24
+ "ast": {
25
+ "language": "typescript",
26
+ "utils": {
27
+ "prefix-operation": {
28
+ "any": [
29
+ {
30
+ "kind": "unary_expression"
31
+ },
32
+ {
33
+ "kind": "update_expression",
34
+ "has": {
35
+ "regex": "^(?:\\+\\+|--)$",
36
+ "not": {
37
+ "follows": {
38
+ "regex": "[\\s\\S]"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ ]
44
+ },
45
+ "operand-start": {
46
+ "any": [
47
+ {
48
+ "not": {
49
+ "matches": "prefix-operation"
50
+ },
51
+ "pattern": "$START"
52
+ },
53
+ {
54
+ "matches": "prefix-operation",
55
+ "has": {
56
+ "not": {
57
+ "regex": "^(?:!|~|\\+|-|\\+\\+|--|typeof|void|delete)$"
58
+ },
59
+ "matches": "operand-start"
60
+ }
61
+ }
62
+ ]
63
+ },
64
+ "misparsed": {
65
+ "kind": "non_null_expression",
66
+ "has": {
67
+ "stopBy": "neighbor",
68
+ "any": [
69
+ {
70
+ "matches": "prefix-operation"
71
+ },
72
+ {
73
+ "matches": "misparsed"
74
+ }
75
+ ]
76
+ }
77
+ }
78
+ },
79
+ "rule": {
80
+ "kind": "non_null_expression",
81
+ "not": {
82
+ "matches": "misparsed"
83
+ }
84
+ }
85
+ }
86
+ },
87
+ "violation": {
88
+ "anchor": "witness.span",
89
+ "code": "@typescript-eslint/no-non-null-assertion",
90
+ "message": "Forbidden non-null assertion.",
91
+ "suppress": {
92
+ "eslint": {
93
+ "rules": [
94
+ "@typescript-eslint/no-non-null-assertion"
95
+ ]
96
+ }
97
+ }
98
+ }
99
+ },
100
+ {
101
+ "id": "non-null-assertion-under-prefix",
102
+ "forbid": {
103
+ "ast": {
104
+ "language": "typescript",
105
+ "utils": {
106
+ "prefix-operation": {
107
+ "any": [
108
+ {
109
+ "kind": "unary_expression"
110
+ },
111
+ {
112
+ "kind": "update_expression",
113
+ "has": {
114
+ "regex": "^(?:\\+\\+|--)$",
115
+ "not": {
116
+ "follows": {
117
+ "regex": "[\\s\\S]"
118
+ }
119
+ }
120
+ }
121
+ }
122
+ ]
123
+ },
124
+ "operand-start": {
125
+ "any": [
126
+ {
127
+ "not": {
128
+ "matches": "prefix-operation"
129
+ },
130
+ "pattern": "$START"
131
+ },
132
+ {
133
+ "matches": "prefix-operation",
134
+ "has": {
135
+ "not": {
136
+ "regex": "^(?:!|~|\\+|-|\\+\\+|--|typeof|void|delete)$"
137
+ },
138
+ "matches": "operand-start"
139
+ }
140
+ }
141
+ ]
142
+ },
143
+ "misparsed": {
144
+ "kind": "non_null_expression",
145
+ "has": {
146
+ "stopBy": "neighbor",
147
+ "any": [
148
+ {
149
+ "matches": "prefix-operation"
150
+ },
151
+ {
152
+ "matches": "misparsed"
153
+ }
154
+ ]
155
+ }
156
+ }
157
+ },
158
+ "rule": {
159
+ "matches": "misparsed",
160
+ "has": {
161
+ "stopBy": "end",
162
+ "all": [
163
+ {
164
+ "not": {
165
+ "follows": {
166
+ "regex": "[\\s\\S]"
167
+ }
168
+ }
169
+ },
170
+ {
171
+ "matches": "prefix-operation"
172
+ },
173
+ {
174
+ "matches": "operand-start"
175
+ }
176
+ ]
177
+ }
178
+ }
179
+ }
180
+ },
181
+ "violation": {
182
+ "anchor": "capture.START",
183
+ "code": "@typescript-eslint/no-non-null-assertion",
184
+ "message": "Forbidden non-null assertion.",
185
+ "suppress": {
186
+ "eslint": {
187
+ "rules": [
188
+ "@typescript-eslint/no-non-null-assertion"
189
+ ]
190
+ }
191
+ }
192
+ }
193
+ }
194
+ ]
195
+ }
@@ -0,0 +1,66 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "typescript-eslint-no-unnecessary-type-constraint",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "Port of typescript-eslint's `no-unnecessary-type-constraint` (https://typescript-eslint.io/rules/no-unnecessary-type-constraint). Flags type parameters constrained to `any` or `unknown`.",
7
+ "scope": {
8
+ "include": [
9
+ "**/*"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "unnecessary-constraint",
16
+ "forbid": {
17
+ "ast": {
18
+ "language": "typescript",
19
+ "rule": {
20
+ "kind": "type_parameter",
21
+ "all": [
22
+ {
23
+ "has": {
24
+ "stopBy": "neighbor",
25
+ "all": [
26
+ {
27
+ "kind": "type_identifier"
28
+ },
29
+ {
30
+ "pattern": "$NAME"
31
+ }
32
+ ]
33
+ }
34
+ },
35
+ {
36
+ "has": {
37
+ "kind": "constraint",
38
+ "stopBy": "neighbor",
39
+ "has": {
40
+ "stopBy": "neighbor",
41
+ "all": [
42
+ {
43
+ "kind": "predefined_type"
44
+ },
45
+ {
46
+ "regex": "^(any|unknown)$"
47
+ },
48
+ {
49
+ "pattern": "$CONSTRAINT"
50
+ }
51
+ ]
52
+ }
53
+ }
54
+ }
55
+ ]
56
+ }
57
+ }
58
+ },
59
+ "violation": {
60
+ "anchor": "witness.span",
61
+ "code": "@typescript-eslint/no-unnecessary-type-constraint",
62
+ "message": "Constraining the generic type `$NAME` to `$CONSTRAINT` does nothing and is unnecessary."
63
+ }
64
+ }
65
+ ]
66
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "typescript-eslint-no-unsafe-function-type",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "typescript-eslint 8.70.1 @typescript-eslint/no-unsafe-function-type, default options. Port of typescript-eslint's `no-unsafe-function-type` rule (https://typescript-eslint.io/rules/no-unsafe-function-type). Flags the global `Function` type used as a type reference, class implements or interface extends: a `type_identifier` reference that `resolves` to no file-local type binding.",
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": "function-type",
23
+ "forbid": {
24
+ "ast": {
25
+ "language": "typescript",
26
+ "rule": {
27
+ "kind": "type_identifier",
28
+ "resolves": {
29
+ "global": [
30
+ "Function"
31
+ ]
32
+ }
33
+ }
34
+ }
35
+ },
36
+ "violation": {
37
+ "anchor": "witness.span",
38
+ "code": "@typescript-eslint/no-unsafe-function-type",
39
+ "message": "The `Function` type accepts any function-like value.\nPrefer explicitly defining any function parameters and return type.",
40
+ "suppress": {
41
+ "eslint": {
42
+ "rules": [
43
+ "@typescript-eslint/no-unsafe-function-type"
44
+ ]
45
+ }
46
+ }
47
+ }
48
+ }
49
+ ]
50
+ }
@@ -0,0 +1 @@
1
+ {"format":"rerail.policy/v1","id":"typescript-eslint-no-unused-expressions","revision":2,"mode":"steer","description":"Port of typescript-eslint's `no-unused-expressions` (https://typescript-eslint.io/rules/no-unused-expressions), an extension of ESLint's rule,; same document shape as the ESLint port. Flags an expression statement whose expression (through parentheses and TS `as`/`<T>`/`!`/instantiation wrappers) is not a call, `new`, assignment, update, `await`, `yield`, `import()`, `void` or `delete`; directive prologue strings are exempt. 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":{"allowShortCircuit":{"type":"boolean","nullable":true,"default":null},"allowTernary":{"type":"boolean","nullable":true,"default":null}}}},{"id":"unused-expression","forbid":{"ast":{"language":"typescript","rule":{"kind":"expression_statement","all":[{"not":{"matches":"directive"}},{"has":{"stopBy":"neighbor","matches":"disallowed"}}]},"utils":{"disallowed":{"any":[{"kind":"array"},{"kind":"arrow_function"},{"kind":"class"},{"kind":"function_expression"},{"kind":"generator_function"},{"kind":"identifier"},{"kind":"undefined"},{"kind":"number"},{"kind":"string"},{"kind":"true"},{"kind":"false"},{"kind":"null"},{"kind":"regex"},{"kind":"template_string"},{"kind":"member_expression"},{"kind":"subscript_expression"},{"kind":"meta_property"},{"kind":"object"},{"kind":"sequence_expression"},{"kind":"this"},{"kind":"super"},{"kind":"unary_expression","not":{"has":{"regex":"^(void|delete)$","stopBy":"neighbor"}}},{"kind":"parenthesized_expression","has":{"stopBy":"neighbor","all":[{"not":{"kind":"type_arguments"}},{"matches":"disallowed"}]}},{"kind":"as_expression","has":{"stopBy":"neighbor","all":[{"not":{"kind":"type_arguments"}},{"matches":"disallowed"}]}},{"kind":"type_assertion","has":{"stopBy":"neighbor","all":[{"not":{"kind":"type_arguments"}},{"matches":"disallowed"}]}},{"kind":"non_null_expression","has":{"stopBy":"neighbor","all":[{"not":{"kind":"type_arguments"}},{"matches":"disallowed"}]}},{"kind":"instantiation_expression","has":{"stopBy":"neighbor","all":[{"not":{"kind":"type_arguments"}},{"matches":"disallowed"}]}},{"$option":"allowShortCircuit","cases":{"true":[]},"default":[{"kind":"binary_expression"}],"spread":true},{"$option":"allowShortCircuit","cases":{"true":[{"kind":"binary_expression","not":{"has":{"regex":"^(&&|\\|\\||\\?\\?)$","stopBy":"neighbor"}}}]},"default":[],"spread":true},{"$option":"allowShortCircuit","cases":{"true":[{"kind":"binary_expression","has":{"stopBy":"neighbor","follows":{"regex":"^(&&|\\|\\||\\?\\?)$","stopBy":"neighbor"},"matches":"disallowed"}}]},"default":[],"spread":true},{"$option":"allowTernary","cases":{"true":[]},"default":[{"kind":"ternary_expression"}],"spread":true},{"$option":"allowTernary","cases":{"true":[{"kind":"ternary_expression","has":{"stopBy":"neighbor","matches":"disallowed","follows":{"regex":"^[?:]$","stopBy":"neighbor"}}}]},"default":[],"spread":true},{"kind":"call_expression","has":{"kind":"template_string","stopBy":"neighbor"}}]},"directive-like":{"kind":"expression_statement","has":{"kind":"string","stopBy":"neighbor"}},"directive":{"all":[{"matches":"directive-like"},{"inside":{"stopBy":"neighbor","any":[{"kind":"program"},{"kind":"statement_block","inside":{"stopBy":"neighbor","any":[{"kind":"function_declaration"},{"kind":"function_expression"},{"kind":"arrow_function"},{"kind":"generator_function"},{"kind":"generator_function_declaration"},{"kind":"method_definition"},{"kind":"module"},{"kind":"internal_module"}]}}]}},{"not":{"follows":{"stopBy":"end","all":[{"not":{"kind":"comment"}},{"not":{"kind":"hash_bang_line"}},{"not":{"regex":"^\\{$"}},{"not":{"matches":"directive-like"}}]}}}]}}}},"violation":{"anchor":"witness.span","code":"@typescript-eslint/no-unused-expressions","message":"Expected an assignment or function call and instead saw an expression."}}]}
@@ -0,0 +1,38 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "typescript-eslint-no-useless-empty-export",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "Port of typescript-eslint's `no-useless-empty-export` rule (https://typescript-eslint.io/rules/no-useless-empty-export). Flags `export {}` when a sibling statement of the same module body is already an import or export; declaration files are excluded by scope.",
7
+ "scope": { "include": ["**/*"], "exclude": ["**/*.d.ts", "**/*.d.mts", "**/*.d.cts"] },
8
+ "clauses": [
9
+ {
10
+ "id": "useless-empty-export",
11
+ "forbid": {
12
+ "ast": {
13
+ "language": "typescript",
14
+ "utils": {
15
+ "empty-export": {
16
+ "kind": "export_statement",
17
+ "has": { "kind": "export_clause", "not": { "has": { "kind": "export_specifier" } } }
18
+ },
19
+ "module-marker": {
20
+ "any": [
21
+ { "kind": "import_statement" },
22
+ { "kind": "export_statement", "not": { "any": [ { "matches": "empty-export" }, { "regex": "^export\\s+as\\s+namespace\\b" } ] } }
23
+ ]
24
+ }
25
+ },
26
+ "rule": {
27
+ "matches": "empty-export",
28
+ "any": [
29
+ { "precedes": { "matches": "module-marker", "stopBy": "end" } },
30
+ { "follows": { "matches": "module-marker", "stopBy": "end" } }
31
+ ]
32
+ }
33
+ }
34
+ },
35
+ "violation": { "anchor": "witness.span", "code": "@typescript-eslint/no-useless-empty-export", "message": "Empty export does nothing and can be removed.", "fix": "" }
36
+ }
37
+ ]
38
+ }