@ngrok/mantle 0.88.0 → 0.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/dist/accordion.d.ts +10 -9
  2. package/dist/accordion.js +1 -1
  3. package/dist/agent.json +1530 -1
  4. package/dist/{alert-DCVfviBx.d.ts → alert-BzPDUaU7.d.ts} +16 -15
  5. package/dist/alert-DO00UiQe.js +1 -0
  6. package/dist/alert-ZaUBtgno.js +1 -0
  7. package/dist/alert-center.d.ts +7 -7
  8. package/dist/alert-center.js +1 -1
  9. package/dist/alert-dialog.d.ts +17 -16
  10. package/dist/alert-dialog.js +1 -1
  11. package/dist/alert.d.ts +1 -1
  12. package/dist/alert.js +1 -1
  13. package/dist/anchor-CgcbWEUs.js +1 -0
  14. package/dist/anchor.js +1 -1
  15. package/dist/app-layout.d.ts +1183 -45
  16. package/dist/app-layout.js +1 -1
  17. package/dist/area-chart.d.ts +41 -18
  18. package/dist/area-chart.js +1 -1
  19. package/dist/avatar.js +1 -1
  20. package/dist/badge.d.ts +3 -2
  21. package/dist/badge.js +1 -1
  22. package/dist/bar-chart.d.ts +37 -13
  23. package/dist/bar-chart.js +1 -1
  24. package/dist/breadcrumb.js +1 -1
  25. package/dist/browser-only.js +1 -1
  26. package/dist/button-69InNC_m.js +1 -0
  27. package/dist/button-BMfUxs_j.js +1 -0
  28. package/dist/{button-DO53OA70.d.ts → button-CHoYpOzx.d.ts} +5 -4
  29. package/dist/{button-B52_vczK.js → button-D8rr-1AB.js} +1 -1
  30. package/dist/{button-crUf0hbR.d.ts → button-DL7V4bzW.d.ts} +5 -4
  31. package/dist/button-b2HKEIE2.js +1 -0
  32. package/dist/{button-B5i9n7Qp.d.ts → button-mzUR1U0Y.d.ts} +5 -4
  33. package/dist/button.d.ts +3 -3
  34. package/dist/button.js +1 -1
  35. package/dist/calendar.d.ts +3 -2
  36. package/dist/calendar.js +1 -1
  37. package/dist/card.d.ts +15 -7
  38. package/dist/card.js +1 -1
  39. package/dist/centered-layout.js +1 -1
  40. package/dist/{chart-DgaWVBqi.d.ts → chart-23KQ1ZNO.d.ts} +128 -62
  41. package/dist/chart-BRkJfptA.js +2 -0
  42. package/dist/checkbox-C3N2afhB.js +1 -0
  43. package/dist/checkbox.d.ts +3 -2
  44. package/dist/checkbox.js +1 -1
  45. package/dist/{choice-PESu-9s8.d.ts → choice-BCiyqLgO.d.ts} +12 -11
  46. package/dist/choice-DQmecLfy.js +1 -0
  47. package/dist/choice.d.ts +1 -1
  48. package/dist/choice.js +1 -1
  49. package/dist/code-block-4Esx_gV-.js +12 -0
  50. package/dist/code-block.d.ts +17 -16
  51. package/dist/code-block.js +6 -6
  52. package/dist/code-block_highlight-utils.js +1 -1
  53. package/dist/code.d.ts +2 -1
  54. package/dist/code.js +1 -1
  55. package/dist/combobox.d.ts +15 -14
  56. package/dist/combobox.js +1 -1
  57. package/dist/command.d.ts +13 -13
  58. package/dist/command.js +1 -1
  59. package/dist/cx-CK7o_rVv.js +1 -0
  60. package/dist/cx.js +1 -1
  61. package/dist/data-table.d.ts +32 -31
  62. package/dist/data-table.js +1 -1
  63. package/dist/description-list.d.ts +6 -6
  64. package/dist/description-list.js +1 -1
  65. package/dist/dialog-CaGJD02w.js +1 -0
  66. package/dist/{dialog-DXpqpdJj.d.ts → dialog-DQdeqvq-.d.ts} +28 -15
  67. package/dist/dialog.d.ts +1 -1
  68. package/dist/dialog.js +1 -1
  69. package/dist/{dropdown-menu-BloQKE_y.d.ts → dropdown-menu-Cef0Cz2B.d.ts} +17 -17
  70. package/dist/dropdown-menu-CutWQ0bl.js +1 -0
  71. package/dist/dropdown-menu-DMA8dGxZ.d.ts +1 -0
  72. package/dist/dropdown-menu.d.ts +2 -2
  73. package/dist/dropdown-menu.js +1 -1
  74. package/dist/empty.d.ts +14 -6
  75. package/dist/empty.js +1 -1
  76. package/dist/field.d.ts +16 -15
  77. package/dist/field.js +1 -1
  78. package/dist/flag.d.ts +4 -3
  79. package/dist/flag.js +1 -1
  80. package/dist/hooks.d.ts +251 -1
  81. package/dist/hooks.js +1 -1
  82. package/dist/hover-card.d.ts +5 -4
  83. package/dist/hover-card.js +1 -1
  84. package/dist/icon-BudQMD2S.js +1 -0
  85. package/dist/icon-kK0c-POG.js +1 -0
  86. package/dist/{icon-w0HUe7tr.d.ts → icon-r2NvfTWW.d.ts} +3 -2
  87. package/dist/{icon-BmJ57Tgh.d.ts → icon-ucVgZeXn.d.ts} +3 -2
  88. package/dist/icon.d.ts +2 -2
  89. package/dist/icon.js +1 -1
  90. package/dist/icons-CAtjMNti.js +1 -0
  91. package/dist/{icons-Bu-2boul.js → icons-CH3tD_wq.js} +1 -1
  92. package/dist/icons-CSwTVV2m.js +1 -0
  93. package/dist/icons.js +1 -1
  94. package/dist/in-view-Dxv_GrUU.js +1 -0
  95. package/dist/input-D_DjD9lT.js +1 -0
  96. package/dist/{input-DpnC3Xgj.d.ts → input-bbB1tC0h.d.ts} +3 -2
  97. package/dist/input.d.ts +5 -4
  98. package/dist/input.js +1 -1
  99. package/dist/kbd-CLHsJ99p.js +1 -0
  100. package/dist/kbd.d.ts +2 -1
  101. package/dist/kbd.js +1 -1
  102. package/dist/label-5T8i7I4X.js +1 -0
  103. package/dist/{label-Bnfe9YJ6.d.ts → label-C-KbNls8.d.ts} +3 -2
  104. package/dist/label.d.ts +1 -1
  105. package/dist/label.js +1 -1
  106. package/dist/{layer-container-R7aux3n8.js → layer-container-DLf-6eBz.js} +1 -1
  107. package/dist/layer-container.js +1 -1
  108. package/dist/line-chart.d.ts +40 -15
  109. package/dist/line-chart.js +1 -1
  110. package/dist/list-DOVZoz9t.js +1 -0
  111. package/dist/list.d.ts +3 -2
  112. package/dist/list.js +1 -1
  113. package/dist/live-region-DQ1QLv3L.js +1 -0
  114. package/dist/live-region.d.ts +3 -2
  115. package/dist/live-region.js +1 -1
  116. package/dist/llms.txt +118 -2
  117. package/dist/{main-Dv2zuT_b.js → main-CC1L9IsH.js} +1 -1
  118. package/dist/main.js +1 -1
  119. package/dist/mantle.css +12 -0
  120. package/dist/media-object.js +1 -1
  121. package/dist/migrations/0002-data-table-action-header.yml +526 -0
  122. package/dist/migrations/0003-dialog-footer-dom-order.yml +271 -0
  123. package/dist/migrations/0004-priority-to-intent.yml +1728 -0
  124. package/dist/migrations/0005-field-item-owns-control-id.yml +234 -0
  125. package/dist/migrations/0006-data-table-tanstack-v9.yml +423 -0
  126. package/dist/migrations/0008-tabs-separator.yml +1212 -0
  127. package/dist/migrations/0009-chart-root-mode.yml +871 -0
  128. package/dist/multi-select.d.ts +23 -22
  129. package/dist/multi-select.js +1 -1
  130. package/dist/otp-input.d.ts +9 -8
  131. package/dist/otp-input.js +1 -1
  132. package/dist/pagination.d.ts +9 -8
  133. package/dist/pagination.js +1 -1
  134. package/dist/{popover-Cco1nw8I.d.ts → popover-Dvls7-j4.d.ts} +5 -4
  135. package/dist/popover-oQDUvcZ2.js +1 -0
  136. package/dist/popover.d.ts +1 -1
  137. package/dist/popover.js +1 -1
  138. package/dist/primitive-AGoxSJBI.js +1 -0
  139. package/dist/progress.d.ts +9 -8
  140. package/dist/progress.js +1 -1
  141. package/dist/qr-code.d.ts +9 -8
  142. package/dist/qr-code.js +1 -1
  143. package/dist/radio-group.d.ts +19 -18
  144. package/dist/radio-group.js +1 -1
  145. package/dist/sandbar.d.ts +7 -7
  146. package/dist/sandbar.js +1 -1
  147. package/dist/{sandboxed-on-click-BLvvSqOP.js → sandboxed-on-click-C7pPu-2M.js} +1 -1
  148. package/dist/sandboxed-on-click.js +1 -1
  149. package/dist/scatter-plot.d.ts +39 -14
  150. package/dist/scatter-plot.js +1 -1
  151. package/dist/select-DcL0-duV.js +1 -0
  152. package/dist/{select-BITJP7I5.d.ts → select-DlohFa54.d.ts} +3 -3
  153. package/dist/select.d.ts +1 -1
  154. package/dist/select.js +1 -1
  155. package/dist/selectable-list.d.ts +16 -15
  156. package/dist/selectable-list.js +1 -1
  157. package/dist/{separator-Bo4nY_3M.d.ts → separator-BWGjCIl7.d.ts} +11 -3
  158. package/dist/separator-DvPe27fH.js +1 -0
  159. package/dist/separator.d.ts +1 -1
  160. package/dist/separator.js +1 -1
  161. package/dist/sheet-H8zvhSuA.js +1 -0
  162. package/dist/sheet.d.ts +13 -12
  163. package/dist/sheet.js +1 -1
  164. package/dist/sidebar.d.ts +163 -102
  165. package/dist/sidebar.js +1 -1
  166. package/dist/skeleton-zfqoDAxT.js +1 -0
  167. package/dist/skeleton.d.ts +3 -2
  168. package/dist/skeleton.js +1 -1
  169. package/dist/skip-to-main-link.js +1 -1
  170. package/dist/slider.d.ts +3 -2
  171. package/dist/slider.js +1 -1
  172. package/dist/{slot-BsvE2ntj.js → slot-DdYN1L1C.js} +1 -1
  173. package/dist/{slot-DdgxmuI5.d.ts → slot-Q996Hqk9.d.ts} +1 -1
  174. package/dist/slot.d.ts +1 -1
  175. package/dist/slot.js +1 -1
  176. package/dist/split-button.d.ts +6 -5
  177. package/dist/split-button.js +1 -1
  178. package/dist/strata.d.ts +544 -0
  179. package/dist/strata.js +1 -0
  180. package/dist/switch.d.ts +3 -2
  181. package/dist/switch.js +1 -1
  182. package/dist/{table-DEI-qvSC.d.ts → table-BhzITa19.d.ts} +10 -9
  183. package/dist/table-DBbKqOVq.js +1 -0
  184. package/dist/table.d.ts +1 -1
  185. package/dist/table.js +1 -1
  186. package/dist/tabs.d.ts +2 -2
  187. package/dist/tabs.js +1 -1
  188. package/dist/text-area.d.ts +3 -2
  189. package/dist/text-area.js +1 -1
  190. package/dist/theme-6Q65C1Rx.js +1 -0
  191. package/dist/theme-switcher.d.ts +3 -3
  192. package/dist/theme-switcher.js +1 -1
  193. package/dist/theme.js +1 -1
  194. package/dist/toast.d.ts +10 -9
  195. package/dist/toast.js +1 -1
  196. package/dist/{tooltip-nuUCoqq8.d.ts → tooltip-CngH7Kl6.d.ts} +7 -6
  197. package/dist/tooltip-NhYXqStK.js +1 -0
  198. package/dist/tooltip.d.ts +1 -1
  199. package/dist/tooltip.js +1 -1
  200. package/dist/truncated-text.d.ts +138 -0
  201. package/dist/truncated-text.js +1 -0
  202. package/dist/types.js +1 -1
  203. package/dist/use-breakpoint--mo7kr9d.js +1 -0
  204. package/dist/use-is-hydrated-after-paint-r9Cl2mGp.js +1 -0
  205. package/dist/use-prefers-reduced-motion-DimzRx-M.js +1 -0
  206. package/dist/use-swipe-to-dismiss-Cj-AayFd.js +1 -0
  207. package/dist/utils.js +1 -1
  208. package/dist/visually-hidden.d.ts +2 -1
  209. package/dist/visually-hidden.js +1 -1
  210. package/dist/well.d.ts +10 -2
  211. package/dist/well.js +1 -1
  212. package/package.json +17 -15
  213. package/dist/alert-OP_-aGJD.js +0 -1
  214. package/dist/anchor-BnMhJYS4.js +0 -1
  215. package/dist/button-BFpCB99R.js +0 -1
  216. package/dist/button-Dij5vCQG.js +0 -1
  217. package/dist/button-pwkdtR3U.js +0 -1
  218. package/dist/chart-aZLMj4xx.js +0 -2
  219. package/dist/checkbox-DbJSqSNN.js +0 -1
  220. package/dist/choice-SRyLguqU.js +0 -1
  221. package/dist/code-block-BE3Q0iAo.js +0 -12
  222. package/dist/cx-0HCjnNv1.js +0 -1
  223. package/dist/dialog-HIdb5d3I.js +0 -1
  224. package/dist/dropdown-menu-BR_AQNMj.js +0 -1
  225. package/dist/dropdown-menu-Dlpb7600.d.ts +0 -1
  226. package/dist/icon-BT8FnkkJ.js +0 -1
  227. package/dist/icon-U24NfYv7.js +0 -1
  228. package/dist/icons-BQRcOU6J.js +0 -1
  229. package/dist/icons-C3rVfpx9.js +0 -1
  230. package/dist/in-view-T_AAYaaF.js +0 -1
  231. package/dist/input-yq0jLE4e.js +0 -1
  232. package/dist/kbd-CJ8hNZfS.js +0 -1
  233. package/dist/label-BAy0Mg59.js +0 -1
  234. package/dist/list-BleZ-43e.js +0 -1
  235. package/dist/live-region-B2vJRvPH.js +0 -1
  236. package/dist/popover-BJ5XNwzD.js +0 -1
  237. package/dist/primitive-w3wFk2La.js +0 -1
  238. package/dist/select-CUWLEeuf.js +0 -1
  239. package/dist/separator-D98be0gY.js +0 -1
  240. package/dist/sheet-B5x8EO9Y.js +0 -1
  241. package/dist/skeleton-bVDP8BzY.js +0 -1
  242. package/dist/table-D2jh52KA.js +0 -1
  243. package/dist/theme-C1kFFdIk.js +0 -1
  244. package/dist/tooltip-H03l7E4Y.js +0 -1
  245. package/dist/use-is-hydrated-after-paint-Drj0lNi4.js +0 -1
  246. package/dist/use-prefers-reduced-motion-Cj9tJ181.js +0 -1
  247. /package/dist/{types-D85fCNV3.js → css-properties-D85fCNV3.js} +0 -0
