@ngrok/mantle 0.91.1 → 0.92.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/dist/accordion.js +1 -1
- package/dist/agent.json +5 -2
- package/dist/{alert-BV0VWU2o.d.ts → alert-BcSBNR3S.d.ts} +2 -2
- package/dist/alert-P9lwn25X.js +1 -0
- package/dist/alert-center.d.ts +1 -1
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +19 -1
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js +1 -1
- package/dist/app-layout.d.ts +1 -1
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +10 -3
- package/dist/area-chart.js +1 -1
- package/dist/bar-chart.d.ts +9 -3
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only-BTSrYWLj.js +1 -0
- package/dist/browser-only.js +1 -1
- package/dist/{button-Cwrv2Mwv.js → button-B8k98Pby.js} +1 -1
- package/dist/button-BQZ6eoD3.js +1 -0
- package/dist/{button-Dt9LZMT5.d.ts → button-BX-4lYUn.d.ts} +3 -3
- package/dist/{button-BOCRKR5v.d.ts → button-CPsKGDK0.d.ts} +52 -1
- package/dist/button-Dge0D5bl.js +1 -0
- package/dist/{button-BFAvonp1.d.ts → button-Yxyu1XMd.d.ts} +1 -1
- package/dist/button.d.ts +3 -3
- package/dist/button.js +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +1 -1
- package/dist/chart-BpWfQAwf.js +2 -0
- package/dist/{chart-ynMysD16.d.ts → chart-BpfbtOUN.d.ts} +14 -0
- package/dist/{checkbox-BpW9TmW6.js → checkbox-DmSQXs26.js} +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{choice-U6_8mOOO.js → choice-2Lrv8_nl.js} +1 -1
- package/dist/choice.js +1 -1
- package/dist/code-block.js +6 -6
- package/dist/combobox.d.ts +79 -1
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +5 -1
- package/dist/command.js +1 -1
- package/dist/{copy-to-clipboard-Cza2OT47.js → copy-to-clipboard-DInu78k_.js} +1 -1
- package/dist/data-table.d.ts +2 -2
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +1 -1
- package/dist/{dialog-DedsCsnk.d.ts → dialog-2fRO4ca4.d.ts} +19 -1
- package/dist/{dialog-eL61O8eg.js → dialog-qordIos1.js} +1 -1
- package/dist/dialog.d.ts +1 -1
- package/dist/dialog.js +1 -1
- package/dist/{dropdown-menu-C4C1x-7W.js → dropdown-menu-CLHkKzhe.js} +1 -1
- package/dist/{dropdown-menu-ByQQIsQE.d.ts → dropdown-menu-CpjRwMWe.d.ts} +1 -1
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/field.d.ts +1 -1
- package/dist/field.js +1 -1
- package/dist/hooks.d.ts +15 -1
- package/dist/hooks.js +1 -1
- package/dist/hover-card.js +1 -1
- package/dist/{icons-exKDODyp.js → icons-DGL0d2Il.js} +1 -1
- package/dist/icons.js +1 -1
- package/dist/{index-C6s5cGCr.d.ts → index-BhfgyurF.d.ts} +9 -9
- package/dist/input.js +1 -1
- package/dist/line-chart.d.ts +10 -3
- package/dist/line-chart.js +1 -1
- package/dist/list-RFRIQxU2.js +1 -0
- package/dist/list.js +1 -1
- package/dist/llms.txt +2 -2
- package/dist/mantle.css +409 -12
- package/dist/migrations/0012-single-stylesheet.yml +1971 -0
- package/dist/multi-select.d.ts +1 -1
- package/dist/multi-select.js +1 -1
- package/dist/pagination.d.ts +2 -2
- package/dist/pagination.js +1 -1
- package/dist/popover-BCGCpwkK.js +1 -0
- package/dist/popover.js +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/sandbar.d.ts +1 -1
- package/dist/sandbar.js +1 -1
- package/dist/scatter-plot.d.ts +10 -4
- package/dist/scatter-plot.js +1 -1
- package/dist/{select-CRp_ndSJ.d.ts → select-BkhBxtOT.d.ts} +1 -1
- package/dist/{select-BdF_CnfJ.js → select-MjJMGqwP.js} +1 -1
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-DNovVsrx.d.ts → separator-D9AWEkcJ.d.ts} +4 -0
- package/dist/{separator-BPE-A8tw.js → separator-DfzxVutO.js} +1 -1
- package/dist/separator.d.ts +1 -1
- package/dist/separator.js +1 -1
- package/dist/{shake-u3qyeThI.js → shake-DL6WhMXM.js} +1 -1
- package/dist/{sheet-BIyuxMmF.js → sheet-C0QytOsE.js} +1 -1
- package/dist/sheet.d.ts +20 -2
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +6 -2
- package/dist/sidebar.js +1 -1
- package/dist/slider.js +1 -1
- package/dist/split-button.d.ts +3 -3
- package/dist/split-button.js +1 -1
- package/dist/table-CFHiDBW8.js +1 -0
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-area.js +1 -1
- package/dist/theme-CwtpudOH.js +1 -0
- package/dist/theme-switcher.d.ts +1 -1
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +15 -69
- package/dist/theme.js +1 -1
- package/dist/toast.js +1 -1
- package/dist/truncated-text.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/use-copy-to-clipboard-Dy_0Qzb7.js +1 -0
- package/dist/use-is-apple-platform-D4nifHMx.js +1 -0
- package/dist/use-isomorphic-layout-effect-CLSmHzo4.js +1 -0
- package/dist/use-prefers-reduced-motion-CU6mWmOe.js +1 -0
- package/dist/use-swipe-to-dismiss-DceYk1Id.js +1 -0
- package/dist/utils.js +1 -1
- package/dist/well.d.ts +1 -1
- package/package.json +1 -5
- package/dist/alert-QXHRO9ji.js +0 -1
- package/dist/browser-only-Crr3sgA0.js +0 -1
- package/dist/button-CZ-q7fYv.js +0 -1
- package/dist/button-DTpsT864.js +0 -1
- package/dist/chart-D2LtDZtV.js +0 -2
- package/dist/list-DOVZoz9t.js +0 -1
- package/dist/mantle-dark.css +0 -385
- package/dist/popover-q2-rCY1q.js +0 -1
- package/dist/table-DBbKqOVq.js +0 -1
- package/dist/theme-CBGxDNFc.js +0 -1
- package/dist/use-copy-to-clipboard-ByLT8veV.js +0 -1
- package/dist/use-is-apple-platform-CMPzIYjz.js +0 -1
- package/dist/use-is-hydrated-DDCqXmju.js +0 -1
- package/dist/use-isomorphic-layout-effect-DdTRtMY-.js +0 -1
- package/dist/use-prefers-reduced-motion-DimzRx-M.js +0 -1
- package/dist/use-swipe-to-dismiss-Cj-AayFd.js +0 -1
|
@@ -0,0 +1,1971 @@
|
|
|
1
|
+
# Every rule binds the local name of the part's import from
|
|
2
|
+
# `@ngrok/mantle/theme`, so an aliased import matches and another library's
|
|
3
|
+
# part of the same name does not. A rule with no JSX in it ships a second copy
|
|
4
|
+
# for `.ts` files, because a rule reaches only its own language.
|
|
5
|
+
id: mantle-style-sheets-element
|
|
6
|
+
language: tsx
|
|
7
|
+
message: MantleStyleSheets is gone; mantle.css holds both themes
|
|
8
|
+
utils:
|
|
9
|
+
# A node that opens a lexical scope. The shadow search below stops at a
|
|
10
|
+
# nested one, so a sibling function's local name does not count.
|
|
11
|
+
scope:
|
|
12
|
+
any:
|
|
13
|
+
- kind: statement_block
|
|
14
|
+
- kind: function_declaration
|
|
15
|
+
- kind: generator_function_declaration
|
|
16
|
+
- kind: function_expression
|
|
17
|
+
- kind: generator_function
|
|
18
|
+
- kind: arrow_function
|
|
19
|
+
- kind: method_definition
|
|
20
|
+
- kind: class_body
|
|
21
|
+
- kind: for_statement
|
|
22
|
+
- kind: for_in_statement
|
|
23
|
+
- kind: catch_clause
|
|
24
|
+
# An identifier in a binding position: a parameter, a destructured name, a
|
|
25
|
+
# local variable, a function name, or a class name.
|
|
26
|
+
binding-name:
|
|
27
|
+
any:
|
|
28
|
+
- kind: shorthand_property_identifier_pattern
|
|
29
|
+
- kind: identifier
|
|
30
|
+
any:
|
|
31
|
+
- inside: { kind: variable_declarator, field: name }
|
|
32
|
+
- inside: { kind: function_declaration, field: name }
|
|
33
|
+
- inside: { kind: generator_function_declaration, field: name }
|
|
34
|
+
- inside: { kind: function_expression, field: name }
|
|
35
|
+
- inside: { kind: required_parameter, field: pattern }
|
|
36
|
+
- inside: { kind: optional_parameter, field: pattern }
|
|
37
|
+
- inside: { kind: assignment_pattern, field: left }
|
|
38
|
+
- inside: { kind: pair_pattern, field: value }
|
|
39
|
+
- inside: { kind: array_pattern }
|
|
40
|
+
- inside: { kind: rest_pattern }
|
|
41
|
+
- inside: { kind: arrow_function, field: parameter }
|
|
42
|
+
- inside: { kind: catch_clause, field: parameter }
|
|
43
|
+
- inside: { kind: for_in_statement, field: left }
|
|
44
|
+
- kind: type_identifier
|
|
45
|
+
inside: { kind: class_declaration, field: name }
|
|
46
|
+
# A function declaration opens a scope, so the search above stops at it and
|
|
47
|
+
# never reads its name. This matches the declaration itself instead.
|
|
48
|
+
function-declaration:
|
|
49
|
+
any:
|
|
50
|
+
- kind: function_declaration
|
|
51
|
+
- kind: generator_function_declaration
|
|
52
|
+
# A scope that a `var` leaves: the `var` binds in the enclosing function.
|
|
53
|
+
block-scope:
|
|
54
|
+
any:
|
|
55
|
+
- kind: statement_block
|
|
56
|
+
- kind: for_statement
|
|
57
|
+
- kind: for_in_statement
|
|
58
|
+
- kind: catch_clause
|
|
59
|
+
function-scope:
|
|
60
|
+
any:
|
|
61
|
+
- kind: function_declaration
|
|
62
|
+
- kind: generator_function_declaration
|
|
63
|
+
- kind: function_expression
|
|
64
|
+
- kind: generator_function
|
|
65
|
+
- kind: arrow_function
|
|
66
|
+
- kind: method_definition
|
|
67
|
+
var-declaration:
|
|
68
|
+
any:
|
|
69
|
+
- kind: variable_declaration
|
|
70
|
+
- kind: for_in_statement
|
|
71
|
+
regex: ^for\s*(await\s*)?\(\s*var\b
|
|
72
|
+
mantle-style-sheets-import:
|
|
73
|
+
kind: import_statement
|
|
74
|
+
all:
|
|
75
|
+
- has:
|
|
76
|
+
field: source
|
|
77
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
78
|
+
- has:
|
|
79
|
+
stopBy: end
|
|
80
|
+
kind: import_specifier
|
|
81
|
+
has:
|
|
82
|
+
field: name
|
|
83
|
+
regex: ^MantleStyleSheets$
|
|
84
|
+
any:
|
|
85
|
+
- kind: import_specifier
|
|
86
|
+
has:
|
|
87
|
+
field: alias
|
|
88
|
+
pattern: $SHEETS
|
|
89
|
+
- kind: import_specifier
|
|
90
|
+
not:
|
|
91
|
+
has:
|
|
92
|
+
field: alias
|
|
93
|
+
kind: identifier
|
|
94
|
+
has:
|
|
95
|
+
field: name
|
|
96
|
+
pattern: $SHEETS
|
|
97
|
+
rule:
|
|
98
|
+
kind: jsx_self_closing_element
|
|
99
|
+
# Why a direct child of an element only: inside `{show && <MantleStyleSheets />}`
|
|
100
|
+
# a deletion leaves an empty expression. That case stays manual.
|
|
101
|
+
inside: { kind: jsx_element }
|
|
102
|
+
all:
|
|
103
|
+
# Why bind the name first: `inside` runs before `has` in one object, so the
|
|
104
|
+
# import gate must read a name that is already bound.
|
|
105
|
+
- has:
|
|
106
|
+
field: name
|
|
107
|
+
kind: identifier
|
|
108
|
+
pattern: $SHEETS
|
|
109
|
+
- inside:
|
|
110
|
+
stopBy: end
|
|
111
|
+
kind: program
|
|
112
|
+
has:
|
|
113
|
+
matches: mantle-style-sheets-import
|
|
114
|
+
# Why: a parameter or a local under the import's name shadows it, and the
|
|
115
|
+
# rules cannot tell which binding the code reads.
|
|
116
|
+
- not:
|
|
117
|
+
inside:
|
|
118
|
+
stopBy: end
|
|
119
|
+
matches: scope
|
|
120
|
+
has:
|
|
121
|
+
stopBy:
|
|
122
|
+
matches: scope
|
|
123
|
+
any:
|
|
124
|
+
- matches: binding-name
|
|
125
|
+
pattern: $SHEETS
|
|
126
|
+
- matches: function-declaration
|
|
127
|
+
has:
|
|
128
|
+
field: name
|
|
129
|
+
pattern: $SHEETS
|
|
130
|
+
# Why: a `var` in a nested block binds in the enclosing function.
|
|
131
|
+
- matches: block-scope
|
|
132
|
+
has:
|
|
133
|
+
stopBy:
|
|
134
|
+
matches: function-scope
|
|
135
|
+
matches: binding-name
|
|
136
|
+
pattern: $SHEETS
|
|
137
|
+
inside:
|
|
138
|
+
stopBy: end
|
|
139
|
+
matches: var-declaration
|
|
140
|
+
fix: ""
|
|
141
|
+
---
|
|
142
|
+
id: mantle-style-sheet-urls-declaration
|
|
143
|
+
language: tsx
|
|
144
|
+
message: mantleStyleSheetUrls is gone; mantle.css holds both themes
|
|
145
|
+
utils:
|
|
146
|
+
# A node that opens a lexical scope. The shadow search below stops at a
|
|
147
|
+
# nested one, so a sibling function's local name does not count.
|
|
148
|
+
scope:
|
|
149
|
+
any:
|
|
150
|
+
- kind: statement_block
|
|
151
|
+
- kind: function_declaration
|
|
152
|
+
- kind: generator_function_declaration
|
|
153
|
+
- kind: function_expression
|
|
154
|
+
- kind: generator_function
|
|
155
|
+
- kind: arrow_function
|
|
156
|
+
- kind: method_definition
|
|
157
|
+
- kind: class_body
|
|
158
|
+
- kind: for_statement
|
|
159
|
+
- kind: for_in_statement
|
|
160
|
+
- kind: catch_clause
|
|
161
|
+
# An identifier in a binding position: a parameter, a destructured name, a
|
|
162
|
+
# local variable, a function name, or a class name.
|
|
163
|
+
binding-name:
|
|
164
|
+
any:
|
|
165
|
+
- kind: shorthand_property_identifier_pattern
|
|
166
|
+
- kind: identifier
|
|
167
|
+
any:
|
|
168
|
+
- inside: { kind: variable_declarator, field: name }
|
|
169
|
+
- inside: { kind: function_declaration, field: name }
|
|
170
|
+
- inside: { kind: generator_function_declaration, field: name }
|
|
171
|
+
- inside: { kind: function_expression, field: name }
|
|
172
|
+
- inside: { kind: required_parameter, field: pattern }
|
|
173
|
+
- inside: { kind: optional_parameter, field: pattern }
|
|
174
|
+
- inside: { kind: assignment_pattern, field: left }
|
|
175
|
+
- inside: { kind: pair_pattern, field: value }
|
|
176
|
+
- inside: { kind: array_pattern }
|
|
177
|
+
- inside: { kind: rest_pattern }
|
|
178
|
+
- inside: { kind: arrow_function, field: parameter }
|
|
179
|
+
- inside: { kind: catch_clause, field: parameter }
|
|
180
|
+
- inside: { kind: for_in_statement, field: left }
|
|
181
|
+
- kind: type_identifier
|
|
182
|
+
inside: { kind: class_declaration, field: name }
|
|
183
|
+
# A function declaration opens a scope, so the search above stops at it and
|
|
184
|
+
# never reads its name. This matches the declaration itself instead.
|
|
185
|
+
function-declaration:
|
|
186
|
+
any:
|
|
187
|
+
- kind: function_declaration
|
|
188
|
+
- kind: generator_function_declaration
|
|
189
|
+
# A scope that a `var` leaves: the `var` binds in the enclosing function.
|
|
190
|
+
block-scope:
|
|
191
|
+
any:
|
|
192
|
+
- kind: statement_block
|
|
193
|
+
- kind: for_statement
|
|
194
|
+
- kind: for_in_statement
|
|
195
|
+
- kind: catch_clause
|
|
196
|
+
function-scope:
|
|
197
|
+
any:
|
|
198
|
+
- kind: function_declaration
|
|
199
|
+
- kind: generator_function_declaration
|
|
200
|
+
- kind: function_expression
|
|
201
|
+
- kind: generator_function
|
|
202
|
+
- kind: arrow_function
|
|
203
|
+
- kind: method_definition
|
|
204
|
+
var-declaration:
|
|
205
|
+
any:
|
|
206
|
+
- kind: variable_declaration
|
|
207
|
+
- kind: for_in_statement
|
|
208
|
+
regex: ^for\s*(await\s*)?\(\s*var\b
|
|
209
|
+
style-sheet-urls-import:
|
|
210
|
+
kind: import_statement
|
|
211
|
+
all:
|
|
212
|
+
- has:
|
|
213
|
+
field: source
|
|
214
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
215
|
+
- has:
|
|
216
|
+
stopBy: end
|
|
217
|
+
kind: import_specifier
|
|
218
|
+
has:
|
|
219
|
+
field: name
|
|
220
|
+
regex: ^mantleStyleSheetUrls$
|
|
221
|
+
any:
|
|
222
|
+
- kind: import_specifier
|
|
223
|
+
has:
|
|
224
|
+
field: alias
|
|
225
|
+
pattern: $URLS
|
|
226
|
+
- kind: import_specifier
|
|
227
|
+
not:
|
|
228
|
+
has:
|
|
229
|
+
field: alias
|
|
230
|
+
kind: identifier
|
|
231
|
+
has:
|
|
232
|
+
field: name
|
|
233
|
+
pattern: $URLS
|
|
234
|
+
# A `const` the declaration rule deletes: not exported, one declarator, a
|
|
235
|
+
# call to mantle's `mantleStyleSheetUrls` as its value, and a name that only
|
|
236
|
+
# a deleted `<MantleStyleSheets />` reads.
|
|
237
|
+
deleted-declaration:
|
|
238
|
+
kind: lexical_declaration
|
|
239
|
+
not:
|
|
240
|
+
inside: { kind: export_statement }
|
|
241
|
+
all:
|
|
242
|
+
- has:
|
|
243
|
+
kind: variable_declarator
|
|
244
|
+
all:
|
|
245
|
+
- has: { field: name, kind: identifier, pattern: $DECL }
|
|
246
|
+
- has:
|
|
247
|
+
field: value
|
|
248
|
+
kind: call_expression
|
|
249
|
+
all:
|
|
250
|
+
- has: { field: function, kind: identifier, pattern: $URLS }
|
|
251
|
+
- inside:
|
|
252
|
+
stopBy: end
|
|
253
|
+
kind: program
|
|
254
|
+
has:
|
|
255
|
+
matches: style-sheet-urls-import
|
|
256
|
+
# Why: a parameter or a local under the import's name shadows it, and the
|
|
257
|
+
# rules cannot tell which binding the code reads.
|
|
258
|
+
- not:
|
|
259
|
+
inside:
|
|
260
|
+
stopBy: end
|
|
261
|
+
matches: scope
|
|
262
|
+
has:
|
|
263
|
+
stopBy:
|
|
264
|
+
matches: scope
|
|
265
|
+
any:
|
|
266
|
+
- matches: binding-name
|
|
267
|
+
pattern: $URLS
|
|
268
|
+
- matches: function-declaration
|
|
269
|
+
has:
|
|
270
|
+
field: name
|
|
271
|
+
pattern: $URLS
|
|
272
|
+
# Why: a `var` in a nested block binds in the enclosing function.
|
|
273
|
+
- matches: block-scope
|
|
274
|
+
has:
|
|
275
|
+
stopBy:
|
|
276
|
+
matches: function-scope
|
|
277
|
+
matches: binding-name
|
|
278
|
+
pattern: $URLS
|
|
279
|
+
inside:
|
|
280
|
+
stopBy: end
|
|
281
|
+
matches: var-declaration
|
|
282
|
+
# Why one declarator: a deletion would take its siblings with it.
|
|
283
|
+
- not:
|
|
284
|
+
has:
|
|
285
|
+
kind: variable_declarator
|
|
286
|
+
follows: { stopBy: end, kind: variable_declarator }
|
|
287
|
+
# Why: a name that other code still reads keeps its declaration.
|
|
288
|
+
- not:
|
|
289
|
+
inside:
|
|
290
|
+
stopBy: end
|
|
291
|
+
kind: program
|
|
292
|
+
has:
|
|
293
|
+
stopBy: end
|
|
294
|
+
any:
|
|
295
|
+
- kind: identifier
|
|
296
|
+
- kind: shorthand_property_identifier
|
|
297
|
+
pattern: $DECL
|
|
298
|
+
not:
|
|
299
|
+
any:
|
|
300
|
+
- inside: { kind: variable_declarator, field: name }
|
|
301
|
+
- inside: { stopBy: end, matches: deleted-element }
|
|
302
|
+
mantle-style-sheets-import:
|
|
303
|
+
kind: import_statement
|
|
304
|
+
all:
|
|
305
|
+
- has:
|
|
306
|
+
field: source
|
|
307
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
308
|
+
- has:
|
|
309
|
+
stopBy: end
|
|
310
|
+
kind: import_specifier
|
|
311
|
+
has:
|
|
312
|
+
field: name
|
|
313
|
+
regex: ^MantleStyleSheets$
|
|
314
|
+
any:
|
|
315
|
+
- kind: import_specifier
|
|
316
|
+
has:
|
|
317
|
+
field: alias
|
|
318
|
+
pattern: $SHEETS
|
|
319
|
+
- kind: import_specifier
|
|
320
|
+
not:
|
|
321
|
+
has:
|
|
322
|
+
field: alias
|
|
323
|
+
kind: identifier
|
|
324
|
+
has:
|
|
325
|
+
field: name
|
|
326
|
+
pattern: $SHEETS
|
|
327
|
+
# A `<MantleStyleSheets />` the element rule deletes: a direct child of a
|
|
328
|
+
# JSX element, bound to mantle's import.
|
|
329
|
+
deleted-element:
|
|
330
|
+
kind: jsx_self_closing_element
|
|
331
|
+
inside: { kind: jsx_element }
|
|
332
|
+
all:
|
|
333
|
+
- has:
|
|
334
|
+
field: name
|
|
335
|
+
kind: identifier
|
|
336
|
+
pattern: $SHEETS
|
|
337
|
+
- inside:
|
|
338
|
+
stopBy: end
|
|
339
|
+
kind: program
|
|
340
|
+
has:
|
|
341
|
+
matches: mantle-style-sheets-import
|
|
342
|
+
# Why: a parameter or a local under the import's name shadows it, and the
|
|
343
|
+
# rules cannot tell which binding the code reads.
|
|
344
|
+
- not:
|
|
345
|
+
inside:
|
|
346
|
+
stopBy: end
|
|
347
|
+
matches: scope
|
|
348
|
+
has:
|
|
349
|
+
stopBy:
|
|
350
|
+
matches: scope
|
|
351
|
+
any:
|
|
352
|
+
- matches: binding-name
|
|
353
|
+
pattern: $SHEETS
|
|
354
|
+
- matches: function-declaration
|
|
355
|
+
has:
|
|
356
|
+
field: name
|
|
357
|
+
pattern: $SHEETS
|
|
358
|
+
# Why: a `var` in a nested block binds in the enclosing function.
|
|
359
|
+
- matches: block-scope
|
|
360
|
+
has:
|
|
361
|
+
stopBy:
|
|
362
|
+
matches: function-scope
|
|
363
|
+
matches: binding-name
|
|
364
|
+
pattern: $SHEETS
|
|
365
|
+
inside:
|
|
366
|
+
stopBy: end
|
|
367
|
+
matches: var-declaration
|
|
368
|
+
rule:
|
|
369
|
+
matches: deleted-declaration
|
|
370
|
+
fix: ""
|
|
371
|
+
---
|
|
372
|
+
id: mantle-dark-stylesheet-import
|
|
373
|
+
language: tsx
|
|
374
|
+
message: mantle-dark.css is gone; mantle.css holds both themes
|
|
375
|
+
utils:
|
|
376
|
+
# A node that opens a lexical scope. The shadow search below stops at a
|
|
377
|
+
# nested one, so a sibling function's local name does not count.
|
|
378
|
+
scope:
|
|
379
|
+
any:
|
|
380
|
+
- kind: statement_block
|
|
381
|
+
- kind: function_declaration
|
|
382
|
+
- kind: generator_function_declaration
|
|
383
|
+
- kind: function_expression
|
|
384
|
+
- kind: generator_function
|
|
385
|
+
- kind: arrow_function
|
|
386
|
+
- kind: method_definition
|
|
387
|
+
- kind: class_body
|
|
388
|
+
- kind: for_statement
|
|
389
|
+
- kind: for_in_statement
|
|
390
|
+
- kind: catch_clause
|
|
391
|
+
# An identifier in a binding position: a parameter, a destructured name, a
|
|
392
|
+
# local variable, a function name, or a class name.
|
|
393
|
+
binding-name:
|
|
394
|
+
any:
|
|
395
|
+
- kind: shorthand_property_identifier_pattern
|
|
396
|
+
- kind: identifier
|
|
397
|
+
any:
|
|
398
|
+
- inside: { kind: variable_declarator, field: name }
|
|
399
|
+
- inside: { kind: function_declaration, field: name }
|
|
400
|
+
- inside: { kind: generator_function_declaration, field: name }
|
|
401
|
+
- inside: { kind: function_expression, field: name }
|
|
402
|
+
- inside: { kind: required_parameter, field: pattern }
|
|
403
|
+
- inside: { kind: optional_parameter, field: pattern }
|
|
404
|
+
- inside: { kind: assignment_pattern, field: left }
|
|
405
|
+
- inside: { kind: pair_pattern, field: value }
|
|
406
|
+
- inside: { kind: array_pattern }
|
|
407
|
+
- inside: { kind: rest_pattern }
|
|
408
|
+
- inside: { kind: arrow_function, field: parameter }
|
|
409
|
+
- inside: { kind: catch_clause, field: parameter }
|
|
410
|
+
- inside: { kind: for_in_statement, field: left }
|
|
411
|
+
- kind: type_identifier
|
|
412
|
+
inside: { kind: class_declaration, field: name }
|
|
413
|
+
# A function declaration opens a scope, so the search above stops at it and
|
|
414
|
+
# never reads its name. This matches the declaration itself instead.
|
|
415
|
+
function-declaration:
|
|
416
|
+
any:
|
|
417
|
+
- kind: function_declaration
|
|
418
|
+
- kind: generator_function_declaration
|
|
419
|
+
# A scope that a `var` leaves: the `var` binds in the enclosing function.
|
|
420
|
+
block-scope:
|
|
421
|
+
any:
|
|
422
|
+
- kind: statement_block
|
|
423
|
+
- kind: for_statement
|
|
424
|
+
- kind: for_in_statement
|
|
425
|
+
- kind: catch_clause
|
|
426
|
+
function-scope:
|
|
427
|
+
any:
|
|
428
|
+
- kind: function_declaration
|
|
429
|
+
- kind: generator_function_declaration
|
|
430
|
+
- kind: function_expression
|
|
431
|
+
- kind: generator_function
|
|
432
|
+
- kind: arrow_function
|
|
433
|
+
- kind: method_definition
|
|
434
|
+
var-declaration:
|
|
435
|
+
any:
|
|
436
|
+
- kind: variable_declaration
|
|
437
|
+
- kind: for_in_statement
|
|
438
|
+
regex: ^for\s*(await\s*)?\(\s*var\b
|
|
439
|
+
style-sheet-urls-import:
|
|
440
|
+
kind: import_statement
|
|
441
|
+
all:
|
|
442
|
+
- has:
|
|
443
|
+
field: source
|
|
444
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
445
|
+
- has:
|
|
446
|
+
stopBy: end
|
|
447
|
+
kind: import_specifier
|
|
448
|
+
has:
|
|
449
|
+
field: name
|
|
450
|
+
regex: ^mantleStyleSheetUrls$
|
|
451
|
+
any:
|
|
452
|
+
- kind: import_specifier
|
|
453
|
+
has:
|
|
454
|
+
field: alias
|
|
455
|
+
pattern: $URLS
|
|
456
|
+
- kind: import_specifier
|
|
457
|
+
not:
|
|
458
|
+
has:
|
|
459
|
+
field: alias
|
|
460
|
+
kind: identifier
|
|
461
|
+
has:
|
|
462
|
+
field: name
|
|
463
|
+
pattern: $URLS
|
|
464
|
+
# A `const` the declaration rule deletes: not exported, one declarator, a
|
|
465
|
+
# call to mantle's `mantleStyleSheetUrls` as its value, and a name that only
|
|
466
|
+
# a deleted `<MantleStyleSheets />` reads.
|
|
467
|
+
deleted-declaration:
|
|
468
|
+
kind: lexical_declaration
|
|
469
|
+
not:
|
|
470
|
+
inside: { kind: export_statement }
|
|
471
|
+
all:
|
|
472
|
+
- has:
|
|
473
|
+
kind: variable_declarator
|
|
474
|
+
all:
|
|
475
|
+
- has: { field: name, kind: identifier, pattern: $DECL }
|
|
476
|
+
- has:
|
|
477
|
+
field: value
|
|
478
|
+
kind: call_expression
|
|
479
|
+
all:
|
|
480
|
+
- has: { field: function, kind: identifier, pattern: $URLS }
|
|
481
|
+
- inside:
|
|
482
|
+
stopBy: end
|
|
483
|
+
kind: program
|
|
484
|
+
has:
|
|
485
|
+
matches: style-sheet-urls-import
|
|
486
|
+
# Why: a parameter or a local under the import's name shadows it, and the
|
|
487
|
+
# rules cannot tell which binding the code reads.
|
|
488
|
+
- not:
|
|
489
|
+
inside:
|
|
490
|
+
stopBy: end
|
|
491
|
+
matches: scope
|
|
492
|
+
has:
|
|
493
|
+
stopBy:
|
|
494
|
+
matches: scope
|
|
495
|
+
any:
|
|
496
|
+
- matches: binding-name
|
|
497
|
+
pattern: $URLS
|
|
498
|
+
- matches: function-declaration
|
|
499
|
+
has:
|
|
500
|
+
field: name
|
|
501
|
+
pattern: $URLS
|
|
502
|
+
# Why: a `var` in a nested block binds in the enclosing function.
|
|
503
|
+
- matches: block-scope
|
|
504
|
+
has:
|
|
505
|
+
stopBy:
|
|
506
|
+
matches: function-scope
|
|
507
|
+
matches: binding-name
|
|
508
|
+
pattern: $URLS
|
|
509
|
+
inside:
|
|
510
|
+
stopBy: end
|
|
511
|
+
matches: var-declaration
|
|
512
|
+
# Why one declarator: a deletion would take its siblings with it.
|
|
513
|
+
- not:
|
|
514
|
+
has:
|
|
515
|
+
kind: variable_declarator
|
|
516
|
+
follows: { stopBy: end, kind: variable_declarator }
|
|
517
|
+
# Why: a name that other code still reads keeps its declaration.
|
|
518
|
+
- not:
|
|
519
|
+
inside:
|
|
520
|
+
stopBy: end
|
|
521
|
+
kind: program
|
|
522
|
+
has:
|
|
523
|
+
stopBy: end
|
|
524
|
+
any:
|
|
525
|
+
- kind: identifier
|
|
526
|
+
- kind: shorthand_property_identifier
|
|
527
|
+
pattern: $DECL
|
|
528
|
+
not:
|
|
529
|
+
any:
|
|
530
|
+
- inside: { kind: variable_declarator, field: name }
|
|
531
|
+
- inside: { stopBy: end, matches: deleted-element }
|
|
532
|
+
mantle-style-sheets-import:
|
|
533
|
+
kind: import_statement
|
|
534
|
+
all:
|
|
535
|
+
- has:
|
|
536
|
+
field: source
|
|
537
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
538
|
+
- has:
|
|
539
|
+
stopBy: end
|
|
540
|
+
kind: import_specifier
|
|
541
|
+
has:
|
|
542
|
+
field: name
|
|
543
|
+
regex: ^MantleStyleSheets$
|
|
544
|
+
any:
|
|
545
|
+
- kind: import_specifier
|
|
546
|
+
has:
|
|
547
|
+
field: alias
|
|
548
|
+
pattern: $SHEETS
|
|
549
|
+
- kind: import_specifier
|
|
550
|
+
not:
|
|
551
|
+
has:
|
|
552
|
+
field: alias
|
|
553
|
+
kind: identifier
|
|
554
|
+
has:
|
|
555
|
+
field: name
|
|
556
|
+
pattern: $SHEETS
|
|
557
|
+
# A `<MantleStyleSheets />` the element rule deletes: a direct child of a
|
|
558
|
+
# JSX element, bound to mantle's import.
|
|
559
|
+
deleted-element:
|
|
560
|
+
kind: jsx_self_closing_element
|
|
561
|
+
inside: { kind: jsx_element }
|
|
562
|
+
all:
|
|
563
|
+
- has:
|
|
564
|
+
field: name
|
|
565
|
+
kind: identifier
|
|
566
|
+
pattern: $SHEETS
|
|
567
|
+
- inside:
|
|
568
|
+
stopBy: end
|
|
569
|
+
kind: program
|
|
570
|
+
has:
|
|
571
|
+
matches: mantle-style-sheets-import
|
|
572
|
+
# Why: a parameter or a local under the import's name shadows it, and the
|
|
573
|
+
# rules cannot tell which binding the code reads.
|
|
574
|
+
- not:
|
|
575
|
+
inside:
|
|
576
|
+
stopBy: end
|
|
577
|
+
matches: scope
|
|
578
|
+
has:
|
|
579
|
+
stopBy:
|
|
580
|
+
matches: scope
|
|
581
|
+
any:
|
|
582
|
+
- matches: binding-name
|
|
583
|
+
pattern: $SHEETS
|
|
584
|
+
- matches: function-declaration
|
|
585
|
+
has:
|
|
586
|
+
field: name
|
|
587
|
+
pattern: $SHEETS
|
|
588
|
+
# Why: a `var` in a nested block binds in the enclosing function.
|
|
589
|
+
- matches: block-scope
|
|
590
|
+
has:
|
|
591
|
+
stopBy:
|
|
592
|
+
matches: function-scope
|
|
593
|
+
matches: binding-name
|
|
594
|
+
pattern: $SHEETS
|
|
595
|
+
inside:
|
|
596
|
+
stopBy: end
|
|
597
|
+
matches: var-declaration
|
|
598
|
+
rule:
|
|
599
|
+
kind: import_statement
|
|
600
|
+
all:
|
|
601
|
+
- has:
|
|
602
|
+
field: source
|
|
603
|
+
regex: ^["']@ngrok/mantle/mantle-dark\.css(\?url)?["']$
|
|
604
|
+
- any:
|
|
605
|
+
- not:
|
|
606
|
+
has: { kind: import_clause }
|
|
607
|
+
- all:
|
|
608
|
+
- has:
|
|
609
|
+
kind: import_clause
|
|
610
|
+
has: { kind: identifier, pattern: $NAME }
|
|
611
|
+
# Why: deleting a binding that other code still reads leaves an undefined
|
|
612
|
+
# name. That code stays, and the type checker names the manual work.
|
|
613
|
+
- not:
|
|
614
|
+
inside:
|
|
615
|
+
stopBy: end
|
|
616
|
+
kind: program
|
|
617
|
+
has:
|
|
618
|
+
stopBy: end
|
|
619
|
+
any:
|
|
620
|
+
- kind: identifier
|
|
621
|
+
- kind: shorthand_property_identifier
|
|
622
|
+
- kind: type_identifier
|
|
623
|
+
pattern: $NAME
|
|
624
|
+
not:
|
|
625
|
+
any:
|
|
626
|
+
- inside: { stopBy: end, kind: import_statement }
|
|
627
|
+
- inside: { stopBy: end, matches: deleted-element }
|
|
628
|
+
- inside: { stopBy: end, matches: deleted-declaration }
|
|
629
|
+
fix: ""
|
|
630
|
+
---
|
|
631
|
+
id: mantle-style-sheets-import-specifier
|
|
632
|
+
language: tsx
|
|
633
|
+
message: MantleStyleSheets and mantleStyleSheetUrls are gone
|
|
634
|
+
utils:
|
|
635
|
+
# A node that opens a lexical scope. The shadow search below stops at a
|
|
636
|
+
# nested one, so a sibling function's local name does not count.
|
|
637
|
+
scope:
|
|
638
|
+
any:
|
|
639
|
+
- kind: statement_block
|
|
640
|
+
- kind: function_declaration
|
|
641
|
+
- kind: generator_function_declaration
|
|
642
|
+
- kind: function_expression
|
|
643
|
+
- kind: generator_function
|
|
644
|
+
- kind: arrow_function
|
|
645
|
+
- kind: method_definition
|
|
646
|
+
- kind: class_body
|
|
647
|
+
- kind: for_statement
|
|
648
|
+
- kind: for_in_statement
|
|
649
|
+
- kind: catch_clause
|
|
650
|
+
# An identifier in a binding position: a parameter, a destructured name, a
|
|
651
|
+
# local variable, a function name, or a class name.
|
|
652
|
+
binding-name:
|
|
653
|
+
any:
|
|
654
|
+
- kind: shorthand_property_identifier_pattern
|
|
655
|
+
- kind: identifier
|
|
656
|
+
any:
|
|
657
|
+
- inside: { kind: variable_declarator, field: name }
|
|
658
|
+
- inside: { kind: function_declaration, field: name }
|
|
659
|
+
- inside: { kind: generator_function_declaration, field: name }
|
|
660
|
+
- inside: { kind: function_expression, field: name }
|
|
661
|
+
- inside: { kind: required_parameter, field: pattern }
|
|
662
|
+
- inside: { kind: optional_parameter, field: pattern }
|
|
663
|
+
- inside: { kind: assignment_pattern, field: left }
|
|
664
|
+
- inside: { kind: pair_pattern, field: value }
|
|
665
|
+
- inside: { kind: array_pattern }
|
|
666
|
+
- inside: { kind: rest_pattern }
|
|
667
|
+
- inside: { kind: arrow_function, field: parameter }
|
|
668
|
+
- inside: { kind: catch_clause, field: parameter }
|
|
669
|
+
- inside: { kind: for_in_statement, field: left }
|
|
670
|
+
- kind: type_identifier
|
|
671
|
+
inside: { kind: class_declaration, field: name }
|
|
672
|
+
# A function declaration opens a scope, so the search above stops at it and
|
|
673
|
+
# never reads its name. This matches the declaration itself instead.
|
|
674
|
+
function-declaration:
|
|
675
|
+
any:
|
|
676
|
+
- kind: function_declaration
|
|
677
|
+
- kind: generator_function_declaration
|
|
678
|
+
# A scope that a `var` leaves: the `var` binds in the enclosing function.
|
|
679
|
+
block-scope:
|
|
680
|
+
any:
|
|
681
|
+
- kind: statement_block
|
|
682
|
+
- kind: for_statement
|
|
683
|
+
- kind: for_in_statement
|
|
684
|
+
- kind: catch_clause
|
|
685
|
+
function-scope:
|
|
686
|
+
any:
|
|
687
|
+
- kind: function_declaration
|
|
688
|
+
- kind: generator_function_declaration
|
|
689
|
+
- kind: function_expression
|
|
690
|
+
- kind: generator_function
|
|
691
|
+
- kind: arrow_function
|
|
692
|
+
- kind: method_definition
|
|
693
|
+
var-declaration:
|
|
694
|
+
any:
|
|
695
|
+
- kind: variable_declaration
|
|
696
|
+
- kind: for_in_statement
|
|
697
|
+
regex: ^for\s*(await\s*)?\(\s*var\b
|
|
698
|
+
style-sheet-urls-import:
|
|
699
|
+
kind: import_statement
|
|
700
|
+
all:
|
|
701
|
+
- has:
|
|
702
|
+
field: source
|
|
703
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
704
|
+
- has:
|
|
705
|
+
stopBy: end
|
|
706
|
+
kind: import_specifier
|
|
707
|
+
has:
|
|
708
|
+
field: name
|
|
709
|
+
regex: ^mantleStyleSheetUrls$
|
|
710
|
+
any:
|
|
711
|
+
- kind: import_specifier
|
|
712
|
+
has:
|
|
713
|
+
field: alias
|
|
714
|
+
pattern: $URLS
|
|
715
|
+
- kind: import_specifier
|
|
716
|
+
not:
|
|
717
|
+
has:
|
|
718
|
+
field: alias
|
|
719
|
+
kind: identifier
|
|
720
|
+
has:
|
|
721
|
+
field: name
|
|
722
|
+
pattern: $URLS
|
|
723
|
+
# A `const` the declaration rule deletes: not exported, one declarator, a
|
|
724
|
+
# call to mantle's `mantleStyleSheetUrls` as its value, and a name that only
|
|
725
|
+
# a deleted `<MantleStyleSheets />` reads.
|
|
726
|
+
deleted-declaration:
|
|
727
|
+
kind: lexical_declaration
|
|
728
|
+
not:
|
|
729
|
+
inside: { kind: export_statement }
|
|
730
|
+
all:
|
|
731
|
+
- has:
|
|
732
|
+
kind: variable_declarator
|
|
733
|
+
all:
|
|
734
|
+
- has: { field: name, kind: identifier, pattern: $DECL }
|
|
735
|
+
- has:
|
|
736
|
+
field: value
|
|
737
|
+
kind: call_expression
|
|
738
|
+
all:
|
|
739
|
+
- has: { field: function, kind: identifier, pattern: $URLS }
|
|
740
|
+
- inside:
|
|
741
|
+
stopBy: end
|
|
742
|
+
kind: program
|
|
743
|
+
has:
|
|
744
|
+
matches: style-sheet-urls-import
|
|
745
|
+
# Why: a parameter or a local under the import's name shadows it, and the
|
|
746
|
+
# rules cannot tell which binding the code reads.
|
|
747
|
+
- not:
|
|
748
|
+
inside:
|
|
749
|
+
stopBy: end
|
|
750
|
+
matches: scope
|
|
751
|
+
has:
|
|
752
|
+
stopBy:
|
|
753
|
+
matches: scope
|
|
754
|
+
any:
|
|
755
|
+
- matches: binding-name
|
|
756
|
+
pattern: $URLS
|
|
757
|
+
- matches: function-declaration
|
|
758
|
+
has:
|
|
759
|
+
field: name
|
|
760
|
+
pattern: $URLS
|
|
761
|
+
# Why: a `var` in a nested block binds in the enclosing function.
|
|
762
|
+
- matches: block-scope
|
|
763
|
+
has:
|
|
764
|
+
stopBy:
|
|
765
|
+
matches: function-scope
|
|
766
|
+
matches: binding-name
|
|
767
|
+
pattern: $URLS
|
|
768
|
+
inside:
|
|
769
|
+
stopBy: end
|
|
770
|
+
matches: var-declaration
|
|
771
|
+
# Why one declarator: a deletion would take its siblings with it.
|
|
772
|
+
- not:
|
|
773
|
+
has:
|
|
774
|
+
kind: variable_declarator
|
|
775
|
+
follows: { stopBy: end, kind: variable_declarator }
|
|
776
|
+
# Why: a name that other code still reads keeps its declaration.
|
|
777
|
+
- not:
|
|
778
|
+
inside:
|
|
779
|
+
stopBy: end
|
|
780
|
+
kind: program
|
|
781
|
+
has:
|
|
782
|
+
stopBy: end
|
|
783
|
+
any:
|
|
784
|
+
- kind: identifier
|
|
785
|
+
- kind: shorthand_property_identifier
|
|
786
|
+
pattern: $DECL
|
|
787
|
+
not:
|
|
788
|
+
any:
|
|
789
|
+
- inside: { kind: variable_declarator, field: name }
|
|
790
|
+
- inside: { stopBy: end, matches: deleted-element }
|
|
791
|
+
mantle-style-sheets-import:
|
|
792
|
+
kind: import_statement
|
|
793
|
+
all:
|
|
794
|
+
- has:
|
|
795
|
+
field: source
|
|
796
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
797
|
+
- has:
|
|
798
|
+
stopBy: end
|
|
799
|
+
kind: import_specifier
|
|
800
|
+
has:
|
|
801
|
+
field: name
|
|
802
|
+
regex: ^MantleStyleSheets$
|
|
803
|
+
any:
|
|
804
|
+
- kind: import_specifier
|
|
805
|
+
has:
|
|
806
|
+
field: alias
|
|
807
|
+
pattern: $SHEETS
|
|
808
|
+
- kind: import_specifier
|
|
809
|
+
not:
|
|
810
|
+
has:
|
|
811
|
+
field: alias
|
|
812
|
+
kind: identifier
|
|
813
|
+
has:
|
|
814
|
+
field: name
|
|
815
|
+
pattern: $SHEETS
|
|
816
|
+
# A `<MantleStyleSheets />` the element rule deletes: a direct child of a
|
|
817
|
+
# JSX element, bound to mantle's import.
|
|
818
|
+
deleted-element:
|
|
819
|
+
kind: jsx_self_closing_element
|
|
820
|
+
inside: { kind: jsx_element }
|
|
821
|
+
all:
|
|
822
|
+
- has:
|
|
823
|
+
field: name
|
|
824
|
+
kind: identifier
|
|
825
|
+
pattern: $SHEETS
|
|
826
|
+
- inside:
|
|
827
|
+
stopBy: end
|
|
828
|
+
kind: program
|
|
829
|
+
has:
|
|
830
|
+
matches: mantle-style-sheets-import
|
|
831
|
+
# Why: a parameter or a local under the import's name shadows it, and the
|
|
832
|
+
# rules cannot tell which binding the code reads.
|
|
833
|
+
- not:
|
|
834
|
+
inside:
|
|
835
|
+
stopBy: end
|
|
836
|
+
matches: scope
|
|
837
|
+
has:
|
|
838
|
+
stopBy:
|
|
839
|
+
matches: scope
|
|
840
|
+
any:
|
|
841
|
+
- matches: binding-name
|
|
842
|
+
pattern: $SHEETS
|
|
843
|
+
- matches: function-declaration
|
|
844
|
+
has:
|
|
845
|
+
field: name
|
|
846
|
+
pattern: $SHEETS
|
|
847
|
+
# Why: a `var` in a nested block binds in the enclosing function.
|
|
848
|
+
- matches: block-scope
|
|
849
|
+
has:
|
|
850
|
+
stopBy:
|
|
851
|
+
matches: function-scope
|
|
852
|
+
matches: binding-name
|
|
853
|
+
pattern: $SHEETS
|
|
854
|
+
inside:
|
|
855
|
+
stopBy: end
|
|
856
|
+
matches: var-declaration
|
|
857
|
+
rule:
|
|
858
|
+
kind: import_specifier
|
|
859
|
+
all:
|
|
860
|
+
- has:
|
|
861
|
+
field: name
|
|
862
|
+
regex: ^(MantleStyleSheets|mantleStyleSheetUrls|MantleStyleSheetsProps|MantleThemeCssUrls)$
|
|
863
|
+
- any:
|
|
864
|
+
- has:
|
|
865
|
+
field: alias
|
|
866
|
+
pattern: $LOCAL
|
|
867
|
+
- all:
|
|
868
|
+
- not:
|
|
869
|
+
has:
|
|
870
|
+
field: alias
|
|
871
|
+
kind: identifier
|
|
872
|
+
- has:
|
|
873
|
+
field: name
|
|
874
|
+
pattern: $LOCAL
|
|
875
|
+
- inside:
|
|
876
|
+
stopBy: end
|
|
877
|
+
kind: import_statement
|
|
878
|
+
has:
|
|
879
|
+
field: source
|
|
880
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
881
|
+
# Why a sibling that stays: removing the last specifier leaves an empty
|
|
882
|
+
# import. The statement rule deletes that one whole.
|
|
883
|
+
- inside:
|
|
884
|
+
kind: named_imports
|
|
885
|
+
has:
|
|
886
|
+
kind: import_specifier
|
|
887
|
+
not:
|
|
888
|
+
has:
|
|
889
|
+
field: name
|
|
890
|
+
regex: ^(MantleStyleSheets|mantleStyleSheetUrls|MantleStyleSheetsProps|MantleThemeCssUrls)$
|
|
891
|
+
# Why: deleting a binding that other code still reads leaves an undefined
|
|
892
|
+
# name. That code stays, and the type checker names the manual work.
|
|
893
|
+
- not:
|
|
894
|
+
inside:
|
|
895
|
+
stopBy: end
|
|
896
|
+
kind: program
|
|
897
|
+
has:
|
|
898
|
+
stopBy: end
|
|
899
|
+
any:
|
|
900
|
+
- kind: identifier
|
|
901
|
+
- kind: shorthand_property_identifier
|
|
902
|
+
- kind: type_identifier
|
|
903
|
+
pattern: $LOCAL
|
|
904
|
+
not:
|
|
905
|
+
any:
|
|
906
|
+
- inside: { stopBy: end, kind: import_statement }
|
|
907
|
+
- inside: { stopBy: end, matches: deleted-element }
|
|
908
|
+
- inside: { stopBy: end, matches: deleted-declaration }
|
|
909
|
+
fix:
|
|
910
|
+
template: ""
|
|
911
|
+
expandEnd: { regex: "^,$" }
|
|
912
|
+
---
|
|
913
|
+
id: mantle-style-sheets-import-statement
|
|
914
|
+
language: tsx
|
|
915
|
+
message: MantleStyleSheets and mantleStyleSheetUrls are gone
|
|
916
|
+
utils:
|
|
917
|
+
# A node that opens a lexical scope. The shadow search below stops at a
|
|
918
|
+
# nested one, so a sibling function's local name does not count.
|
|
919
|
+
scope:
|
|
920
|
+
any:
|
|
921
|
+
- kind: statement_block
|
|
922
|
+
- kind: function_declaration
|
|
923
|
+
- kind: generator_function_declaration
|
|
924
|
+
- kind: function_expression
|
|
925
|
+
- kind: generator_function
|
|
926
|
+
- kind: arrow_function
|
|
927
|
+
- kind: method_definition
|
|
928
|
+
- kind: class_body
|
|
929
|
+
- kind: for_statement
|
|
930
|
+
- kind: for_in_statement
|
|
931
|
+
- kind: catch_clause
|
|
932
|
+
# An identifier in a binding position: a parameter, a destructured name, a
|
|
933
|
+
# local variable, a function name, or a class name.
|
|
934
|
+
binding-name:
|
|
935
|
+
any:
|
|
936
|
+
- kind: shorthand_property_identifier_pattern
|
|
937
|
+
- kind: identifier
|
|
938
|
+
any:
|
|
939
|
+
- inside: { kind: variable_declarator, field: name }
|
|
940
|
+
- inside: { kind: function_declaration, field: name }
|
|
941
|
+
- inside: { kind: generator_function_declaration, field: name }
|
|
942
|
+
- inside: { kind: function_expression, field: name }
|
|
943
|
+
- inside: { kind: required_parameter, field: pattern }
|
|
944
|
+
- inside: { kind: optional_parameter, field: pattern }
|
|
945
|
+
- inside: { kind: assignment_pattern, field: left }
|
|
946
|
+
- inside: { kind: pair_pattern, field: value }
|
|
947
|
+
- inside: { kind: array_pattern }
|
|
948
|
+
- inside: { kind: rest_pattern }
|
|
949
|
+
- inside: { kind: arrow_function, field: parameter }
|
|
950
|
+
- inside: { kind: catch_clause, field: parameter }
|
|
951
|
+
- inside: { kind: for_in_statement, field: left }
|
|
952
|
+
- kind: type_identifier
|
|
953
|
+
inside: { kind: class_declaration, field: name }
|
|
954
|
+
# A function declaration opens a scope, so the search above stops at it and
|
|
955
|
+
# never reads its name. This matches the declaration itself instead.
|
|
956
|
+
function-declaration:
|
|
957
|
+
any:
|
|
958
|
+
- kind: function_declaration
|
|
959
|
+
- kind: generator_function_declaration
|
|
960
|
+
# A scope that a `var` leaves: the `var` binds in the enclosing function.
|
|
961
|
+
block-scope:
|
|
962
|
+
any:
|
|
963
|
+
- kind: statement_block
|
|
964
|
+
- kind: for_statement
|
|
965
|
+
- kind: for_in_statement
|
|
966
|
+
- kind: catch_clause
|
|
967
|
+
function-scope:
|
|
968
|
+
any:
|
|
969
|
+
- kind: function_declaration
|
|
970
|
+
- kind: generator_function_declaration
|
|
971
|
+
- kind: function_expression
|
|
972
|
+
- kind: generator_function
|
|
973
|
+
- kind: arrow_function
|
|
974
|
+
- kind: method_definition
|
|
975
|
+
var-declaration:
|
|
976
|
+
any:
|
|
977
|
+
- kind: variable_declaration
|
|
978
|
+
- kind: for_in_statement
|
|
979
|
+
regex: ^for\s*(await\s*)?\(\s*var\b
|
|
980
|
+
style-sheet-urls-import:
|
|
981
|
+
kind: import_statement
|
|
982
|
+
all:
|
|
983
|
+
- has:
|
|
984
|
+
field: source
|
|
985
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
986
|
+
- has:
|
|
987
|
+
stopBy: end
|
|
988
|
+
kind: import_specifier
|
|
989
|
+
has:
|
|
990
|
+
field: name
|
|
991
|
+
regex: ^mantleStyleSheetUrls$
|
|
992
|
+
any:
|
|
993
|
+
- kind: import_specifier
|
|
994
|
+
has:
|
|
995
|
+
field: alias
|
|
996
|
+
pattern: $URLS
|
|
997
|
+
- kind: import_specifier
|
|
998
|
+
not:
|
|
999
|
+
has:
|
|
1000
|
+
field: alias
|
|
1001
|
+
kind: identifier
|
|
1002
|
+
has:
|
|
1003
|
+
field: name
|
|
1004
|
+
pattern: $URLS
|
|
1005
|
+
# A `const` the declaration rule deletes: not exported, one declarator, a
|
|
1006
|
+
# call to mantle's `mantleStyleSheetUrls` as its value, and a name that only
|
|
1007
|
+
# a deleted `<MantleStyleSheets />` reads.
|
|
1008
|
+
deleted-declaration:
|
|
1009
|
+
kind: lexical_declaration
|
|
1010
|
+
not:
|
|
1011
|
+
inside: { kind: export_statement }
|
|
1012
|
+
all:
|
|
1013
|
+
- has:
|
|
1014
|
+
kind: variable_declarator
|
|
1015
|
+
all:
|
|
1016
|
+
- has: { field: name, kind: identifier, pattern: $DECL }
|
|
1017
|
+
- has:
|
|
1018
|
+
field: value
|
|
1019
|
+
kind: call_expression
|
|
1020
|
+
all:
|
|
1021
|
+
- has: { field: function, kind: identifier, pattern: $URLS }
|
|
1022
|
+
- inside:
|
|
1023
|
+
stopBy: end
|
|
1024
|
+
kind: program
|
|
1025
|
+
has:
|
|
1026
|
+
matches: style-sheet-urls-import
|
|
1027
|
+
# Why: a parameter or a local under the import's name shadows it, and the
|
|
1028
|
+
# rules cannot tell which binding the code reads.
|
|
1029
|
+
- not:
|
|
1030
|
+
inside:
|
|
1031
|
+
stopBy: end
|
|
1032
|
+
matches: scope
|
|
1033
|
+
has:
|
|
1034
|
+
stopBy:
|
|
1035
|
+
matches: scope
|
|
1036
|
+
any:
|
|
1037
|
+
- matches: binding-name
|
|
1038
|
+
pattern: $URLS
|
|
1039
|
+
- matches: function-declaration
|
|
1040
|
+
has:
|
|
1041
|
+
field: name
|
|
1042
|
+
pattern: $URLS
|
|
1043
|
+
# Why: a `var` in a nested block binds in the enclosing function.
|
|
1044
|
+
- matches: block-scope
|
|
1045
|
+
has:
|
|
1046
|
+
stopBy:
|
|
1047
|
+
matches: function-scope
|
|
1048
|
+
matches: binding-name
|
|
1049
|
+
pattern: $URLS
|
|
1050
|
+
inside:
|
|
1051
|
+
stopBy: end
|
|
1052
|
+
matches: var-declaration
|
|
1053
|
+
# Why one declarator: a deletion would take its siblings with it.
|
|
1054
|
+
- not:
|
|
1055
|
+
has:
|
|
1056
|
+
kind: variable_declarator
|
|
1057
|
+
follows: { stopBy: end, kind: variable_declarator }
|
|
1058
|
+
# Why: a name that other code still reads keeps its declaration.
|
|
1059
|
+
- not:
|
|
1060
|
+
inside:
|
|
1061
|
+
stopBy: end
|
|
1062
|
+
kind: program
|
|
1063
|
+
has:
|
|
1064
|
+
stopBy: end
|
|
1065
|
+
any:
|
|
1066
|
+
- kind: identifier
|
|
1067
|
+
- kind: shorthand_property_identifier
|
|
1068
|
+
pattern: $DECL
|
|
1069
|
+
not:
|
|
1070
|
+
any:
|
|
1071
|
+
- inside: { kind: variable_declarator, field: name }
|
|
1072
|
+
- inside: { stopBy: end, matches: deleted-element }
|
|
1073
|
+
mantle-style-sheets-import:
|
|
1074
|
+
kind: import_statement
|
|
1075
|
+
all:
|
|
1076
|
+
- has:
|
|
1077
|
+
field: source
|
|
1078
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
1079
|
+
- has:
|
|
1080
|
+
stopBy: end
|
|
1081
|
+
kind: import_specifier
|
|
1082
|
+
has:
|
|
1083
|
+
field: name
|
|
1084
|
+
regex: ^MantleStyleSheets$
|
|
1085
|
+
any:
|
|
1086
|
+
- kind: import_specifier
|
|
1087
|
+
has:
|
|
1088
|
+
field: alias
|
|
1089
|
+
pattern: $SHEETS
|
|
1090
|
+
- kind: import_specifier
|
|
1091
|
+
not:
|
|
1092
|
+
has:
|
|
1093
|
+
field: alias
|
|
1094
|
+
kind: identifier
|
|
1095
|
+
has:
|
|
1096
|
+
field: name
|
|
1097
|
+
pattern: $SHEETS
|
|
1098
|
+
# A `<MantleStyleSheets />` the element rule deletes: a direct child of a
|
|
1099
|
+
# JSX element, bound to mantle's import.
|
|
1100
|
+
deleted-element:
|
|
1101
|
+
kind: jsx_self_closing_element
|
|
1102
|
+
inside: { kind: jsx_element }
|
|
1103
|
+
all:
|
|
1104
|
+
- has:
|
|
1105
|
+
field: name
|
|
1106
|
+
kind: identifier
|
|
1107
|
+
pattern: $SHEETS
|
|
1108
|
+
- inside:
|
|
1109
|
+
stopBy: end
|
|
1110
|
+
kind: program
|
|
1111
|
+
has:
|
|
1112
|
+
matches: mantle-style-sheets-import
|
|
1113
|
+
# Why: a parameter or a local under the import's name shadows it, and the
|
|
1114
|
+
# rules cannot tell which binding the code reads.
|
|
1115
|
+
- not:
|
|
1116
|
+
inside:
|
|
1117
|
+
stopBy: end
|
|
1118
|
+
matches: scope
|
|
1119
|
+
has:
|
|
1120
|
+
stopBy:
|
|
1121
|
+
matches: scope
|
|
1122
|
+
any:
|
|
1123
|
+
- matches: binding-name
|
|
1124
|
+
pattern: $SHEETS
|
|
1125
|
+
- matches: function-declaration
|
|
1126
|
+
has:
|
|
1127
|
+
field: name
|
|
1128
|
+
pattern: $SHEETS
|
|
1129
|
+
# Why: a `var` in a nested block binds in the enclosing function.
|
|
1130
|
+
- matches: block-scope
|
|
1131
|
+
has:
|
|
1132
|
+
stopBy:
|
|
1133
|
+
matches: function-scope
|
|
1134
|
+
matches: binding-name
|
|
1135
|
+
pattern: $SHEETS
|
|
1136
|
+
inside:
|
|
1137
|
+
stopBy: end
|
|
1138
|
+
matches: var-declaration
|
|
1139
|
+
rule:
|
|
1140
|
+
kind: import_statement
|
|
1141
|
+
all:
|
|
1142
|
+
- has:
|
|
1143
|
+
field: source
|
|
1144
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
1145
|
+
- not:
|
|
1146
|
+
has: { kind: import_clause, has: { kind: identifier } }
|
|
1147
|
+
- has:
|
|
1148
|
+
stopBy: end
|
|
1149
|
+
kind: named_imports
|
|
1150
|
+
not:
|
|
1151
|
+
has:
|
|
1152
|
+
kind: import_specifier
|
|
1153
|
+
not:
|
|
1154
|
+
has:
|
|
1155
|
+
field: name
|
|
1156
|
+
regex: ^(MantleStyleSheets|mantleStyleSheetUrls|MantleStyleSheetsProps|MantleThemeCssUrls)$
|
|
1157
|
+
# Why: deleting a binding that other code still reads leaves an undefined
|
|
1158
|
+
# name. That import stays, and the type checker names the manual work.
|
|
1159
|
+
- not:
|
|
1160
|
+
has:
|
|
1161
|
+
stopBy: end
|
|
1162
|
+
kind: import_specifier
|
|
1163
|
+
all:
|
|
1164
|
+
- any:
|
|
1165
|
+
- has:
|
|
1166
|
+
field: alias
|
|
1167
|
+
pattern: $LOCAL
|
|
1168
|
+
- all:
|
|
1169
|
+
- not:
|
|
1170
|
+
has:
|
|
1171
|
+
field: alias
|
|
1172
|
+
kind: identifier
|
|
1173
|
+
- has:
|
|
1174
|
+
field: name
|
|
1175
|
+
pattern: $LOCAL
|
|
1176
|
+
- inside:
|
|
1177
|
+
stopBy: end
|
|
1178
|
+
kind: program
|
|
1179
|
+
has:
|
|
1180
|
+
stopBy: end
|
|
1181
|
+
any:
|
|
1182
|
+
- kind: identifier
|
|
1183
|
+
- kind: shorthand_property_identifier
|
|
1184
|
+
- kind: type_identifier
|
|
1185
|
+
pattern: $LOCAL
|
|
1186
|
+
not:
|
|
1187
|
+
any:
|
|
1188
|
+
- inside: { stopBy: end, kind: import_statement }
|
|
1189
|
+
- inside: { stopBy: end, matches: deleted-element }
|
|
1190
|
+
- inside: { stopBy: end, matches: deleted-declaration }
|
|
1191
|
+
fix: ""
|
|
1192
|
+
---
|
|
1193
|
+
id: mantle-style-sheet-urls-declaration
|
|
1194
|
+
language: typescript
|
|
1195
|
+
message: mantleStyleSheetUrls is gone; mantle.css holds both themes
|
|
1196
|
+
utils:
|
|
1197
|
+
# A node that opens a lexical scope. The shadow search below stops at a
|
|
1198
|
+
# nested one, so a sibling function's local name does not count.
|
|
1199
|
+
scope:
|
|
1200
|
+
any:
|
|
1201
|
+
- kind: statement_block
|
|
1202
|
+
- kind: function_declaration
|
|
1203
|
+
- kind: generator_function_declaration
|
|
1204
|
+
- kind: function_expression
|
|
1205
|
+
- kind: generator_function
|
|
1206
|
+
- kind: arrow_function
|
|
1207
|
+
- kind: method_definition
|
|
1208
|
+
- kind: class_body
|
|
1209
|
+
- kind: for_statement
|
|
1210
|
+
- kind: for_in_statement
|
|
1211
|
+
- kind: catch_clause
|
|
1212
|
+
# An identifier in a binding position: a parameter, a destructured name, a
|
|
1213
|
+
# local variable, a function name, or a class name.
|
|
1214
|
+
binding-name:
|
|
1215
|
+
any:
|
|
1216
|
+
- kind: shorthand_property_identifier_pattern
|
|
1217
|
+
- kind: identifier
|
|
1218
|
+
any:
|
|
1219
|
+
- inside: { kind: variable_declarator, field: name }
|
|
1220
|
+
- inside: { kind: function_declaration, field: name }
|
|
1221
|
+
- inside: { kind: generator_function_declaration, field: name }
|
|
1222
|
+
- inside: { kind: function_expression, field: name }
|
|
1223
|
+
- inside: { kind: required_parameter, field: pattern }
|
|
1224
|
+
- inside: { kind: optional_parameter, field: pattern }
|
|
1225
|
+
- inside: { kind: assignment_pattern, field: left }
|
|
1226
|
+
- inside: { kind: pair_pattern, field: value }
|
|
1227
|
+
- inside: { kind: array_pattern }
|
|
1228
|
+
- inside: { kind: rest_pattern }
|
|
1229
|
+
- inside: { kind: arrow_function, field: parameter }
|
|
1230
|
+
- inside: { kind: catch_clause, field: parameter }
|
|
1231
|
+
- inside: { kind: for_in_statement, field: left }
|
|
1232
|
+
- kind: type_identifier
|
|
1233
|
+
inside: { kind: class_declaration, field: name }
|
|
1234
|
+
# A function declaration opens a scope, so the search above stops at it and
|
|
1235
|
+
# never reads its name. This matches the declaration itself instead.
|
|
1236
|
+
function-declaration:
|
|
1237
|
+
any:
|
|
1238
|
+
- kind: function_declaration
|
|
1239
|
+
- kind: generator_function_declaration
|
|
1240
|
+
# A scope that a `var` leaves: the `var` binds in the enclosing function.
|
|
1241
|
+
block-scope:
|
|
1242
|
+
any:
|
|
1243
|
+
- kind: statement_block
|
|
1244
|
+
- kind: for_statement
|
|
1245
|
+
- kind: for_in_statement
|
|
1246
|
+
- kind: catch_clause
|
|
1247
|
+
function-scope:
|
|
1248
|
+
any:
|
|
1249
|
+
- kind: function_declaration
|
|
1250
|
+
- kind: generator_function_declaration
|
|
1251
|
+
- kind: function_expression
|
|
1252
|
+
- kind: generator_function
|
|
1253
|
+
- kind: arrow_function
|
|
1254
|
+
- kind: method_definition
|
|
1255
|
+
var-declaration:
|
|
1256
|
+
any:
|
|
1257
|
+
- kind: variable_declaration
|
|
1258
|
+
- kind: for_in_statement
|
|
1259
|
+
regex: ^for\s*(await\s*)?\(\s*var\b
|
|
1260
|
+
style-sheet-urls-import:
|
|
1261
|
+
kind: import_statement
|
|
1262
|
+
all:
|
|
1263
|
+
- has:
|
|
1264
|
+
field: source
|
|
1265
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
1266
|
+
- has:
|
|
1267
|
+
stopBy: end
|
|
1268
|
+
kind: import_specifier
|
|
1269
|
+
has:
|
|
1270
|
+
field: name
|
|
1271
|
+
regex: ^mantleStyleSheetUrls$
|
|
1272
|
+
any:
|
|
1273
|
+
- kind: import_specifier
|
|
1274
|
+
has:
|
|
1275
|
+
field: alias
|
|
1276
|
+
pattern: $URLS
|
|
1277
|
+
- kind: import_specifier
|
|
1278
|
+
not:
|
|
1279
|
+
has:
|
|
1280
|
+
field: alias
|
|
1281
|
+
kind: identifier
|
|
1282
|
+
has:
|
|
1283
|
+
field: name
|
|
1284
|
+
pattern: $URLS
|
|
1285
|
+
# A `const` the declaration rule deletes: not exported, one declarator, a
|
|
1286
|
+
# call to mantle's `mantleStyleSheetUrls` as its value, and a name that only
|
|
1287
|
+
# a deleted `<MantleStyleSheets />` reads.
|
|
1288
|
+
deleted-declaration:
|
|
1289
|
+
kind: lexical_declaration
|
|
1290
|
+
not:
|
|
1291
|
+
inside: { kind: export_statement }
|
|
1292
|
+
all:
|
|
1293
|
+
- has:
|
|
1294
|
+
kind: variable_declarator
|
|
1295
|
+
all:
|
|
1296
|
+
- has: { field: name, kind: identifier, pattern: $DECL }
|
|
1297
|
+
- has:
|
|
1298
|
+
field: value
|
|
1299
|
+
kind: call_expression
|
|
1300
|
+
all:
|
|
1301
|
+
- has: { field: function, kind: identifier, pattern: $URLS }
|
|
1302
|
+
- inside:
|
|
1303
|
+
stopBy: end
|
|
1304
|
+
kind: program
|
|
1305
|
+
has:
|
|
1306
|
+
matches: style-sheet-urls-import
|
|
1307
|
+
# Why: a parameter or a local under the import's name shadows it, and the
|
|
1308
|
+
# rules cannot tell which binding the code reads.
|
|
1309
|
+
- not:
|
|
1310
|
+
inside:
|
|
1311
|
+
stopBy: end
|
|
1312
|
+
matches: scope
|
|
1313
|
+
has:
|
|
1314
|
+
stopBy:
|
|
1315
|
+
matches: scope
|
|
1316
|
+
any:
|
|
1317
|
+
- matches: binding-name
|
|
1318
|
+
pattern: $URLS
|
|
1319
|
+
- matches: function-declaration
|
|
1320
|
+
has:
|
|
1321
|
+
field: name
|
|
1322
|
+
pattern: $URLS
|
|
1323
|
+
# Why: a `var` in a nested block binds in the enclosing function.
|
|
1324
|
+
- matches: block-scope
|
|
1325
|
+
has:
|
|
1326
|
+
stopBy:
|
|
1327
|
+
matches: function-scope
|
|
1328
|
+
matches: binding-name
|
|
1329
|
+
pattern: $URLS
|
|
1330
|
+
inside:
|
|
1331
|
+
stopBy: end
|
|
1332
|
+
matches: var-declaration
|
|
1333
|
+
# Why one declarator: a deletion would take its siblings with it.
|
|
1334
|
+
- not:
|
|
1335
|
+
has:
|
|
1336
|
+
kind: variable_declarator
|
|
1337
|
+
follows: { stopBy: end, kind: variable_declarator }
|
|
1338
|
+
# Why: a name that other code still reads keeps its declaration.
|
|
1339
|
+
- not:
|
|
1340
|
+
inside:
|
|
1341
|
+
stopBy: end
|
|
1342
|
+
kind: program
|
|
1343
|
+
has:
|
|
1344
|
+
stopBy: end
|
|
1345
|
+
any:
|
|
1346
|
+
- kind: identifier
|
|
1347
|
+
- kind: shorthand_property_identifier
|
|
1348
|
+
pattern: $DECL
|
|
1349
|
+
not:
|
|
1350
|
+
any:
|
|
1351
|
+
- inside: { kind: variable_declarator, field: name }
|
|
1352
|
+
rule:
|
|
1353
|
+
matches: deleted-declaration
|
|
1354
|
+
fix: ""
|
|
1355
|
+
---
|
|
1356
|
+
id: mantle-dark-stylesheet-import
|
|
1357
|
+
language: typescript
|
|
1358
|
+
message: mantle-dark.css is gone; mantle.css holds both themes
|
|
1359
|
+
utils:
|
|
1360
|
+
# A node that opens a lexical scope. The shadow search below stops at a
|
|
1361
|
+
# nested one, so a sibling function's local name does not count.
|
|
1362
|
+
scope:
|
|
1363
|
+
any:
|
|
1364
|
+
- kind: statement_block
|
|
1365
|
+
- kind: function_declaration
|
|
1366
|
+
- kind: generator_function_declaration
|
|
1367
|
+
- kind: function_expression
|
|
1368
|
+
- kind: generator_function
|
|
1369
|
+
- kind: arrow_function
|
|
1370
|
+
- kind: method_definition
|
|
1371
|
+
- kind: class_body
|
|
1372
|
+
- kind: for_statement
|
|
1373
|
+
- kind: for_in_statement
|
|
1374
|
+
- kind: catch_clause
|
|
1375
|
+
# An identifier in a binding position: a parameter, a destructured name, a
|
|
1376
|
+
# local variable, a function name, or a class name.
|
|
1377
|
+
binding-name:
|
|
1378
|
+
any:
|
|
1379
|
+
- kind: shorthand_property_identifier_pattern
|
|
1380
|
+
- kind: identifier
|
|
1381
|
+
any:
|
|
1382
|
+
- inside: { kind: variable_declarator, field: name }
|
|
1383
|
+
- inside: { kind: function_declaration, field: name }
|
|
1384
|
+
- inside: { kind: generator_function_declaration, field: name }
|
|
1385
|
+
- inside: { kind: function_expression, field: name }
|
|
1386
|
+
- inside: { kind: required_parameter, field: pattern }
|
|
1387
|
+
- inside: { kind: optional_parameter, field: pattern }
|
|
1388
|
+
- inside: { kind: assignment_pattern, field: left }
|
|
1389
|
+
- inside: { kind: pair_pattern, field: value }
|
|
1390
|
+
- inside: { kind: array_pattern }
|
|
1391
|
+
- inside: { kind: rest_pattern }
|
|
1392
|
+
- inside: { kind: arrow_function, field: parameter }
|
|
1393
|
+
- inside: { kind: catch_clause, field: parameter }
|
|
1394
|
+
- inside: { kind: for_in_statement, field: left }
|
|
1395
|
+
- kind: type_identifier
|
|
1396
|
+
inside: { kind: class_declaration, field: name }
|
|
1397
|
+
# A function declaration opens a scope, so the search above stops at it and
|
|
1398
|
+
# never reads its name. This matches the declaration itself instead.
|
|
1399
|
+
function-declaration:
|
|
1400
|
+
any:
|
|
1401
|
+
- kind: function_declaration
|
|
1402
|
+
- kind: generator_function_declaration
|
|
1403
|
+
# A scope that a `var` leaves: the `var` binds in the enclosing function.
|
|
1404
|
+
block-scope:
|
|
1405
|
+
any:
|
|
1406
|
+
- kind: statement_block
|
|
1407
|
+
- kind: for_statement
|
|
1408
|
+
- kind: for_in_statement
|
|
1409
|
+
- kind: catch_clause
|
|
1410
|
+
function-scope:
|
|
1411
|
+
any:
|
|
1412
|
+
- kind: function_declaration
|
|
1413
|
+
- kind: generator_function_declaration
|
|
1414
|
+
- kind: function_expression
|
|
1415
|
+
- kind: generator_function
|
|
1416
|
+
- kind: arrow_function
|
|
1417
|
+
- kind: method_definition
|
|
1418
|
+
var-declaration:
|
|
1419
|
+
any:
|
|
1420
|
+
- kind: variable_declaration
|
|
1421
|
+
- kind: for_in_statement
|
|
1422
|
+
regex: ^for\s*(await\s*)?\(\s*var\b
|
|
1423
|
+
style-sheet-urls-import:
|
|
1424
|
+
kind: import_statement
|
|
1425
|
+
all:
|
|
1426
|
+
- has:
|
|
1427
|
+
field: source
|
|
1428
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
1429
|
+
- has:
|
|
1430
|
+
stopBy: end
|
|
1431
|
+
kind: import_specifier
|
|
1432
|
+
has:
|
|
1433
|
+
field: name
|
|
1434
|
+
regex: ^mantleStyleSheetUrls$
|
|
1435
|
+
any:
|
|
1436
|
+
- kind: import_specifier
|
|
1437
|
+
has:
|
|
1438
|
+
field: alias
|
|
1439
|
+
pattern: $URLS
|
|
1440
|
+
- kind: import_specifier
|
|
1441
|
+
not:
|
|
1442
|
+
has:
|
|
1443
|
+
field: alias
|
|
1444
|
+
kind: identifier
|
|
1445
|
+
has:
|
|
1446
|
+
field: name
|
|
1447
|
+
pattern: $URLS
|
|
1448
|
+
# A `const` the declaration rule deletes: not exported, one declarator, a
|
|
1449
|
+
# call to mantle's `mantleStyleSheetUrls` as its value, and a name that only
|
|
1450
|
+
# a deleted `<MantleStyleSheets />` reads.
|
|
1451
|
+
deleted-declaration:
|
|
1452
|
+
kind: lexical_declaration
|
|
1453
|
+
not:
|
|
1454
|
+
inside: { kind: export_statement }
|
|
1455
|
+
all:
|
|
1456
|
+
- has:
|
|
1457
|
+
kind: variable_declarator
|
|
1458
|
+
all:
|
|
1459
|
+
- has: { field: name, kind: identifier, pattern: $DECL }
|
|
1460
|
+
- has:
|
|
1461
|
+
field: value
|
|
1462
|
+
kind: call_expression
|
|
1463
|
+
all:
|
|
1464
|
+
- has: { field: function, kind: identifier, pattern: $URLS }
|
|
1465
|
+
- inside:
|
|
1466
|
+
stopBy: end
|
|
1467
|
+
kind: program
|
|
1468
|
+
has:
|
|
1469
|
+
matches: style-sheet-urls-import
|
|
1470
|
+
# Why: a parameter or a local under the import's name shadows it, and the
|
|
1471
|
+
# rules cannot tell which binding the code reads.
|
|
1472
|
+
- not:
|
|
1473
|
+
inside:
|
|
1474
|
+
stopBy: end
|
|
1475
|
+
matches: scope
|
|
1476
|
+
has:
|
|
1477
|
+
stopBy:
|
|
1478
|
+
matches: scope
|
|
1479
|
+
any:
|
|
1480
|
+
- matches: binding-name
|
|
1481
|
+
pattern: $URLS
|
|
1482
|
+
- matches: function-declaration
|
|
1483
|
+
has:
|
|
1484
|
+
field: name
|
|
1485
|
+
pattern: $URLS
|
|
1486
|
+
# Why: a `var` in a nested block binds in the enclosing function.
|
|
1487
|
+
- matches: block-scope
|
|
1488
|
+
has:
|
|
1489
|
+
stopBy:
|
|
1490
|
+
matches: function-scope
|
|
1491
|
+
matches: binding-name
|
|
1492
|
+
pattern: $URLS
|
|
1493
|
+
inside:
|
|
1494
|
+
stopBy: end
|
|
1495
|
+
matches: var-declaration
|
|
1496
|
+
# Why one declarator: a deletion would take its siblings with it.
|
|
1497
|
+
- not:
|
|
1498
|
+
has:
|
|
1499
|
+
kind: variable_declarator
|
|
1500
|
+
follows: { stopBy: end, kind: variable_declarator }
|
|
1501
|
+
# Why: a name that other code still reads keeps its declaration.
|
|
1502
|
+
- not:
|
|
1503
|
+
inside:
|
|
1504
|
+
stopBy: end
|
|
1505
|
+
kind: program
|
|
1506
|
+
has:
|
|
1507
|
+
stopBy: end
|
|
1508
|
+
any:
|
|
1509
|
+
- kind: identifier
|
|
1510
|
+
- kind: shorthand_property_identifier
|
|
1511
|
+
pattern: $DECL
|
|
1512
|
+
not:
|
|
1513
|
+
any:
|
|
1514
|
+
- inside: { kind: variable_declarator, field: name }
|
|
1515
|
+
rule:
|
|
1516
|
+
kind: import_statement
|
|
1517
|
+
all:
|
|
1518
|
+
- has:
|
|
1519
|
+
field: source
|
|
1520
|
+
regex: ^["']@ngrok/mantle/mantle-dark\.css(\?url)?["']$
|
|
1521
|
+
- any:
|
|
1522
|
+
- not:
|
|
1523
|
+
has: { kind: import_clause }
|
|
1524
|
+
- all:
|
|
1525
|
+
- has:
|
|
1526
|
+
kind: import_clause
|
|
1527
|
+
has: { kind: identifier, pattern: $NAME }
|
|
1528
|
+
# Why: deleting a binding that other code still reads leaves an undefined
|
|
1529
|
+
# name. That code stays, and the type checker names the manual work.
|
|
1530
|
+
- not:
|
|
1531
|
+
inside:
|
|
1532
|
+
stopBy: end
|
|
1533
|
+
kind: program
|
|
1534
|
+
has:
|
|
1535
|
+
stopBy: end
|
|
1536
|
+
any:
|
|
1537
|
+
- kind: identifier
|
|
1538
|
+
- kind: shorthand_property_identifier
|
|
1539
|
+
- kind: type_identifier
|
|
1540
|
+
pattern: $NAME
|
|
1541
|
+
not:
|
|
1542
|
+
any:
|
|
1543
|
+
- inside: { stopBy: end, kind: import_statement }
|
|
1544
|
+
- inside: { stopBy: end, matches: deleted-declaration }
|
|
1545
|
+
fix: ""
|
|
1546
|
+
---
|
|
1547
|
+
id: mantle-style-sheets-import-specifier
|
|
1548
|
+
language: typescript
|
|
1549
|
+
message: MantleStyleSheets and mantleStyleSheetUrls are gone
|
|
1550
|
+
utils:
|
|
1551
|
+
# A node that opens a lexical scope. The shadow search below stops at a
|
|
1552
|
+
# nested one, so a sibling function's local name does not count.
|
|
1553
|
+
scope:
|
|
1554
|
+
any:
|
|
1555
|
+
- kind: statement_block
|
|
1556
|
+
- kind: function_declaration
|
|
1557
|
+
- kind: generator_function_declaration
|
|
1558
|
+
- kind: function_expression
|
|
1559
|
+
- kind: generator_function
|
|
1560
|
+
- kind: arrow_function
|
|
1561
|
+
- kind: method_definition
|
|
1562
|
+
- kind: class_body
|
|
1563
|
+
- kind: for_statement
|
|
1564
|
+
- kind: for_in_statement
|
|
1565
|
+
- kind: catch_clause
|
|
1566
|
+
# An identifier in a binding position: a parameter, a destructured name, a
|
|
1567
|
+
# local variable, a function name, or a class name.
|
|
1568
|
+
binding-name:
|
|
1569
|
+
any:
|
|
1570
|
+
- kind: shorthand_property_identifier_pattern
|
|
1571
|
+
- kind: identifier
|
|
1572
|
+
any:
|
|
1573
|
+
- inside: { kind: variable_declarator, field: name }
|
|
1574
|
+
- inside: { kind: function_declaration, field: name }
|
|
1575
|
+
- inside: { kind: generator_function_declaration, field: name }
|
|
1576
|
+
- inside: { kind: function_expression, field: name }
|
|
1577
|
+
- inside: { kind: required_parameter, field: pattern }
|
|
1578
|
+
- inside: { kind: optional_parameter, field: pattern }
|
|
1579
|
+
- inside: { kind: assignment_pattern, field: left }
|
|
1580
|
+
- inside: { kind: pair_pattern, field: value }
|
|
1581
|
+
- inside: { kind: array_pattern }
|
|
1582
|
+
- inside: { kind: rest_pattern }
|
|
1583
|
+
- inside: { kind: arrow_function, field: parameter }
|
|
1584
|
+
- inside: { kind: catch_clause, field: parameter }
|
|
1585
|
+
- inside: { kind: for_in_statement, field: left }
|
|
1586
|
+
- kind: type_identifier
|
|
1587
|
+
inside: { kind: class_declaration, field: name }
|
|
1588
|
+
# A function declaration opens a scope, so the search above stops at it and
|
|
1589
|
+
# never reads its name. This matches the declaration itself instead.
|
|
1590
|
+
function-declaration:
|
|
1591
|
+
any:
|
|
1592
|
+
- kind: function_declaration
|
|
1593
|
+
- kind: generator_function_declaration
|
|
1594
|
+
# A scope that a `var` leaves: the `var` binds in the enclosing function.
|
|
1595
|
+
block-scope:
|
|
1596
|
+
any:
|
|
1597
|
+
- kind: statement_block
|
|
1598
|
+
- kind: for_statement
|
|
1599
|
+
- kind: for_in_statement
|
|
1600
|
+
- kind: catch_clause
|
|
1601
|
+
function-scope:
|
|
1602
|
+
any:
|
|
1603
|
+
- kind: function_declaration
|
|
1604
|
+
- kind: generator_function_declaration
|
|
1605
|
+
- kind: function_expression
|
|
1606
|
+
- kind: generator_function
|
|
1607
|
+
- kind: arrow_function
|
|
1608
|
+
- kind: method_definition
|
|
1609
|
+
var-declaration:
|
|
1610
|
+
any:
|
|
1611
|
+
- kind: variable_declaration
|
|
1612
|
+
- kind: for_in_statement
|
|
1613
|
+
regex: ^for\s*(await\s*)?\(\s*var\b
|
|
1614
|
+
style-sheet-urls-import:
|
|
1615
|
+
kind: import_statement
|
|
1616
|
+
all:
|
|
1617
|
+
- has:
|
|
1618
|
+
field: source
|
|
1619
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
1620
|
+
- has:
|
|
1621
|
+
stopBy: end
|
|
1622
|
+
kind: import_specifier
|
|
1623
|
+
has:
|
|
1624
|
+
field: name
|
|
1625
|
+
regex: ^mantleStyleSheetUrls$
|
|
1626
|
+
any:
|
|
1627
|
+
- kind: import_specifier
|
|
1628
|
+
has:
|
|
1629
|
+
field: alias
|
|
1630
|
+
pattern: $URLS
|
|
1631
|
+
- kind: import_specifier
|
|
1632
|
+
not:
|
|
1633
|
+
has:
|
|
1634
|
+
field: alias
|
|
1635
|
+
kind: identifier
|
|
1636
|
+
has:
|
|
1637
|
+
field: name
|
|
1638
|
+
pattern: $URLS
|
|
1639
|
+
# A `const` the declaration rule deletes: not exported, one declarator, a
|
|
1640
|
+
# call to mantle's `mantleStyleSheetUrls` as its value, and a name that only
|
|
1641
|
+
# a deleted `<MantleStyleSheets />` reads.
|
|
1642
|
+
deleted-declaration:
|
|
1643
|
+
kind: lexical_declaration
|
|
1644
|
+
not:
|
|
1645
|
+
inside: { kind: export_statement }
|
|
1646
|
+
all:
|
|
1647
|
+
- has:
|
|
1648
|
+
kind: variable_declarator
|
|
1649
|
+
all:
|
|
1650
|
+
- has: { field: name, kind: identifier, pattern: $DECL }
|
|
1651
|
+
- has:
|
|
1652
|
+
field: value
|
|
1653
|
+
kind: call_expression
|
|
1654
|
+
all:
|
|
1655
|
+
- has: { field: function, kind: identifier, pattern: $URLS }
|
|
1656
|
+
- inside:
|
|
1657
|
+
stopBy: end
|
|
1658
|
+
kind: program
|
|
1659
|
+
has:
|
|
1660
|
+
matches: style-sheet-urls-import
|
|
1661
|
+
# Why: a parameter or a local under the import's name shadows it, and the
|
|
1662
|
+
# rules cannot tell which binding the code reads.
|
|
1663
|
+
- not:
|
|
1664
|
+
inside:
|
|
1665
|
+
stopBy: end
|
|
1666
|
+
matches: scope
|
|
1667
|
+
has:
|
|
1668
|
+
stopBy:
|
|
1669
|
+
matches: scope
|
|
1670
|
+
any:
|
|
1671
|
+
- matches: binding-name
|
|
1672
|
+
pattern: $URLS
|
|
1673
|
+
- matches: function-declaration
|
|
1674
|
+
has:
|
|
1675
|
+
field: name
|
|
1676
|
+
pattern: $URLS
|
|
1677
|
+
# Why: a `var` in a nested block binds in the enclosing function.
|
|
1678
|
+
- matches: block-scope
|
|
1679
|
+
has:
|
|
1680
|
+
stopBy:
|
|
1681
|
+
matches: function-scope
|
|
1682
|
+
matches: binding-name
|
|
1683
|
+
pattern: $URLS
|
|
1684
|
+
inside:
|
|
1685
|
+
stopBy: end
|
|
1686
|
+
matches: var-declaration
|
|
1687
|
+
# Why one declarator: a deletion would take its siblings with it.
|
|
1688
|
+
- not:
|
|
1689
|
+
has:
|
|
1690
|
+
kind: variable_declarator
|
|
1691
|
+
follows: { stopBy: end, kind: variable_declarator }
|
|
1692
|
+
# Why: a name that other code still reads keeps its declaration.
|
|
1693
|
+
- not:
|
|
1694
|
+
inside:
|
|
1695
|
+
stopBy: end
|
|
1696
|
+
kind: program
|
|
1697
|
+
has:
|
|
1698
|
+
stopBy: end
|
|
1699
|
+
any:
|
|
1700
|
+
- kind: identifier
|
|
1701
|
+
- kind: shorthand_property_identifier
|
|
1702
|
+
pattern: $DECL
|
|
1703
|
+
not:
|
|
1704
|
+
any:
|
|
1705
|
+
- inside: { kind: variable_declarator, field: name }
|
|
1706
|
+
rule:
|
|
1707
|
+
kind: import_specifier
|
|
1708
|
+
all:
|
|
1709
|
+
- has:
|
|
1710
|
+
field: name
|
|
1711
|
+
regex: ^(MantleStyleSheets|mantleStyleSheetUrls|MantleStyleSheetsProps|MantleThemeCssUrls)$
|
|
1712
|
+
- any:
|
|
1713
|
+
- has:
|
|
1714
|
+
field: alias
|
|
1715
|
+
pattern: $LOCAL
|
|
1716
|
+
- all:
|
|
1717
|
+
- not:
|
|
1718
|
+
has:
|
|
1719
|
+
field: alias
|
|
1720
|
+
kind: identifier
|
|
1721
|
+
- has:
|
|
1722
|
+
field: name
|
|
1723
|
+
pattern: $LOCAL
|
|
1724
|
+
- inside:
|
|
1725
|
+
stopBy: end
|
|
1726
|
+
kind: import_statement
|
|
1727
|
+
has:
|
|
1728
|
+
field: source
|
|
1729
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
1730
|
+
# Why a sibling that stays: removing the last specifier leaves an empty
|
|
1731
|
+
# import. The statement rule deletes that one whole.
|
|
1732
|
+
- inside:
|
|
1733
|
+
kind: named_imports
|
|
1734
|
+
has:
|
|
1735
|
+
kind: import_specifier
|
|
1736
|
+
not:
|
|
1737
|
+
has:
|
|
1738
|
+
field: name
|
|
1739
|
+
regex: ^(MantleStyleSheets|mantleStyleSheetUrls|MantleStyleSheetsProps|MantleThemeCssUrls)$
|
|
1740
|
+
# Why: deleting a binding that other code still reads leaves an undefined
|
|
1741
|
+
# name. That code stays, and the type checker names the manual work.
|
|
1742
|
+
- not:
|
|
1743
|
+
inside:
|
|
1744
|
+
stopBy: end
|
|
1745
|
+
kind: program
|
|
1746
|
+
has:
|
|
1747
|
+
stopBy: end
|
|
1748
|
+
any:
|
|
1749
|
+
- kind: identifier
|
|
1750
|
+
- kind: shorthand_property_identifier
|
|
1751
|
+
- kind: type_identifier
|
|
1752
|
+
pattern: $LOCAL
|
|
1753
|
+
not:
|
|
1754
|
+
any:
|
|
1755
|
+
- inside: { stopBy: end, kind: import_statement }
|
|
1756
|
+
- inside: { stopBy: end, matches: deleted-declaration }
|
|
1757
|
+
fix:
|
|
1758
|
+
template: ""
|
|
1759
|
+
expandEnd: { regex: "^,$" }
|
|
1760
|
+
---
|
|
1761
|
+
id: mantle-style-sheets-import-statement
|
|
1762
|
+
language: typescript
|
|
1763
|
+
message: MantleStyleSheets and mantleStyleSheetUrls are gone
|
|
1764
|
+
utils:
|
|
1765
|
+
# A node that opens a lexical scope. The shadow search below stops at a
|
|
1766
|
+
# nested one, so a sibling function's local name does not count.
|
|
1767
|
+
scope:
|
|
1768
|
+
any:
|
|
1769
|
+
- kind: statement_block
|
|
1770
|
+
- kind: function_declaration
|
|
1771
|
+
- kind: generator_function_declaration
|
|
1772
|
+
- kind: function_expression
|
|
1773
|
+
- kind: generator_function
|
|
1774
|
+
- kind: arrow_function
|
|
1775
|
+
- kind: method_definition
|
|
1776
|
+
- kind: class_body
|
|
1777
|
+
- kind: for_statement
|
|
1778
|
+
- kind: for_in_statement
|
|
1779
|
+
- kind: catch_clause
|
|
1780
|
+
# An identifier in a binding position: a parameter, a destructured name, a
|
|
1781
|
+
# local variable, a function name, or a class name.
|
|
1782
|
+
binding-name:
|
|
1783
|
+
any:
|
|
1784
|
+
- kind: shorthand_property_identifier_pattern
|
|
1785
|
+
- kind: identifier
|
|
1786
|
+
any:
|
|
1787
|
+
- inside: { kind: variable_declarator, field: name }
|
|
1788
|
+
- inside: { kind: function_declaration, field: name }
|
|
1789
|
+
- inside: { kind: generator_function_declaration, field: name }
|
|
1790
|
+
- inside: { kind: function_expression, field: name }
|
|
1791
|
+
- inside: { kind: required_parameter, field: pattern }
|
|
1792
|
+
- inside: { kind: optional_parameter, field: pattern }
|
|
1793
|
+
- inside: { kind: assignment_pattern, field: left }
|
|
1794
|
+
- inside: { kind: pair_pattern, field: value }
|
|
1795
|
+
- inside: { kind: array_pattern }
|
|
1796
|
+
- inside: { kind: rest_pattern }
|
|
1797
|
+
- inside: { kind: arrow_function, field: parameter }
|
|
1798
|
+
- inside: { kind: catch_clause, field: parameter }
|
|
1799
|
+
- inside: { kind: for_in_statement, field: left }
|
|
1800
|
+
- kind: type_identifier
|
|
1801
|
+
inside: { kind: class_declaration, field: name }
|
|
1802
|
+
# A function declaration opens a scope, so the search above stops at it and
|
|
1803
|
+
# never reads its name. This matches the declaration itself instead.
|
|
1804
|
+
function-declaration:
|
|
1805
|
+
any:
|
|
1806
|
+
- kind: function_declaration
|
|
1807
|
+
- kind: generator_function_declaration
|
|
1808
|
+
# A scope that a `var` leaves: the `var` binds in the enclosing function.
|
|
1809
|
+
block-scope:
|
|
1810
|
+
any:
|
|
1811
|
+
- kind: statement_block
|
|
1812
|
+
- kind: for_statement
|
|
1813
|
+
- kind: for_in_statement
|
|
1814
|
+
- kind: catch_clause
|
|
1815
|
+
function-scope:
|
|
1816
|
+
any:
|
|
1817
|
+
- kind: function_declaration
|
|
1818
|
+
- kind: generator_function_declaration
|
|
1819
|
+
- kind: function_expression
|
|
1820
|
+
- kind: generator_function
|
|
1821
|
+
- kind: arrow_function
|
|
1822
|
+
- kind: method_definition
|
|
1823
|
+
var-declaration:
|
|
1824
|
+
any:
|
|
1825
|
+
- kind: variable_declaration
|
|
1826
|
+
- kind: for_in_statement
|
|
1827
|
+
regex: ^for\s*(await\s*)?\(\s*var\b
|
|
1828
|
+
style-sheet-urls-import:
|
|
1829
|
+
kind: import_statement
|
|
1830
|
+
all:
|
|
1831
|
+
- has:
|
|
1832
|
+
field: source
|
|
1833
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
1834
|
+
- has:
|
|
1835
|
+
stopBy: end
|
|
1836
|
+
kind: import_specifier
|
|
1837
|
+
has:
|
|
1838
|
+
field: name
|
|
1839
|
+
regex: ^mantleStyleSheetUrls$
|
|
1840
|
+
any:
|
|
1841
|
+
- kind: import_specifier
|
|
1842
|
+
has:
|
|
1843
|
+
field: alias
|
|
1844
|
+
pattern: $URLS
|
|
1845
|
+
- kind: import_specifier
|
|
1846
|
+
not:
|
|
1847
|
+
has:
|
|
1848
|
+
field: alias
|
|
1849
|
+
kind: identifier
|
|
1850
|
+
has:
|
|
1851
|
+
field: name
|
|
1852
|
+
pattern: $URLS
|
|
1853
|
+
# A `const` the declaration rule deletes: not exported, one declarator, a
|
|
1854
|
+
# call to mantle's `mantleStyleSheetUrls` as its value, and a name that only
|
|
1855
|
+
# a deleted `<MantleStyleSheets />` reads.
|
|
1856
|
+
deleted-declaration:
|
|
1857
|
+
kind: lexical_declaration
|
|
1858
|
+
not:
|
|
1859
|
+
inside: { kind: export_statement }
|
|
1860
|
+
all:
|
|
1861
|
+
- has:
|
|
1862
|
+
kind: variable_declarator
|
|
1863
|
+
all:
|
|
1864
|
+
- has: { field: name, kind: identifier, pattern: $DECL }
|
|
1865
|
+
- has:
|
|
1866
|
+
field: value
|
|
1867
|
+
kind: call_expression
|
|
1868
|
+
all:
|
|
1869
|
+
- has: { field: function, kind: identifier, pattern: $URLS }
|
|
1870
|
+
- inside:
|
|
1871
|
+
stopBy: end
|
|
1872
|
+
kind: program
|
|
1873
|
+
has:
|
|
1874
|
+
matches: style-sheet-urls-import
|
|
1875
|
+
# Why: a parameter or a local under the import's name shadows it, and the
|
|
1876
|
+
# rules cannot tell which binding the code reads.
|
|
1877
|
+
- not:
|
|
1878
|
+
inside:
|
|
1879
|
+
stopBy: end
|
|
1880
|
+
matches: scope
|
|
1881
|
+
has:
|
|
1882
|
+
stopBy:
|
|
1883
|
+
matches: scope
|
|
1884
|
+
any:
|
|
1885
|
+
- matches: binding-name
|
|
1886
|
+
pattern: $URLS
|
|
1887
|
+
- matches: function-declaration
|
|
1888
|
+
has:
|
|
1889
|
+
field: name
|
|
1890
|
+
pattern: $URLS
|
|
1891
|
+
# Why: a `var` in a nested block binds in the enclosing function.
|
|
1892
|
+
- matches: block-scope
|
|
1893
|
+
has:
|
|
1894
|
+
stopBy:
|
|
1895
|
+
matches: function-scope
|
|
1896
|
+
matches: binding-name
|
|
1897
|
+
pattern: $URLS
|
|
1898
|
+
inside:
|
|
1899
|
+
stopBy: end
|
|
1900
|
+
matches: var-declaration
|
|
1901
|
+
# Why one declarator: a deletion would take its siblings with it.
|
|
1902
|
+
- not:
|
|
1903
|
+
has:
|
|
1904
|
+
kind: variable_declarator
|
|
1905
|
+
follows: { stopBy: end, kind: variable_declarator }
|
|
1906
|
+
# Why: a name that other code still reads keeps its declaration.
|
|
1907
|
+
- not:
|
|
1908
|
+
inside:
|
|
1909
|
+
stopBy: end
|
|
1910
|
+
kind: program
|
|
1911
|
+
has:
|
|
1912
|
+
stopBy: end
|
|
1913
|
+
any:
|
|
1914
|
+
- kind: identifier
|
|
1915
|
+
- kind: shorthand_property_identifier
|
|
1916
|
+
pattern: $DECL
|
|
1917
|
+
not:
|
|
1918
|
+
any:
|
|
1919
|
+
- inside: { kind: variable_declarator, field: name }
|
|
1920
|
+
rule:
|
|
1921
|
+
kind: import_statement
|
|
1922
|
+
all:
|
|
1923
|
+
- has:
|
|
1924
|
+
field: source
|
|
1925
|
+
regex: ^["']@ngrok/mantle/theme["']$
|
|
1926
|
+
- not:
|
|
1927
|
+
has: { kind: import_clause, has: { kind: identifier } }
|
|
1928
|
+
- has:
|
|
1929
|
+
stopBy: end
|
|
1930
|
+
kind: named_imports
|
|
1931
|
+
not:
|
|
1932
|
+
has:
|
|
1933
|
+
kind: import_specifier
|
|
1934
|
+
not:
|
|
1935
|
+
has:
|
|
1936
|
+
field: name
|
|
1937
|
+
regex: ^(MantleStyleSheets|mantleStyleSheetUrls|MantleStyleSheetsProps|MantleThemeCssUrls)$
|
|
1938
|
+
# Why: deleting a binding that other code still reads leaves an undefined
|
|
1939
|
+
# name. That import stays, and the type checker names the manual work.
|
|
1940
|
+
- not:
|
|
1941
|
+
has:
|
|
1942
|
+
stopBy: end
|
|
1943
|
+
kind: import_specifier
|
|
1944
|
+
all:
|
|
1945
|
+
- any:
|
|
1946
|
+
- has:
|
|
1947
|
+
field: alias
|
|
1948
|
+
pattern: $LOCAL
|
|
1949
|
+
- all:
|
|
1950
|
+
- not:
|
|
1951
|
+
has:
|
|
1952
|
+
field: alias
|
|
1953
|
+
kind: identifier
|
|
1954
|
+
- has:
|
|
1955
|
+
field: name
|
|
1956
|
+
pattern: $LOCAL
|
|
1957
|
+
- inside:
|
|
1958
|
+
stopBy: end
|
|
1959
|
+
kind: program
|
|
1960
|
+
has:
|
|
1961
|
+
stopBy: end
|
|
1962
|
+
any:
|
|
1963
|
+
- kind: identifier
|
|
1964
|
+
- kind: shorthand_property_identifier
|
|
1965
|
+
- kind: type_identifier
|
|
1966
|
+
pattern: $LOCAL
|
|
1967
|
+
not:
|
|
1968
|
+
any:
|
|
1969
|
+
- inside: { stopBy: end, kind: import_statement }
|
|
1970
|
+
- inside: { stopBy: end, matches: deleted-declaration }
|
|
1971
|
+
fix: ""
|