@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.
- package/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +36 -0
- package/licenses/eslint-plugin-vitest/LICENSE +21 -0
- package/licenses/eslint-plugin-vitest/UPSTREAM.md +103 -0
- package/licenses/typescript-eslint/LICENSE +21 -0
- package/licenses/typescript-eslint/UPSTREAM.md +1607 -0
- package/pack.json +189 -0
- package/package.json +30 -0
- package/rules/typescript-eslint-ban-tslint-comment.json +33 -0
- package/rules/typescript-eslint-consistent-type-definitions.json +1 -0
- package/rules/typescript-eslint-default-param-last.json +55 -0
- package/rules/typescript-eslint-no-array-constructor.json +238 -0
- package/rules/typescript-eslint-no-confusing-non-null-assertion.json +190 -0
- package/rules/typescript-eslint-no-dupe-class-members.json +1 -0
- package/rules/typescript-eslint-no-duplicate-enum-values.json +178 -0
- package/rules/typescript-eslint-no-empty-function.json +1 -0
- package/rules/typescript-eslint-no-extra-non-null-assertion.json +84 -0
- package/rules/typescript-eslint-no-import-type-side-effects.json +336 -0
- package/rules/typescript-eslint-no-namespace.json +157 -0
- package/rules/typescript-eslint-no-non-null-asserted-optional-chain.json +173 -0
- package/rules/typescript-eslint-no-non-null-assertion.json +195 -0
- package/rules/typescript-eslint-no-unnecessary-type-constraint.json +66 -0
- package/rules/typescript-eslint-no-unsafe-function-type.json +50 -0
- package/rules/typescript-eslint-no-unused-expressions.json +1 -0
- package/rules/typescript-eslint-no-useless-empty-export.json +38 -0
- package/rules/typescript-eslint-no-wrapper-object-types.json +568 -0
- package/rules/typescript-eslint-prefer-as-const.json +224 -0
- package/rules/typescript-eslint-prefer-enum-initializers.json +26 -0
- package/rules/typescript-eslint-prefer-literal-enum-member.json +1 -0
- package/rules/typescript-eslint-prefer-namespace-keyword.json +98 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "typescript-eslint-no-confusing-non-null-assertion",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of typescript-eslint's `no-confusing-non-null-assertion` rule (https://typescript-eslint.io/rules/no-confusing-non-null-assertion). Flags `=`, `==`, `===`, `in` and `instanceof` expressions whose left operand ends in a non-null assertion `!` (outside parentheses).",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "confusing-assign",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "typescript",
|
|
19
|
+
"rule": {
|
|
20
|
+
"any": [
|
|
21
|
+
{
|
|
22
|
+
"kind": "binary_expression"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"kind": "assignment_expression"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"has": {
|
|
29
|
+
"stopBy": "neighbor",
|
|
30
|
+
"matches": "ends-with-bang",
|
|
31
|
+
"precedes": {
|
|
32
|
+
"regex": "^=$",
|
|
33
|
+
"stopBy": "neighbor"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"utils": {
|
|
38
|
+
"ends-with-bang": {
|
|
39
|
+
"any": [
|
|
40
|
+
{
|
|
41
|
+
"kind": "non_null_expression"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"has": {
|
|
45
|
+
"stopBy": "neighbor",
|
|
46
|
+
"all": [
|
|
47
|
+
{
|
|
48
|
+
"matches": "ends-with-bang"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"not": {
|
|
52
|
+
"precedes": {
|
|
53
|
+
"regex": "^",
|
|
54
|
+
"stopBy": "neighbor"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"violation": {
|
|
67
|
+
"anchor": "witness.span",
|
|
68
|
+
"code": "@typescript-eslint/no-confusing-non-null-assertion",
|
|
69
|
+
"message": "Confusing combination of non-null assertion and assignment like `a! = b`, which looks very similar to `a != b`."
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": "confusing-equal",
|
|
74
|
+
"forbid": {
|
|
75
|
+
"ast": {
|
|
76
|
+
"language": "typescript",
|
|
77
|
+
"rule": {
|
|
78
|
+
"any": [
|
|
79
|
+
{
|
|
80
|
+
"kind": "binary_expression"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"kind": "assignment_expression"
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"has": {
|
|
87
|
+
"stopBy": "neighbor",
|
|
88
|
+
"matches": "ends-with-bang",
|
|
89
|
+
"precedes": {
|
|
90
|
+
"regex": "^===?$",
|
|
91
|
+
"stopBy": "neighbor"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"utils": {
|
|
96
|
+
"ends-with-bang": {
|
|
97
|
+
"any": [
|
|
98
|
+
{
|
|
99
|
+
"kind": "non_null_expression"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"has": {
|
|
103
|
+
"stopBy": "neighbor",
|
|
104
|
+
"all": [
|
|
105
|
+
{
|
|
106
|
+
"matches": "ends-with-bang"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"not": {
|
|
110
|
+
"precedes": {
|
|
111
|
+
"regex": "^",
|
|
112
|
+
"stopBy": "neighbor"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"violation": {
|
|
125
|
+
"anchor": "witness.span",
|
|
126
|
+
"code": "@typescript-eslint/no-confusing-non-null-assertion",
|
|
127
|
+
"message": "Confusing combination of non-null assertion and equality test like `a! == b`, which looks very similar to `a !== b`."
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "confusing-operator",
|
|
132
|
+
"forbid": {
|
|
133
|
+
"ast": {
|
|
134
|
+
"language": "typescript",
|
|
135
|
+
"rule": {
|
|
136
|
+
"any": [
|
|
137
|
+
{
|
|
138
|
+
"kind": "binary_expression"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"kind": "assignment_expression"
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
"has": {
|
|
145
|
+
"stopBy": "neighbor",
|
|
146
|
+
"matches": "ends-with-bang",
|
|
147
|
+
"precedes": {
|
|
148
|
+
"regex": "^(in|instanceof)$",
|
|
149
|
+
"stopBy": "neighbor",
|
|
150
|
+
"pattern": "$$OP"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"utils": {
|
|
155
|
+
"ends-with-bang": {
|
|
156
|
+
"any": [
|
|
157
|
+
{
|
|
158
|
+
"kind": "non_null_expression"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"has": {
|
|
162
|
+
"stopBy": "neighbor",
|
|
163
|
+
"all": [
|
|
164
|
+
{
|
|
165
|
+
"matches": "ends-with-bang"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"not": {
|
|
169
|
+
"precedes": {
|
|
170
|
+
"regex": "^",
|
|
171
|
+
"stopBy": "neighbor"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"violation": {
|
|
184
|
+
"anchor": "witness.span",
|
|
185
|
+
"code": "@typescript-eslint/no-confusing-non-null-assertion",
|
|
186
|
+
"message": "Confusing combination of non-null assertion and `$OP` operator like `a! $OP b`, which might be misinterpreted as `!(a $OP b)`."
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"format":"rerail.policy/v1","id":"typescript-eslint-no-dupe-class-members","revision":4,"mode":"steer","description":"Port of typescript-eslint's `no-dupe-class-members` rule (https://typescript-eslint.io/rules/no-dupe-class-members). ESLint's base rule over non-computed members only, ignoring overload signatures: flags a class member whose static name (`compare` text `key`) repeats an earlier member of the same class and staticness; a getter may pair with a setter.","scope":{"include":["**/*"],"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":"Duplicate name '$KT'."}}]}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "typescript-eslint-no-duplicate-enum-values",
|
|
4
|
+
"revision": 3,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "typescript-eslint 8.70.1 @typescript-eslint/no-duplicate-enum-values, default options. Port of typescript-eslint's `no-duplicate-enum-values` rule (https://typescript-eslint.io/rules/no-duplicate-enum-values). Flags an enum member whose initializer (a string, number or static template literal under any chain of unary + and -) has the same value, by Object.is, as an earlier member's; NaN values and other initializers are ignored.",
|
|
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": "duplicate-value",
|
|
23
|
+
"forbid": {
|
|
24
|
+
"ast": {
|
|
25
|
+
"language": "typescript",
|
|
26
|
+
"rule": {
|
|
27
|
+
"kind": "enum_assignment",
|
|
28
|
+
"all": [
|
|
29
|
+
{
|
|
30
|
+
"has": {
|
|
31
|
+
"stopBy": "neighbor",
|
|
32
|
+
"matches": "ev",
|
|
33
|
+
"pattern": "$V",
|
|
34
|
+
"follows": {
|
|
35
|
+
"regex": "^=$",
|
|
36
|
+
"stopBy": "neighbor"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"has": {
|
|
42
|
+
"stopBy": "neighbor",
|
|
43
|
+
"pattern": "$V",
|
|
44
|
+
"any": [
|
|
45
|
+
{
|
|
46
|
+
"value": {
|
|
47
|
+
"ge": 0
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"value": {
|
|
52
|
+
"lt": 0
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"value": {
|
|
57
|
+
"type": "string"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"count": {
|
|
65
|
+
"follows": {
|
|
66
|
+
"stopBy": "end",
|
|
67
|
+
"kind": "enum_assignment",
|
|
68
|
+
"all": [
|
|
69
|
+
{
|
|
70
|
+
"has": {
|
|
71
|
+
"stopBy": "neighbor",
|
|
72
|
+
"matches": "ev",
|
|
73
|
+
"pattern": "$W",
|
|
74
|
+
"follows": {
|
|
75
|
+
"regex": "^=$",
|
|
76
|
+
"stopBy": "neighbor"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"compare": {
|
|
82
|
+
"left": "W",
|
|
83
|
+
"op": "eq",
|
|
84
|
+
"right": "V",
|
|
85
|
+
"text": "value"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"min": 1
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"utils": {
|
|
94
|
+
"ev": {
|
|
95
|
+
"any": [
|
|
96
|
+
{
|
|
97
|
+
"kind": "string"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"kind": "number",
|
|
101
|
+
"value": {
|
|
102
|
+
"type": "number"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"kind": "template_string",
|
|
107
|
+
"not": {
|
|
108
|
+
"has": {
|
|
109
|
+
"kind": "template_substitution",
|
|
110
|
+
"stopBy": "neighbor"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"kind": "parenthesized_expression",
|
|
116
|
+
"has": {
|
|
117
|
+
"stopBy": "neighbor",
|
|
118
|
+
"matches": "ev"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"kind": "unary_expression",
|
|
123
|
+
"has": {
|
|
124
|
+
"stopBy": "neighbor",
|
|
125
|
+
"regex": "^[-+]$"
|
|
126
|
+
},
|
|
127
|
+
"all": [
|
|
128
|
+
{
|
|
129
|
+
"has": {
|
|
130
|
+
"stopBy": "neighbor",
|
|
131
|
+
"matches": "ev"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"transform": {
|
|
140
|
+
"VQ": {
|
|
141
|
+
"replace": {
|
|
142
|
+
"source": "$V",
|
|
143
|
+
"replace": "(?s)^['\"`](.*)['\"`]$",
|
|
144
|
+
"by": "${1}"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"VS": {
|
|
148
|
+
"replace": {
|
|
149
|
+
"source": "$VQ",
|
|
150
|
+
"replace": "^\\+*(-?)\\+*([0-9])",
|
|
151
|
+
"by": "${1}${2}"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"VT": {
|
|
155
|
+
"replace": {
|
|
156
|
+
"source": "$VS",
|
|
157
|
+
"replace": "^-(0+(?:\\.0*)?)$",
|
|
158
|
+
"by": "${1}"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"violation": {
|
|
165
|
+
"anchor": "witness.span",
|
|
166
|
+
"code": "@typescript-eslint/no-duplicate-enum-values",
|
|
167
|
+
"message": "Duplicate enum member value $VT.",
|
|
168
|
+
"suppress": {
|
|
169
|
+
"eslint": {
|
|
170
|
+
"rules": [
|
|
171
|
+
"@typescript-eslint/no-duplicate-enum-values"
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"format":"rerail.policy/v1","id":"typescript-eslint-no-empty-function","revision":4,"mode":"steer","description":"Port of typescript-eslint's `no-empty-function` rule (https://typescript-eslint.io/rules/no-empty-function). Reports a function, method or arrow body `{}` that holds no statement and no comment; constructors with parameter properties are exempt. Default options (allow: []). 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":{"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":"Unexpected empty $STW$PW$ASW$GNW$KWX$NQ$PNQ."}},{"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":"Unexpected empty constructor."}},{"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":"Unexpected empty $STW$PW$ASW$GNWmethod$NQ$PNQ$FQ."}},{"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":"Unexpected empty $ASW$GNWfunction$FQ."}},{"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":"Unexpected empty $ASWarrow function."}}]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "typescript-eslint-no-extra-non-null-assertion",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of typescript-eslint's `no-extra-non-null-assertion` rule (https://typescript-eslint.io/rules/no-extra-non-null-assertion). Flags a non-null assertion that is itself asserted non-null again, or that is the object/callee of an optional chain (parentheses are transparent, as in ESTree).",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "extra-non-null-assertion",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "typescript",
|
|
19
|
+
"rule": {
|
|
20
|
+
"all": [
|
|
21
|
+
{
|
|
22
|
+
"kind": "non_null_expression"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"pattern": "$E!"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"matches": "redundant-position"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"utils": {
|
|
33
|
+
"redundant-position": {
|
|
34
|
+
"any": [
|
|
35
|
+
{
|
|
36
|
+
"inside": {
|
|
37
|
+
"kind": "non_null_expression"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"precedes": {
|
|
42
|
+
"any": [
|
|
43
|
+
{
|
|
44
|
+
"kind": "optional_chain"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"regex": "^\\?\\.$"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"inside": {
|
|
52
|
+
"any": [
|
|
53
|
+
{
|
|
54
|
+
"kind": "member_expression"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"kind": "subscript_expression"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"kind": "call_expression"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"inside": {
|
|
67
|
+
"kind": "parenthesized_expression",
|
|
68
|
+
"matches": "redundant-position"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"violation": {
|
|
77
|
+
"anchor": "witness.span",
|
|
78
|
+
"code": "@typescript-eslint/no-extra-non-null-assertion",
|
|
79
|
+
"message": "Forbidden extra non-null assertion.",
|
|
80
|
+
"fix": "$E"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
}
|