@@ -0,0 +1,1212 @@
1
+ # Every rule binds $TABS to the local name of the `Tabs` import from
2
+ # `@ngrok/mantle/tabs`, so an aliased import matches and another library's
3
+ # `Tabs` does not. The nearest `Tabs.Root` decides whether a list is classic.
4
+ id: tabs-list-add-separator
5
+ language: tsx
6
+ message: a classic Tabs.List needs Tabs.Separator after it
7
+ utils:
8
+ # A node that opens a lexical scope. The shadow search below stops at a
9
+ # nested one, so a sibling function's local name does not count.
10
+ scope:
11
+ any:
12
+ - kind: statement_block
13
+ - kind: function_declaration
14
+ - kind: generator_function_declaration
15
+ - kind: function_expression
16
+ - kind: generator_function
17
+ - kind: arrow_function
18
+ - kind: method_definition
19
+ - kind: class_body
20
+ - kind: for_statement
21
+ - kind: for_in_statement
22
+ - kind: catch_clause
23
+ # An identifier in a binding position: a parameter, a destructured name, a
24
+ # local variable, a function name, or a class name.
25
+ binding-name:
26
+ any:
27
+ - kind: shorthand_property_identifier_pattern
28
+ - kind: identifier
29
+ any:
30
+ - inside: { kind: variable_declarator, field: name }
31
+ - inside: { kind: function_declaration, field: name }
32
+ - inside: { kind: generator_function_declaration, field: name }
33
+ - inside: { kind: function_expression, field: name }
34
+ - inside: { kind: required_parameter, field: pattern }
35
+ - inside: { kind: optional_parameter, field: pattern }
36
+ - inside: { kind: assignment_pattern, field: left }
37
+ - inside: { kind: pair_pattern, field: value }
38
+ - inside: { kind: array_pattern }
39
+ - inside: { kind: rest_pattern }
40
+ - inside: { kind: arrow_function, field: parameter }
41
+ - inside: { kind: catch_clause, field: parameter }
42
+ - kind: type_identifier
43
+ inside: { kind: class_declaration, field: name }
44
+ # A function declaration opens a scope, so the search above stops at it and
45
+ # never reads its name. This matches the declaration itself instead.
46
+ function-declaration:
47
+ any:
48
+ - kind: function_declaration
49
+ - kind: generator_function_declaration
50
+ tabs-import:
51
+ kind: import_statement
52
+ all:
53
+ - has:
54
+ field: source
55
+ regex: ^["']@ngrok/mantle/tabs["']$
56
+ - has:
57
+ stopBy: end
58
+ kind: import_specifier
59
+ has:
60
+ field: name
61
+ regex: ^Tabs$
62
+ any:
63
+ - kind: import_specifier
64
+ has:
65
+ field: alias
66
+ pattern: $TABS
67
+ - kind: import_specifier
68
+ not:
69
+ has:
70
+ field: alias
71
+ kind: identifier
72
+ has:
73
+ field: name
74
+ pattern: $TABS
75
+ tabs-list-name:
76
+ kind: member_expression
77
+ all:
78
+ - has:
79
+ field: object
80
+ pattern: $TABS
81
+ - has:
82
+ field: property
83
+ regex: ^List$
84
+ tabs-separator:
85
+ kind: jsx_self_closing_element
86
+ has:
87
+ field: name
88
+ kind: member_expression
89
+ all:
90
+ - has:
91
+ field: object
92
+ pattern: $TABS
93
+ - has:
94
+ field: property
95
+ regex: ^Separator$
96
+ tabs-root:
97
+ kind: jsx_element
98
+ has:
99
+ field: open_tag
100
+ has:
101
+ field: name
102
+ kind: member_expression
103
+ all:
104
+ - has:
105
+ field: object
106
+ pattern: $TABS
107
+ - has:
108
+ field: property
109
+ regex: ^Root$
110
+ pill-root:
111
+ matches: tabs-root
112
+ has:
113
+ field: open_tag
114
+ has:
115
+ kind: jsx_attribute
116
+ has:
117
+ kind: property_identifier
118
+ regex: ^appearance$
119
+ any:
120
+ - kind: jsx_attribute
121
+ has:
122
+ kind: string
123
+ regex: ^["']pill["']$
124
+ - kind: jsx_attribute
125
+ has:
126
+ kind: jsx_expression
127
+ has:
128
+ kind: string
129
+ regex: ^["']pill["']$
130
+ appearance-attribute:
131
+ kind: jsx_attribute
132
+ has:
133
+ kind: property_identifier
134
+ regex: ^appearance$
135
+ # A root with no appearance, or a literal appearance other than pill. A
136
+ # dynamic appearance stays manual, because a separator shows on pill tabs.
137
+ classic-root:
138
+ matches: tabs-root
139
+ not:
140
+ matches: pill-root
141
+ any:
142
+ - not:
143
+ has:
144
+ field: open_tag
145
+ has:
146
+ matches: appearance-attribute
147
+ - has:
148
+ field: open_tag
149
+ has:
150
+ matches: appearance-attribute
151
+ any:
152
+ - kind: jsx_attribute
153
+ has:
154
+ kind: string
155
+ - kind: jsx_attribute
156
+ has:
157
+ kind: jsx_expression
158
+ has:
159
+ kind: string
160
+ # A list that already has its separator, with or without a condition.
161
+ separator-follows:
162
+ kind: jsx_element
163
+ precedes:
164
+ any:
165
+ - matches: tabs-separator
166
+ - kind: jsx_expression
167
+ has:
168
+ stopBy: end
169
+ matches: tabs-separator
170
+ hide-border:
171
+ kind: jsx_attribute
172
+ has:
173
+ kind: property_identifier
174
+ regex: ^hideBorder$
175
+ # A list that a rule can give a sibling: it sits in a file that imports
176
+ # `Tabs`, its parent is an element (a fragment is one too, while the
177
+ # `{show && <Tabs.List />}` shape has no enclosing tag), and the nearest
178
+ # `Tabs.Root` is classic.
179
+ list-that-takes-separator:
180
+ kind: jsx_element
181
+ all:
182
+ - has:
183
+ field: open_tag
184
+ has:
185
+ field: name
186
+ matches: tabs-list-name
187
+ - inside:
188
+ stopBy: end
189
+ kind: program
190
+ has:
191
+ matches: tabs-import
192
+ # Why: a parameter or a local under the import's name shadows it, and the
193
+ # rules cannot tell which binding the element reads.
194
+ - not:
195
+ inside:
196
+ stopBy: end
197
+ matches: scope
198
+ has:
199
+ stopBy:
200
+ matches: scope
201
+ any:
202
+ - matches: binding-name
203
+ pattern: $TABS
204
+ - matches: function-declaration
205
+ has:
206
+ field: name
207
+ pattern: $TABS
208
+ - inside:
209
+ kind: jsx_element
210
+ - inside:
211
+ stopBy:
212
+ matches: tabs-root
213
+ matches: classic-root
214
+ rule:
215
+ kind: jsx_closing_element
216
+ inside:
217
+ matches: list-that-takes-separator
218
+ all:
219
+ - not:
220
+ has:
221
+ field: open_tag
222
+ has:
223
+ matches: hide-border
224
+ - not:
225
+ matches: separator-follows
226
+ fix: |-
227
+ </$TABS.List>
228
+ <$TABS.Separator />
229
+ ---
230
+ id: tabs-list-dynamic-hide-border
231
+ language: tsx
232
+ message: a dynamic hideBorder becomes a conditional Tabs.Separator
233
+ utils:
234
+ # A node that opens a lexical scope. The shadow search below stops at a
235
+ # nested one, so a sibling function's local name does not count.
236
+ scope:
237
+ any:
238
+ - kind: statement_block
239
+ - kind: function_declaration
240
+ - kind: generator_function_declaration
241
+ - kind: function_expression
242
+ - kind: generator_function
243
+ - kind: arrow_function
244
+ - kind: method_definition
245
+ - kind: class_body
246
+ - kind: for_statement
247
+ - kind: for_in_statement
248
+ - kind: catch_clause
249
+ # An identifier in a binding position: a parameter, a destructured name, a
250
+ # local variable, a function name, or a class name.
251
+ binding-name:
252
+ any:
253
+ - kind: shorthand_property_identifier_pattern
254
+ - kind: identifier
255
+ any:
256
+ - inside: { kind: variable_declarator, field: name }
257
+ - inside: { kind: function_declaration, field: name }
258
+ - inside: { kind: generator_function_declaration, field: name }
259
+ - inside: { kind: function_expression, field: name }
260
+ - inside: { kind: required_parameter, field: pattern }
261
+ - inside: { kind: optional_parameter, field: pattern }
262
+ - inside: { kind: assignment_pattern, field: left }
263
+ - inside: { kind: pair_pattern, field: value }
264
+ - inside: { kind: array_pattern }
265
+ - inside: { kind: rest_pattern }
266
+ - inside: { kind: arrow_function, field: parameter }
267
+ - inside: { kind: catch_clause, field: parameter }
268
+ - kind: type_identifier
269
+ inside: { kind: class_declaration, field: name }
270
+ # A function declaration opens a scope, so the search above stops at it and
271
+ # never reads its name. This matches the declaration itself instead.
272
+ function-declaration:
273
+ any:
274
+ - kind: function_declaration
275
+ - kind: generator_function_declaration
276
+ tabs-import:
277
+ kind: import_statement
278
+ all:
279
+ - has:
280
+ field: source
281
+ regex: ^["']@ngrok/mantle/tabs["']$
282
+ - has:
283
+ stopBy: end
284
+ kind: import_specifier
285
+ has:
286
+ field: name
287
+ regex: ^Tabs$
288
+ any:
289
+ - kind: import_specifier
290
+ has:
291
+ field: alias
292
+ pattern: $TABS
293
+ - kind: import_specifier
294
+ not:
295
+ has:
296
+ field: alias
297
+ kind: identifier
298
+ has:
299
+ field: name
300
+ pattern: $TABS
301
+ tabs-list-name:
302
+ kind: member_expression
303
+ all:
304
+ - has:
305
+ field: object
306
+ pattern: $TABS
307
+ - has:
308
+ field: property
309
+ regex: ^List$
310
+ tabs-separator:
311
+ kind: jsx_self_closing_element
312
+ has:
313
+ field: name
314
+ kind: member_expression
315
+ all:
316
+ - has:
317
+ field: object
318
+ pattern: $TABS
319
+ - has:
320
+ field: property
321
+ regex: ^Separator$
322
+ tabs-root:
323
+ kind: jsx_element
324
+ has:
325
+ field: open_tag
326
+ has:
327
+ field: name
328
+ kind: member_expression
329
+ all:
330
+ - has:
331
+ field: object
332
+ pattern: $TABS
333
+ - has:
334
+ field: property
335
+ regex: ^Root$
336
+ pill-root:
337
+ matches: tabs-root
338
+ has:
339
+ field: open_tag
340
+ has:
341
+ kind: jsx_attribute
342
+ has:
343
+ kind: property_identifier
344
+ regex: ^appearance$
345
+ any:
346
+ - kind: jsx_attribute
347
+ has:
348
+ kind: string
349
+ regex: ^["']pill["']$
350
+ - kind: jsx_attribute
351
+ has:
352
+ kind: jsx_expression
353
+ has:
354
+ kind: string
355
+ regex: ^["']pill["']$
356
+ appearance-attribute:
357
+ kind: jsx_attribute
358
+ has:
359
+ kind: property_identifier
360
+ regex: ^appearance$
361
+ # A root with no appearance, or a literal appearance other than pill. A
362
+ # dynamic appearance stays manual, because a separator shows on pill tabs.
363
+ classic-root:
364
+ matches: tabs-root
365
+ not:
366
+ matches: pill-root
367
+ any:
368
+ - not:
369
+ has:
370
+ field: open_tag
371
+ has:
372
+ matches: appearance-attribute
373
+ - has:
374
+ field: open_tag
375
+ has:
376
+ matches: appearance-attribute
377
+ any:
378
+ - kind: jsx_attribute
379
+ has:
380
+ kind: string
381
+ - kind: jsx_attribute
382
+ has:
383
+ kind: jsx_expression
384
+ has:
385
+ kind: string
386
+ # A list that already has its separator, with or without a condition.
387
+ separator-follows:
388
+ kind: jsx_element
389
+ precedes:
390
+ any:
391
+ - matches: tabs-separator
392
+ - kind: jsx_expression
393
+ has:
394
+ stopBy: end
395
+ matches: tabs-separator
396
+ hide-border:
397
+ kind: jsx_attribute
398
+ has:
399
+ kind: property_identifier
400
+ regex: ^hideBorder$
401
+ # A list that a rule can give a sibling: it sits in a file that imports
402
+ # `Tabs`, its parent is an element (a fragment is one too, while the
403
+ # `{show && <Tabs.List />}` shape has no enclosing tag), and the nearest
404
+ # `Tabs.Root` is classic.
405
+ list-that-takes-separator:
406
+ kind: jsx_element
407
+ all:
408
+ - has:
409
+ field: open_tag
410
+ has:
411
+ field: name
412
+ matches: tabs-list-name
413
+ - inside:
414
+ stopBy: end
415
+ kind: program
416
+ has:
417
+ matches: tabs-import
418
+ # Why: a parameter or a local under the import's name shadows it, and the
419
+ # rules cannot tell which binding the element reads.
420
+ - not:
421
+ inside:
422
+ stopBy: end
423
+ matches: scope
424
+ has:
425
+ stopBy:
426
+ matches: scope
427
+ any:
428
+ - matches: binding-name
429
+ pattern: $TABS
430
+ - matches: function-declaration
431
+ has:
432
+ field: name
433
+ pattern: $TABS
434
+ - inside:
435
+ kind: jsx_element
436
+ - inside:
437
+ stopBy:
438
+ matches: tabs-root
439
+ matches: classic-root
440
+ rule:
441
+ kind: jsx_closing_element
442
+ inside:
443
+ matches: list-that-takes-separator
444
+ all:
445
+ - has:
446
+ field: open_tag
447
+ has:
448
+ kind: jsx_attribute
449
+ pattern:
450
+ context: <List hideBorder={$CONDITION} />
451
+ selector: jsx_attribute
452
+ - not:
453
+ matches: separator-follows
454
+ # Why a kind list: `!` binds tighter than `||`, so a compound condition needs
455
+ # parentheses. These kinds do not, and the formatter would strip them.
456
+ constraints:
457
+ CONDITION:
458
+ any:
459
+ - kind: identifier
460
+ - kind: member_expression
461
+ - kind: call_expression
462
+ - kind: subscript_expression
463
+ - kind: non_null_expression
464
+ - kind: parenthesized_expression
465
+ - kind: unary_expression
466
+ - kind: this
467
+ - kind: string
468
+ - kind: number
469
+ - kind: template_string
470
+ fix: |-
471
+ </$TABS.List>
472
+ {!$CONDITION && <$TABS.Separator />}
473
+ ---
474
+ id: tabs-list-compound-hide-border
475
+ language: tsx
476
+ message: a compound hideBorder expression becomes a conditional Tabs.Separator
477
+ utils:
478
+ # A node that opens a lexical scope. The shadow search below stops at a
479
+ # nested one, so a sibling function's local name does not count.
480
+ scope:
481
+ any:
482
+ - kind: statement_block
483
+ - kind: function_declaration
484
+ - kind: generator_function_declaration
485
+ - kind: function_expression
486
+ - kind: generator_function
487
+ - kind: arrow_function
488
+ - kind: method_definition
489
+ - kind: class_body
490
+ - kind: for_statement
491
+ - kind: for_in_statement
492
+ - kind: catch_clause
493
+ # An identifier in a binding position: a parameter, a destructured name, a
494
+ # local variable, a function name, or a class name.
495
+ binding-name:
496
+ any:
497
+ - kind: shorthand_property_identifier_pattern
498
+ - kind: identifier
499
+ any:
500
+ - inside: { kind: variable_declarator, field: name }
501
+ - inside: { kind: function_declaration, field: name }
502
+ - inside: { kind: generator_function_declaration, field: name }
503
+ - inside: { kind: function_expression, field: name }
504
+ - inside: { kind: required_parameter, field: pattern }
505
+ - inside: { kind: optional_parameter, field: pattern }
506
+ - inside: { kind: assignment_pattern, field: left }
507
+ - inside: { kind: pair_pattern, field: value }
508
+ - inside: { kind: array_pattern }
509
+ - inside: { kind: rest_pattern }
510
+ - inside: { kind: arrow_function, field: parameter }
511
+ - inside: { kind: catch_clause, field: parameter }
512
+ - kind: type_identifier
513
+ inside: { kind: class_declaration, field: name }
514
+ # A function declaration opens a scope, so the search above stops at it and
515
+ # never reads its name. This matches the declaration itself instead.
516
+ function-declaration:
517
+ any:
518
+ - kind: function_declaration
519
+ - kind: generator_function_declaration
520
+ tabs-import:
521
+ kind: import_statement
522
+ all:
523
+ - has:
524
+ field: source
525
+ regex: ^["']@ngrok/mantle/tabs["']$
526
+ - has:
527
+ stopBy: end
528
+ kind: import_specifier
529
+ has:
530
+ field: name
531
+ regex: ^Tabs$
532
+ any:
533
+ - kind: import_specifier
534
+ has:
535
+ field: alias
536
+ pattern: $TABS
537
+ - kind: import_specifier
538
+ not:
539
+ has:
540
+ field: alias
541
+ kind: identifier
542
+ has:
543
+ field: name
544
+ pattern: $TABS
545
+ tabs-list-name:
546
+ kind: member_expression
547
+ all:
548
+ - has:
549
+ field: object
550
+ pattern: $TABS
551
+ - has:
552
+ field: property
553
+ regex: ^List$
554
+ tabs-separator:
555
+ kind: jsx_self_closing_element
556
+ has:
557
+ field: name
558
+ kind: member_expression
559
+ all:
560
+ - has:
561
+ field: object
562
+ pattern: $TABS
563
+ - has:
564
+ field: property
565
+ regex: ^Separator$
566
+ tabs-root:
567
+ kind: jsx_element
568
+ has:
569
+ field: open_tag
570
+ has:
571
+ field: name
572
+ kind: member_expression
573
+ all:
574
+ - has:
575
+ field: object
576
+ pattern: $TABS
577
+ - has:
578
+ field: property
579
+ regex: ^Root$
580
+ pill-root:
581
+ matches: tabs-root
582
+ has:
583
+ field: open_tag
584
+ has:
585
+ kind: jsx_attribute
586
+ has:
587
+ kind: property_identifier
588
+ regex: ^appearance$
589
+ any:
590
+ - kind: jsx_attribute
591
+ has:
592
+ kind: string
593
+ regex: ^["']pill["']$
594
+ - kind: jsx_attribute
595
+ has:
596
+ kind: jsx_expression
597
+ has:
598
+ kind: string
599
+ regex: ^["']pill["']$
600
+ appearance-attribute:
601
+ kind: jsx_attribute
602
+ has:
603
+ kind: property_identifier
604
+ regex: ^appearance$
605
+ # A root with no appearance, or a literal appearance other than pill. A
606
+ # dynamic appearance stays manual, because a separator shows on pill tabs.
607
+ classic-root:
608
+ matches: tabs-root
609
+ not:
610
+ matches: pill-root
611
+ any:
612
+ - not:
613
+ has:
614
+ field: open_tag
615
+ has:
616
+ matches: appearance-attribute
617
+ - has:
618
+ field: open_tag
619
+ has:
620
+ matches: appearance-attribute
621
+ any:
622
+ - kind: jsx_attribute
623
+ has:
624
+ kind: string
625
+ - kind: jsx_attribute
626
+ has:
627
+ kind: jsx_expression
628
+ has:
629
+ kind: string
630
+ # A list that already has its separator, with or without a condition.
631
+ separator-follows:
632
+ kind: jsx_element
633
+ precedes:
634
+ any:
635
+ - matches: tabs-separator
636
+ - kind: jsx_expression
637
+ has:
638
+ stopBy: end
639
+ matches: tabs-separator
640
+ hide-border:
641
+ kind: jsx_attribute
642
+ has:
643
+ kind: property_identifier
644
+ regex: ^hideBorder$
645
+ # A list that a rule can give a sibling: it sits in a file that imports
646
+ # `Tabs`, its parent is an element (a fragment is one too, while the
647
+ # `{show && <Tabs.List />}` shape has no enclosing tag), and the nearest
648
+ # `Tabs.Root` is classic.
649
+ list-that-takes-separator:
650
+ kind: jsx_element
651
+ all:
652
+ - has:
653
+ field: open_tag
654
+ has:
655
+ field: name
656
+ matches: tabs-list-name
657
+ - inside:
658
+ stopBy: end
659
+ kind: program
660
+ has:
661
+ matches: tabs-import
662
+ # Why: a parameter or a local under the import's name shadows it, and the
663
+ # rules cannot tell which binding the element reads.
664
+ - not:
665
+ inside:
666
+ stopBy: end
667
+ matches: scope
668
+ has:
669
+ stopBy:
670
+ matches: scope
671
+ any:
672
+ - matches: binding-name
673
+ pattern: $TABS
674
+ - matches: function-declaration
675
+ has:
676
+ field: name
677
+ pattern: $TABS
678
+ - inside:
679
+ kind: jsx_element
680
+ - inside:
681
+ stopBy:
682
+ matches: tabs-root
683
+ matches: classic-root
684
+ rule:
685
+ kind: jsx_closing_element
686
+ inside:
687
+ matches: list-that-takes-separator
688
+ all:
689
+ - has:
690
+ field: open_tag
691
+ has:
692
+ kind: jsx_attribute
693
+ pattern:
694
+ context: <List hideBorder={$CONDITION} />
695
+ selector: jsx_attribute
696
+ - not:
697
+ matches: separator-follows
698
+ constraints:
699
+ CONDITION:
700
+ not:
701
+ any:
702
+ - kind: identifier
703
+ - kind: member_expression
704
+ - kind: call_expression
705
+ - kind: subscript_expression
706
+ - kind: non_null_expression
707
+ - kind: parenthesized_expression
708
+ - kind: unary_expression
709
+ - kind: this
710
+ - kind: string
711
+ - kind: number
712
+ - kind: template_string
713
+ - kind: "true"
714
+ - kind: "false"
715
+ fix: |-
716
+ </$TABS.List>
717
+ {!($CONDITION) && <$TABS.Separator />}
718
+ ---
719
+ id: tabs-list-false-hide-border
720
+ language: tsx
721
+ message: hideBorder={false} drew the border, so the list needs Tabs.Separator
722
+ utils:
723
+ # A node that opens a lexical scope. The shadow search below stops at a
724
+ # nested one, so a sibling function's local name does not count.
725
+ scope:
726
+ any:
727
+ - kind: statement_block
728
+ - kind: function_declaration
729
+ - kind: generator_function_declaration
730
+ - kind: function_expression
731
+ - kind: generator_function
732
+ - kind: arrow_function
733
+ - kind: method_definition
734
+ - kind: class_body
735
+ - kind: for_statement
736
+ - kind: for_in_statement
737
+ - kind: catch_clause
738
+ # An identifier in a binding position: a parameter, a destructured name, a
739
+ # local variable, a function name, or a class name.
740
+ binding-name:
741
+ any:
742
+ - kind: shorthand_property_identifier_pattern
743
+ - kind: identifier
744
+ any:
745
+ - inside: { kind: variable_declarator, field: name }
746
+ - inside: { kind: function_declaration, field: name }
747
+ - inside: { kind: generator_function_declaration, field: name }
748
+ - inside: { kind: function_expression, field: name }
749
+ - inside: { kind: required_parameter, field: pattern }
750
+ - inside: { kind: optional_parameter, field: pattern }
751
+ - inside: { kind: assignment_pattern, field: left }
752
+ - inside: { kind: pair_pattern, field: value }
753
+ - inside: { kind: array_pattern }
754
+ - inside: { kind: rest_pattern }
755
+ - inside: { kind: arrow_function, field: parameter }
756
+ - inside: { kind: catch_clause, field: parameter }
757
+ - kind: type_identifier
758
+ inside: { kind: class_declaration, field: name }
759
+ # A function declaration opens a scope, so the search above stops at it and
760
+ # never reads its name. This matches the declaration itself instead.
761
+ function-declaration:
762
+ any:
763
+ - kind: function_declaration
764
+ - kind: generator_function_declaration
765
+ tabs-import:
766
+ kind: import_statement
767
+ all:
768
+ - has:
769
+ field: source
770
+ regex: ^["']@ngrok/mantle/tabs["']$
771
+ - has:
772
+ stopBy: end
773
+ kind: import_specifier
774
+ has:
775
+ field: name
776
+ regex: ^Tabs$
777
+ any:
778
+ - kind: import_specifier
779
+ has:
780
+ field: alias
781
+ pattern: $TABS
782
+ - kind: import_specifier
783
+ not:
784
+ has:
785
+ field: alias
786
+ kind: identifier
787
+ has:
788
+ field: name
789
+ pattern: $TABS
790
+ tabs-list-name:
791
+ kind: member_expression
792
+ all:
793
+ - has:
794
+ field: object
795
+ pattern: $TABS
796
+ - has:
797
+ field: property
798
+ regex: ^List$
799
+ tabs-separator:
800
+ kind: jsx_self_closing_element
801
+ has:
802
+ field: name
803
+ kind: member_expression
804
+ all:
805
+ - has:
806
+ field: object
807
+ pattern: $TABS
808
+ - has:
809
+ field: property
810
+ regex: ^Separator$
811
+ tabs-root:
812
+ kind: jsx_element
813
+ has:
814
+ field: open_tag
815
+ has:
816
+ field: name
817
+ kind: member_expression
818
+ all:
819
+ - has:
820
+ field: object
821
+ pattern: $TABS
822
+ - has:
823
+ field: property
824
+ regex: ^Root$
825
+ pill-root:
826
+ matches: tabs-root
827
+ has:
828
+ field: open_tag
829
+ has:
830
+ kind: jsx_attribute
831
+ has:
832
+ kind: property_identifier
833
+ regex: ^appearance$
834
+ any:
835
+ - kind: jsx_attribute
836
+ has:
837
+ kind: string
838
+ regex: ^["']pill["']$
839
+ - kind: jsx_attribute
840
+ has:
841
+ kind: jsx_expression
842
+ has:
843
+ kind: string
844
+ regex: ^["']pill["']$
845
+ appearance-attribute:
846
+ kind: jsx_attribute
847
+ has:
848
+ kind: property_identifier
849
+ regex: ^appearance$
850
+ # A root with no appearance, or a literal appearance other than pill. A
851
+ # dynamic appearance stays manual, because a separator shows on pill tabs.
852
+ classic-root:
853
+ matches: tabs-root
854
+ not:
855
+ matches: pill-root
856
+ any:
857
+ - not:
858
+ has:
859
+ field: open_tag
860
+ has:
861
+ matches: appearance-attribute
862
+ - has:
863
+ field: open_tag
864
+ has:
865
+ matches: appearance-attribute
866
+ any:
867
+ - kind: jsx_attribute
868
+ has:
869
+ kind: string
870
+ - kind: jsx_attribute
871
+ has:
872
+ kind: jsx_expression
873
+ has:
874
+ kind: string
875
+ # A list that already has its separator, with or without a condition.
876
+ separator-follows:
877
+ kind: jsx_element
878
+ precedes:
879
+ any:
880
+ - matches: tabs-separator
881
+ - kind: jsx_expression
882
+ has:
883
+ stopBy: end
884
+ matches: tabs-separator
885
+ hide-border:
886
+ kind: jsx_attribute
887
+ has:
888
+ kind: property_identifier
889
+ regex: ^hideBorder$
890
+ # A list that a rule can give a sibling: it sits in a file that imports
891
+ # `Tabs`, its parent is an element (a fragment is one too, while the
892
+ # `{show && <Tabs.List />}` shape has no enclosing tag), and the nearest
893
+ # `Tabs.Root` is classic.
894
+ list-that-takes-separator:
895
+ kind: jsx_element
896
+ all:
897
+ - has:
898
+ field: open_tag
899
+ has:
900
+ field: name
901
+ matches: tabs-list-name
902
+ - inside:
903
+ stopBy: end
904
+ kind: program
905
+ has:
906
+ matches: tabs-import
907
+ # Why: a parameter or a local under the import's name shadows it, and the
908
+ # rules cannot tell which binding the element reads.
909
+ - not:
910
+ inside:
911
+ stopBy: end
912
+ matches: scope
913
+ has:
914
+ stopBy:
915
+ matches: scope
916
+ any:
917
+ - matches: binding-name
918
+ pattern: $TABS
919
+ - matches: function-declaration
920
+ has:
921
+ field: name
922
+ pattern: $TABS
923
+ - inside:
924
+ kind: jsx_element
925
+ - inside:
926
+ stopBy:
927
+ matches: tabs-root
928
+ matches: classic-root
929
+ rule:
930
+ kind: jsx_closing_element
931
+ inside:
932
+ matches: list-that-takes-separator
933
+ all:
934
+ - has:
935
+ field: open_tag
936
+ has:
937
+ matches: hide-border
938
+ has:
939
+ kind: jsx_expression
940
+ has:
941
+ kind: "false"
942
+ - not:
943
+ matches: separator-follows
944
+ fix: |-
945
+ </$TABS.List>
946
+ <$TABS.Separator />
947
+ ---
948
+ id: tabs-list-drop-hide-border
949
+ language: tsx
950
+ message: Tabs.List no longer takes hideBorder
951
+ utils:
952
+ # A node that opens a lexical scope. The shadow search below stops at a
953
+ # nested one, so a sibling function's local name does not count.
954
+ scope:
955
+ any:
956
+ - kind: statement_block
957
+ - kind: function_declaration
958
+ - kind: generator_function_declaration
959
+ - kind: function_expression
960
+ - kind: generator_function
961
+ - kind: arrow_function
962
+ - kind: method_definition
963
+ - kind: class_body
964
+ - kind: for_statement
965
+ - kind: for_in_statement
966
+ - kind: catch_clause
967
+ # An identifier in a binding position: a parameter, a destructured name, a
968
+ # local variable, a function name, or a class name.
969
+ binding-name:
970
+ any:
971
+ - kind: shorthand_property_identifier_pattern
972
+ - kind: identifier
973
+ any:
974
+ - inside: { kind: variable_declarator, field: name }
975
+ - inside: { kind: function_declaration, field: name }
976
+ - inside: { kind: generator_function_declaration, field: name }
977
+ - inside: { kind: function_expression, field: name }
978
+ - inside: { kind: required_parameter, field: pattern }
979
+ - inside: { kind: optional_parameter, field: pattern }
980
+ - inside: { kind: assignment_pattern, field: left }
981
+ - inside: { kind: pair_pattern, field: value }
982
+ - inside: { kind: array_pattern }
983
+ - inside: { kind: rest_pattern }
984
+ - inside: { kind: arrow_function, field: parameter }
985
+ - inside: { kind: catch_clause, field: parameter }
986
+ - kind: type_identifier
987
+ inside: { kind: class_declaration, field: name }
988
+ # A function declaration opens a scope, so the search above stops at it and
989
+ # never reads its name. This matches the declaration itself instead.
990
+ function-declaration:
991
+ any:
992
+ - kind: function_declaration
993
+ - kind: generator_function_declaration
994
+ tabs-import:
995
+ kind: import_statement
996
+ all:
997
+ - has:
998
+ field: source
999
+ regex: ^["']@ngrok/mantle/tabs["']$
1000
+ - has:
1001
+ stopBy: end
1002
+ kind: import_specifier
1003
+ has:
1004
+ field: name
1005
+ regex: ^Tabs$
1006
+ any:
1007
+ - kind: import_specifier
1008
+ has:
1009
+ field: alias
1010
+ pattern: $TABS
1011
+ - kind: import_specifier
1012
+ not:
1013
+ has:
1014
+ field: alias
1015
+ kind: identifier
1016
+ has:
1017
+ field: name
1018
+ pattern: $TABS
1019
+ tabs-list-name:
1020
+ kind: member_expression
1021
+ all:
1022
+ - has:
1023
+ field: object
1024
+ pattern: $TABS
1025
+ - has:
1026
+ field: property
1027
+ regex: ^List$
1028
+ tabs-separator:
1029
+ kind: jsx_self_closing_element
1030
+ has:
1031
+ field: name
1032
+ kind: member_expression
1033
+ all:
1034
+ - has:
1035
+ field: object
1036
+ pattern: $TABS
1037
+ - has:
1038
+ field: property
1039
+ regex: ^Separator$
1040
+ tabs-root:
1041
+ kind: jsx_element
1042
+ has:
1043
+ field: open_tag
1044
+ has:
1045
+ field: name
1046
+ kind: member_expression
1047
+ all:
1048
+ - has:
1049
+ field: object
1050
+ pattern: $TABS
1051
+ - has:
1052
+ field: property
1053
+ regex: ^Root$
1054
+ pill-root:
1055
+ matches: tabs-root
1056
+ has:
1057
+ field: open_tag
1058
+ has:
1059
+ kind: jsx_attribute
1060
+ has:
1061
+ kind: property_identifier
1062
+ regex: ^appearance$
1063
+ any:
1064
+ - kind: jsx_attribute
1065
+ has:
1066
+ kind: string
1067
+ regex: ^["']pill["']$
1068
+ - kind: jsx_attribute
1069
+ has:
1070
+ kind: jsx_expression
1071
+ has:
1072
+ kind: string
1073
+ regex: ^["']pill["']$
1074
+ appearance-attribute:
1075
+ kind: jsx_attribute
1076
+ has:
1077
+ kind: property_identifier
1078
+ regex: ^appearance$
1079
+ # A root with no appearance, or a literal appearance other than pill. A
1080
+ # dynamic appearance stays manual, because a separator shows on pill tabs.
1081
+ classic-root:
1082
+ matches: tabs-root
1083
+ not:
1084
+ matches: pill-root
1085
+ any:
1086
+ - not:
1087
+ has:
1088
+ field: open_tag
1089
+ has:
1090
+ matches: appearance-attribute
1091
+ - has:
1092
+ field: open_tag
1093
+ has:
1094
+ matches: appearance-attribute
1095
+ any:
1096
+ - kind: jsx_attribute
1097
+ has:
1098
+ kind: string
1099
+ - kind: jsx_attribute
1100
+ has:
1101
+ kind: jsx_expression
1102
+ has:
1103
+ kind: string
1104
+ # A list that already has its separator, with or without a condition.
1105
+ separator-follows:
1106
+ kind: jsx_element
1107
+ precedes:
1108
+ any:
1109
+ - matches: tabs-separator
1110
+ - kind: jsx_expression
1111
+ has:
1112
+ stopBy: end
1113
+ matches: tabs-separator
1114
+ hide-border:
1115
+ kind: jsx_attribute
1116
+ has:
1117
+ kind: property_identifier
1118
+ regex: ^hideBorder$
1119
+ # A list that a rule can give a sibling: it sits in a file that imports
1120
+ # `Tabs`, its parent is an element (a fragment is one too, while the
1121
+ # `{show && <Tabs.List />}` shape has no enclosing tag), and the nearest
1122
+ # `Tabs.Root` is classic.
1123
+ list-that-takes-separator:
1124
+ kind: jsx_element
1125
+ all:
1126
+ - has:
1127
+ field: open_tag
1128
+ has:
1129
+ field: name
1130
+ matches: tabs-list-name
1131
+ - inside:
1132
+ stopBy: end
1133
+ kind: program
1134
+ has:
1135
+ matches: tabs-import
1136
+ # Why: a parameter or a local under the import's name shadows it, and the
1137
+ # rules cannot tell which binding the element reads.
1138
+ - not:
1139
+ inside:
1140
+ stopBy: end
1141
+ matches: scope
1142
+ has:
1143
+ stopBy:
1144
+ matches: scope
1145
+ any:
1146
+ - matches: binding-name
1147
+ pattern: $TABS
1148
+ - matches: function-declaration
1149
+ has:
1150
+ field: name
1151
+ pattern: $TABS
1152
+ - inside:
1153
+ kind: jsx_element
1154
+ - inside:
1155
+ stopBy:
1156
+ matches: tabs-root
1157
+ matches: classic-root
1158
+ rule:
1159
+ matches: hide-border
1160
+ inside:
1161
+ any:
1162
+ - kind: jsx_opening_element
1163
+ - kind: jsx_self_closing_element
1164
+ all:
1165
+ - has:
1166
+ field: name
1167
+ matches: tabs-list-name
1168
+ - inside:
1169
+ stopBy: end
1170
+ kind: program
1171
+ has:
1172
+ matches: tabs-import
1173
+ # Why: a parameter or a local under the import's name shadows it, and the
1174
+ # rules cannot tell which binding the element reads.
1175
+ - not:
1176
+ inside:
1177
+ stopBy: end
1178
+ matches: scope
1179
+ has:
1180
+ stopBy:
1181
+ matches: scope
1182
+ any:
1183
+ - matches: binding-name
1184
+ pattern: $TABS
1185
+ - matches: function-declaration
1186
+ has:
1187
+ field: name
1188
+ pattern: $TABS
1189
+ # Why four shapes: a true flag never needs a separator, and a pill root never
1190
+ # drew one. A false or dynamic flag stays unless a rule above gave the list
1191
+ # a separator, so the type checker flags the list a rule cannot reach.
1192
+ any:
1193
+ - kind: jsx_attribute
1194
+ not:
1195
+ has:
1196
+ kind: jsx_expression
1197
+ - kind: jsx_attribute
1198
+ has:
1199
+ kind: jsx_expression
1200
+ has:
1201
+ kind: "true"
1202
+ - kind: jsx_attribute
1203
+ inside:
1204
+ stopBy:
1205
+ matches: tabs-root
1206
+ matches: pill-root
1207
+ - kind: jsx_attribute
1208
+ inside:
1209
+ kind: jsx_opening_element
1210
+ inside:
1211
+ matches: list-that-takes-separator
1212
+ fix: ""