@eslint-react/shared 1.6.0-next.1 → 1.6.0-next.2
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/index.d.mts +36 -196
- package/dist/index.d.ts +36 -196
- package/dist/index.js +42 -129
- package/dist/index.mjs +38 -129
- package/package.json +4 -2
package/dist/index.d.mts
CHANGED
|
@@ -82,69 +82,29 @@ declare const CustomAttributeSchema: valibot.ObjectSchema<{
|
|
|
82
82
|
* Which attribute is used as the `href` prop for the user-defined `Link` component that represents the built-in `a` element.
|
|
83
83
|
* Which attributes are used as `children` props for a user-defined `Button` component to receive children of that component.
|
|
84
84
|
*/
|
|
85
|
-
declare const CustomComponentSchema: valibot.
|
|
85
|
+
declare const CustomComponentSchema: valibot.ObjectSchema<{
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* "Link"
|
|
90
|
-
*/
|
|
91
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
92
|
-
/**
|
|
93
|
-
* The name of the built-in component that the user-defined component represents.
|
|
94
|
-
* @example
|
|
95
|
-
* "a"
|
|
87
|
+
* @internal
|
|
96
88
|
*/
|
|
97
|
-
readonly
|
|
98
|
-
/**
|
|
99
|
-
* Pre-defined attributes that are used in the user-defined component.
|
|
100
|
-
* @example
|
|
101
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
102
|
-
*/
|
|
103
|
-
readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
|
|
104
|
-
/**
|
|
105
|
-
* The name of the attribute in the user-defined component.
|
|
106
|
-
* @example
|
|
107
|
-
* "to"
|
|
108
|
-
*/
|
|
109
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
110
|
-
/**
|
|
111
|
-
* The name of the attribute in the built-in component.
|
|
112
|
-
* @example
|
|
113
|
-
* "href"
|
|
114
|
-
*/
|
|
115
|
-
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
116
|
-
/**
|
|
117
|
-
* Whether the attribute is controlled or not in the user-defined component.
|
|
118
|
-
* @example
|
|
119
|
-
* `true`
|
|
120
|
-
*/
|
|
121
|
-
readonly controlled: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
|
|
122
|
-
/**
|
|
123
|
-
* The default value of the attribute in the user-defined component.
|
|
124
|
-
* @example
|
|
125
|
-
* `"/"`
|
|
126
|
-
*/
|
|
127
|
-
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
128
|
-
}, undefined>, undefined>, never>;
|
|
129
|
-
}, undefined>, valibot.ObjectSchema<{
|
|
89
|
+
readonly re: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
130
90
|
/**
|
|
131
91
|
* The name of the user-defined component.
|
|
132
92
|
* @example
|
|
133
93
|
* "Link"
|
|
134
94
|
*/
|
|
135
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
95
|
+
readonly name: valibot.OptionalSchema<valibot.StringSchema<undefined>, "*">;
|
|
136
96
|
/**
|
|
137
97
|
* The ESQuery selector to select the component precisely.
|
|
138
98
|
* @example
|
|
139
|
-
*
|
|
99
|
+
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
140
100
|
*/
|
|
141
|
-
readonly selector: valibot.StringSchema<undefined>;
|
|
101
|
+
readonly selector: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
142
102
|
/**
|
|
143
103
|
* The name of the built-in component that the user-defined component represents.
|
|
144
104
|
* @example
|
|
145
105
|
* "a"
|
|
146
106
|
*/
|
|
147
|
-
readonly as: valibot.StringSchema<undefined>;
|
|
107
|
+
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
148
108
|
/**
|
|
149
109
|
* Pre-defined attributes that are used in the user-defined component.
|
|
150
110
|
* @example
|
|
@@ -175,8 +135,8 @@ declare const CustomComponentSchema: valibot.UnionSchema<[valibot.ObjectSchema<{
|
|
|
175
135
|
* `"/"`
|
|
176
136
|
*/
|
|
177
137
|
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
178
|
-
}, undefined>, undefined>,
|
|
179
|
-
}, undefined
|
|
138
|
+
}, undefined>, undefined>, readonly []>;
|
|
139
|
+
}, undefined>;
|
|
180
140
|
/**
|
|
181
141
|
* @internal
|
|
182
142
|
*/
|
|
@@ -186,69 +146,29 @@ declare const ESLintReactSettingsSchema: valibot.ObjectSchema<{
|
|
|
186
146
|
readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
187
147
|
readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
|
|
188
148
|
readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
189
|
-
readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.
|
|
149
|
+
readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
|
|
190
150
|
/**
|
|
191
|
-
*
|
|
192
|
-
* @example
|
|
193
|
-
* "Link"
|
|
151
|
+
* @internal
|
|
194
152
|
*/
|
|
195
|
-
readonly
|
|
196
|
-
/**
|
|
197
|
-
* The name of the built-in component that the user-defined component represents.
|
|
198
|
-
* @example
|
|
199
|
-
* "a"
|
|
200
|
-
*/
|
|
201
|
-
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
202
|
-
/**
|
|
203
|
-
* Pre-defined attributes that are used in the user-defined component.
|
|
204
|
-
* @example
|
|
205
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
206
|
-
*/
|
|
207
|
-
readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
|
|
208
|
-
/**
|
|
209
|
-
* The name of the attribute in the user-defined component.
|
|
210
|
-
* @example
|
|
211
|
-
* "to"
|
|
212
|
-
*/
|
|
213
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
214
|
-
/**
|
|
215
|
-
* The name of the attribute in the built-in component.
|
|
216
|
-
* @example
|
|
217
|
-
* "href"
|
|
218
|
-
*/
|
|
219
|
-
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
220
|
-
/**
|
|
221
|
-
* Whether the attribute is controlled or not in the user-defined component.
|
|
222
|
-
* @example
|
|
223
|
-
* `true`
|
|
224
|
-
*/
|
|
225
|
-
readonly controlled: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
|
|
226
|
-
/**
|
|
227
|
-
* The default value of the attribute in the user-defined component.
|
|
228
|
-
* @example
|
|
229
|
-
* `"/"`
|
|
230
|
-
*/
|
|
231
|
-
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
232
|
-
}, undefined>, undefined>, never>;
|
|
233
|
-
}, undefined>, valibot.ObjectSchema<{
|
|
153
|
+
readonly re: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
234
154
|
/**
|
|
235
155
|
* The name of the user-defined component.
|
|
236
156
|
* @example
|
|
237
157
|
* "Link"
|
|
238
158
|
*/
|
|
239
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
159
|
+
readonly name: valibot.OptionalSchema<valibot.StringSchema<undefined>, "*">;
|
|
240
160
|
/**
|
|
241
161
|
* The ESQuery selector to select the component precisely.
|
|
242
162
|
* @example
|
|
243
|
-
*
|
|
163
|
+
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
244
164
|
*/
|
|
245
|
-
readonly selector: valibot.StringSchema<undefined>;
|
|
165
|
+
readonly selector: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
246
166
|
/**
|
|
247
167
|
* The name of the built-in component that the user-defined component represents.
|
|
248
168
|
* @example
|
|
249
169
|
* "a"
|
|
250
170
|
*/
|
|
251
|
-
readonly as: valibot.StringSchema<undefined>;
|
|
171
|
+
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
252
172
|
/**
|
|
253
173
|
* Pre-defined attributes that are used in the user-defined component.
|
|
254
174
|
* @example
|
|
@@ -279,8 +199,8 @@ declare const ESLintReactSettingsSchema: valibot.ObjectSchema<{
|
|
|
279
199
|
* `"/"`
|
|
280
200
|
*/
|
|
281
201
|
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
282
|
-
}, undefined>, undefined>,
|
|
283
|
-
}, undefined
|
|
202
|
+
}, undefined>, undefined>, readonly []>;
|
|
203
|
+
}, undefined>, undefined>, readonly []>;
|
|
284
204
|
readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
|
|
285
205
|
readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
|
|
286
206
|
readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
|
|
@@ -312,69 +232,29 @@ declare const ESLintSettingsSchema: valibot.OptionalSchema<valibot.ObjectSchema<
|
|
|
312
232
|
readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
313
233
|
readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
|
|
314
234
|
readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
315
|
-
readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.
|
|
235
|
+
readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
|
|
316
236
|
/**
|
|
317
|
-
*
|
|
318
|
-
* @example
|
|
319
|
-
* "Link"
|
|
237
|
+
* @internal
|
|
320
238
|
*/
|
|
321
|
-
readonly
|
|
322
|
-
/**
|
|
323
|
-
* The name of the built-in component that the user-defined component represents.
|
|
324
|
-
* @example
|
|
325
|
-
* "a"
|
|
326
|
-
*/
|
|
327
|
-
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
328
|
-
/**
|
|
329
|
-
* Pre-defined attributes that are used in the user-defined component.
|
|
330
|
-
* @example
|
|
331
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
332
|
-
*/
|
|
333
|
-
readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
|
|
334
|
-
/**
|
|
335
|
-
* The name of the attribute in the user-defined component.
|
|
336
|
-
* @example
|
|
337
|
-
* "to"
|
|
338
|
-
*/
|
|
339
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
340
|
-
/**
|
|
341
|
-
* The name of the attribute in the built-in component.
|
|
342
|
-
* @example
|
|
343
|
-
* "href"
|
|
344
|
-
*/
|
|
345
|
-
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
346
|
-
/**
|
|
347
|
-
* Whether the attribute is controlled or not in the user-defined component.
|
|
348
|
-
* @example
|
|
349
|
-
* `true`
|
|
350
|
-
*/
|
|
351
|
-
readonly controlled: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
|
|
352
|
-
/**
|
|
353
|
-
* The default value of the attribute in the user-defined component.
|
|
354
|
-
* @example
|
|
355
|
-
* `"/"`
|
|
356
|
-
*/
|
|
357
|
-
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
358
|
-
}, undefined>, undefined>, never>;
|
|
359
|
-
}, undefined>, valibot.ObjectSchema<{
|
|
239
|
+
readonly re: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
360
240
|
/**
|
|
361
241
|
* The name of the user-defined component.
|
|
362
242
|
* @example
|
|
363
243
|
* "Link"
|
|
364
244
|
*/
|
|
365
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
245
|
+
readonly name: valibot.OptionalSchema<valibot.StringSchema<undefined>, "*">;
|
|
366
246
|
/**
|
|
367
247
|
* The ESQuery selector to select the component precisely.
|
|
368
248
|
* @example
|
|
369
|
-
*
|
|
249
|
+
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
370
250
|
*/
|
|
371
|
-
readonly selector: valibot.StringSchema<undefined>;
|
|
251
|
+
readonly selector: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
372
252
|
/**
|
|
373
253
|
* The name of the built-in component that the user-defined component represents.
|
|
374
254
|
* @example
|
|
375
255
|
* "a"
|
|
376
256
|
*/
|
|
377
|
-
readonly as: valibot.StringSchema<undefined>;
|
|
257
|
+
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
378
258
|
/**
|
|
379
259
|
* Pre-defined attributes that are used in the user-defined component.
|
|
380
260
|
* @example
|
|
@@ -405,8 +285,8 @@ declare const ESLintSettingsSchema: valibot.OptionalSchema<valibot.ObjectSchema<
|
|
|
405
285
|
* `"/"`
|
|
406
286
|
*/
|
|
407
287
|
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
408
|
-
}, undefined>, undefined>,
|
|
409
|
-
}, undefined
|
|
288
|
+
}, undefined>, undefined>, readonly []>;
|
|
289
|
+
}, undefined>, undefined>, readonly []>;
|
|
410
290
|
readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
|
|
411
291
|
readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
|
|
412
292
|
readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
|
|
@@ -438,69 +318,29 @@ declare const ESLintSettingsSchema: valibot.OptionalSchema<valibot.ObjectSchema<
|
|
|
438
318
|
readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
439
319
|
readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
|
|
440
320
|
readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
441
|
-
readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.
|
|
321
|
+
readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
|
|
442
322
|
/**
|
|
443
|
-
*
|
|
444
|
-
* @example
|
|
445
|
-
* "Link"
|
|
323
|
+
* @internal
|
|
446
324
|
*/
|
|
447
|
-
readonly
|
|
448
|
-
/**
|
|
449
|
-
* The name of the built-in component that the user-defined component represents.
|
|
450
|
-
* @example
|
|
451
|
-
* "a"
|
|
452
|
-
*/
|
|
453
|
-
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
454
|
-
/**
|
|
455
|
-
* Pre-defined attributes that are used in the user-defined component.
|
|
456
|
-
* @example
|
|
457
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
458
|
-
*/
|
|
459
|
-
readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
|
|
460
|
-
/**
|
|
461
|
-
* The name of the attribute in the user-defined component.
|
|
462
|
-
* @example
|
|
463
|
-
* "to"
|
|
464
|
-
*/
|
|
465
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
466
|
-
/**
|
|
467
|
-
* The name of the attribute in the built-in component.
|
|
468
|
-
* @example
|
|
469
|
-
* "href"
|
|
470
|
-
*/
|
|
471
|
-
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
472
|
-
/**
|
|
473
|
-
* Whether the attribute is controlled or not in the user-defined component.
|
|
474
|
-
* @example
|
|
475
|
-
* `true`
|
|
476
|
-
*/
|
|
477
|
-
readonly controlled: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
|
|
478
|
-
/**
|
|
479
|
-
* The default value of the attribute in the user-defined component.
|
|
480
|
-
* @example
|
|
481
|
-
* `"/"`
|
|
482
|
-
*/
|
|
483
|
-
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
484
|
-
}, undefined>, undefined>, never>;
|
|
485
|
-
}, undefined>, valibot.ObjectSchema<{
|
|
325
|
+
readonly re: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
486
326
|
/**
|
|
487
327
|
* The name of the user-defined component.
|
|
488
328
|
* @example
|
|
489
329
|
* "Link"
|
|
490
330
|
*/
|
|
491
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
331
|
+
readonly name: valibot.OptionalSchema<valibot.StringSchema<undefined>, "*">;
|
|
492
332
|
/**
|
|
493
333
|
* The ESQuery selector to select the component precisely.
|
|
494
334
|
* @example
|
|
495
|
-
*
|
|
335
|
+
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
496
336
|
*/
|
|
497
|
-
readonly selector: valibot.StringSchema<undefined>;
|
|
337
|
+
readonly selector: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
498
338
|
/**
|
|
499
339
|
* The name of the built-in component that the user-defined component represents.
|
|
500
340
|
* @example
|
|
501
341
|
* "a"
|
|
502
342
|
*/
|
|
503
|
-
readonly as: valibot.StringSchema<undefined>;
|
|
343
|
+
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
504
344
|
/**
|
|
505
345
|
* Pre-defined attributes that are used in the user-defined component.
|
|
506
346
|
* @example
|
|
@@ -531,8 +371,8 @@ declare const ESLintSettingsSchema: valibot.OptionalSchema<valibot.ObjectSchema<
|
|
|
531
371
|
* `"/"`
|
|
532
372
|
*/
|
|
533
373
|
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
534
|
-
}, undefined>, undefined>,
|
|
535
|
-
}, undefined
|
|
374
|
+
}, undefined>, undefined>, readonly []>;
|
|
375
|
+
}, undefined>, undefined>, readonly []>;
|
|
536
376
|
readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
|
|
537
377
|
readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
|
|
538
378
|
readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
|
package/dist/index.d.ts
CHANGED
|
@@ -82,69 +82,29 @@ declare const CustomAttributeSchema: valibot.ObjectSchema<{
|
|
|
82
82
|
* Which attribute is used as the `href` prop for the user-defined `Link` component that represents the built-in `a` element.
|
|
83
83
|
* Which attributes are used as `children` props for a user-defined `Button` component to receive children of that component.
|
|
84
84
|
*/
|
|
85
|
-
declare const CustomComponentSchema: valibot.
|
|
85
|
+
declare const CustomComponentSchema: valibot.ObjectSchema<{
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* "Link"
|
|
90
|
-
*/
|
|
91
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
92
|
-
/**
|
|
93
|
-
* The name of the built-in component that the user-defined component represents.
|
|
94
|
-
* @example
|
|
95
|
-
* "a"
|
|
87
|
+
* @internal
|
|
96
88
|
*/
|
|
97
|
-
readonly
|
|
98
|
-
/**
|
|
99
|
-
* Pre-defined attributes that are used in the user-defined component.
|
|
100
|
-
* @example
|
|
101
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
102
|
-
*/
|
|
103
|
-
readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
|
|
104
|
-
/**
|
|
105
|
-
* The name of the attribute in the user-defined component.
|
|
106
|
-
* @example
|
|
107
|
-
* "to"
|
|
108
|
-
*/
|
|
109
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
110
|
-
/**
|
|
111
|
-
* The name of the attribute in the built-in component.
|
|
112
|
-
* @example
|
|
113
|
-
* "href"
|
|
114
|
-
*/
|
|
115
|
-
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
116
|
-
/**
|
|
117
|
-
* Whether the attribute is controlled or not in the user-defined component.
|
|
118
|
-
* @example
|
|
119
|
-
* `true`
|
|
120
|
-
*/
|
|
121
|
-
readonly controlled: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
|
|
122
|
-
/**
|
|
123
|
-
* The default value of the attribute in the user-defined component.
|
|
124
|
-
* @example
|
|
125
|
-
* `"/"`
|
|
126
|
-
*/
|
|
127
|
-
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
128
|
-
}, undefined>, undefined>, never>;
|
|
129
|
-
}, undefined>, valibot.ObjectSchema<{
|
|
89
|
+
readonly re: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
130
90
|
/**
|
|
131
91
|
* The name of the user-defined component.
|
|
132
92
|
* @example
|
|
133
93
|
* "Link"
|
|
134
94
|
*/
|
|
135
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
95
|
+
readonly name: valibot.OptionalSchema<valibot.StringSchema<undefined>, "*">;
|
|
136
96
|
/**
|
|
137
97
|
* The ESQuery selector to select the component precisely.
|
|
138
98
|
* @example
|
|
139
|
-
*
|
|
99
|
+
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
140
100
|
*/
|
|
141
|
-
readonly selector: valibot.StringSchema<undefined>;
|
|
101
|
+
readonly selector: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
142
102
|
/**
|
|
143
103
|
* The name of the built-in component that the user-defined component represents.
|
|
144
104
|
* @example
|
|
145
105
|
* "a"
|
|
146
106
|
*/
|
|
147
|
-
readonly as: valibot.StringSchema<undefined>;
|
|
107
|
+
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
148
108
|
/**
|
|
149
109
|
* Pre-defined attributes that are used in the user-defined component.
|
|
150
110
|
* @example
|
|
@@ -175,8 +135,8 @@ declare const CustomComponentSchema: valibot.UnionSchema<[valibot.ObjectSchema<{
|
|
|
175
135
|
* `"/"`
|
|
176
136
|
*/
|
|
177
137
|
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
178
|
-
}, undefined>, undefined>,
|
|
179
|
-
}, undefined
|
|
138
|
+
}, undefined>, undefined>, readonly []>;
|
|
139
|
+
}, undefined>;
|
|
180
140
|
/**
|
|
181
141
|
* @internal
|
|
182
142
|
*/
|
|
@@ -186,69 +146,29 @@ declare const ESLintReactSettingsSchema: valibot.ObjectSchema<{
|
|
|
186
146
|
readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
187
147
|
readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
|
|
188
148
|
readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
189
|
-
readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.
|
|
149
|
+
readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
|
|
190
150
|
/**
|
|
191
|
-
*
|
|
192
|
-
* @example
|
|
193
|
-
* "Link"
|
|
151
|
+
* @internal
|
|
194
152
|
*/
|
|
195
|
-
readonly
|
|
196
|
-
/**
|
|
197
|
-
* The name of the built-in component that the user-defined component represents.
|
|
198
|
-
* @example
|
|
199
|
-
* "a"
|
|
200
|
-
*/
|
|
201
|
-
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
202
|
-
/**
|
|
203
|
-
* Pre-defined attributes that are used in the user-defined component.
|
|
204
|
-
* @example
|
|
205
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
206
|
-
*/
|
|
207
|
-
readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
|
|
208
|
-
/**
|
|
209
|
-
* The name of the attribute in the user-defined component.
|
|
210
|
-
* @example
|
|
211
|
-
* "to"
|
|
212
|
-
*/
|
|
213
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
214
|
-
/**
|
|
215
|
-
* The name of the attribute in the built-in component.
|
|
216
|
-
* @example
|
|
217
|
-
* "href"
|
|
218
|
-
*/
|
|
219
|
-
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
220
|
-
/**
|
|
221
|
-
* Whether the attribute is controlled or not in the user-defined component.
|
|
222
|
-
* @example
|
|
223
|
-
* `true`
|
|
224
|
-
*/
|
|
225
|
-
readonly controlled: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
|
|
226
|
-
/**
|
|
227
|
-
* The default value of the attribute in the user-defined component.
|
|
228
|
-
* @example
|
|
229
|
-
* `"/"`
|
|
230
|
-
*/
|
|
231
|
-
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
232
|
-
}, undefined>, undefined>, never>;
|
|
233
|
-
}, undefined>, valibot.ObjectSchema<{
|
|
153
|
+
readonly re: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
234
154
|
/**
|
|
235
155
|
* The name of the user-defined component.
|
|
236
156
|
* @example
|
|
237
157
|
* "Link"
|
|
238
158
|
*/
|
|
239
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
159
|
+
readonly name: valibot.OptionalSchema<valibot.StringSchema<undefined>, "*">;
|
|
240
160
|
/**
|
|
241
161
|
* The ESQuery selector to select the component precisely.
|
|
242
162
|
* @example
|
|
243
|
-
*
|
|
163
|
+
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
244
164
|
*/
|
|
245
|
-
readonly selector: valibot.StringSchema<undefined>;
|
|
165
|
+
readonly selector: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
246
166
|
/**
|
|
247
167
|
* The name of the built-in component that the user-defined component represents.
|
|
248
168
|
* @example
|
|
249
169
|
* "a"
|
|
250
170
|
*/
|
|
251
|
-
readonly as: valibot.StringSchema<undefined>;
|
|
171
|
+
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
252
172
|
/**
|
|
253
173
|
* Pre-defined attributes that are used in the user-defined component.
|
|
254
174
|
* @example
|
|
@@ -279,8 +199,8 @@ declare const ESLintReactSettingsSchema: valibot.ObjectSchema<{
|
|
|
279
199
|
* `"/"`
|
|
280
200
|
*/
|
|
281
201
|
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
282
|
-
}, undefined>, undefined>,
|
|
283
|
-
}, undefined
|
|
202
|
+
}, undefined>, undefined>, readonly []>;
|
|
203
|
+
}, undefined>, undefined>, readonly []>;
|
|
284
204
|
readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
|
|
285
205
|
readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
|
|
286
206
|
readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
|
|
@@ -312,69 +232,29 @@ declare const ESLintSettingsSchema: valibot.OptionalSchema<valibot.ObjectSchema<
|
|
|
312
232
|
readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
313
233
|
readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
|
|
314
234
|
readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
315
|
-
readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.
|
|
235
|
+
readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
|
|
316
236
|
/**
|
|
317
|
-
*
|
|
318
|
-
* @example
|
|
319
|
-
* "Link"
|
|
237
|
+
* @internal
|
|
320
238
|
*/
|
|
321
|
-
readonly
|
|
322
|
-
/**
|
|
323
|
-
* The name of the built-in component that the user-defined component represents.
|
|
324
|
-
* @example
|
|
325
|
-
* "a"
|
|
326
|
-
*/
|
|
327
|
-
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
328
|
-
/**
|
|
329
|
-
* Pre-defined attributes that are used in the user-defined component.
|
|
330
|
-
* @example
|
|
331
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
332
|
-
*/
|
|
333
|
-
readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
|
|
334
|
-
/**
|
|
335
|
-
* The name of the attribute in the user-defined component.
|
|
336
|
-
* @example
|
|
337
|
-
* "to"
|
|
338
|
-
*/
|
|
339
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
340
|
-
/**
|
|
341
|
-
* The name of the attribute in the built-in component.
|
|
342
|
-
* @example
|
|
343
|
-
* "href"
|
|
344
|
-
*/
|
|
345
|
-
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
346
|
-
/**
|
|
347
|
-
* Whether the attribute is controlled or not in the user-defined component.
|
|
348
|
-
* @example
|
|
349
|
-
* `true`
|
|
350
|
-
*/
|
|
351
|
-
readonly controlled: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
|
|
352
|
-
/**
|
|
353
|
-
* The default value of the attribute in the user-defined component.
|
|
354
|
-
* @example
|
|
355
|
-
* `"/"`
|
|
356
|
-
*/
|
|
357
|
-
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
358
|
-
}, undefined>, undefined>, never>;
|
|
359
|
-
}, undefined>, valibot.ObjectSchema<{
|
|
239
|
+
readonly re: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
360
240
|
/**
|
|
361
241
|
* The name of the user-defined component.
|
|
362
242
|
* @example
|
|
363
243
|
* "Link"
|
|
364
244
|
*/
|
|
365
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
245
|
+
readonly name: valibot.OptionalSchema<valibot.StringSchema<undefined>, "*">;
|
|
366
246
|
/**
|
|
367
247
|
* The ESQuery selector to select the component precisely.
|
|
368
248
|
* @example
|
|
369
|
-
*
|
|
249
|
+
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
370
250
|
*/
|
|
371
|
-
readonly selector: valibot.StringSchema<undefined>;
|
|
251
|
+
readonly selector: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
372
252
|
/**
|
|
373
253
|
* The name of the built-in component that the user-defined component represents.
|
|
374
254
|
* @example
|
|
375
255
|
* "a"
|
|
376
256
|
*/
|
|
377
|
-
readonly as: valibot.StringSchema<undefined>;
|
|
257
|
+
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
378
258
|
/**
|
|
379
259
|
* Pre-defined attributes that are used in the user-defined component.
|
|
380
260
|
* @example
|
|
@@ -405,8 +285,8 @@ declare const ESLintSettingsSchema: valibot.OptionalSchema<valibot.ObjectSchema<
|
|
|
405
285
|
* `"/"`
|
|
406
286
|
*/
|
|
407
287
|
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
408
|
-
}, undefined>, undefined>,
|
|
409
|
-
}, undefined
|
|
288
|
+
}, undefined>, undefined>, readonly []>;
|
|
289
|
+
}, undefined>, undefined>, readonly []>;
|
|
410
290
|
readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
|
|
411
291
|
readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
|
|
412
292
|
readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
|
|
@@ -438,69 +318,29 @@ declare const ESLintSettingsSchema: valibot.OptionalSchema<valibot.ObjectSchema<
|
|
|
438
318
|
readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
439
319
|
readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
|
|
440
320
|
readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
441
|
-
readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.
|
|
321
|
+
readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
|
|
442
322
|
/**
|
|
443
|
-
*
|
|
444
|
-
* @example
|
|
445
|
-
* "Link"
|
|
323
|
+
* @internal
|
|
446
324
|
*/
|
|
447
|
-
readonly
|
|
448
|
-
/**
|
|
449
|
-
* The name of the built-in component that the user-defined component represents.
|
|
450
|
-
* @example
|
|
451
|
-
* "a"
|
|
452
|
-
*/
|
|
453
|
-
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
454
|
-
/**
|
|
455
|
-
* Pre-defined attributes that are used in the user-defined component.
|
|
456
|
-
* @example
|
|
457
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
458
|
-
*/
|
|
459
|
-
readonly attributes: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
|
|
460
|
-
/**
|
|
461
|
-
* The name of the attribute in the user-defined component.
|
|
462
|
-
* @example
|
|
463
|
-
* "to"
|
|
464
|
-
*/
|
|
465
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
466
|
-
/**
|
|
467
|
-
* The name of the attribute in the built-in component.
|
|
468
|
-
* @example
|
|
469
|
-
* "href"
|
|
470
|
-
*/
|
|
471
|
-
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
472
|
-
/**
|
|
473
|
-
* Whether the attribute is controlled or not in the user-defined component.
|
|
474
|
-
* @example
|
|
475
|
-
* `true`
|
|
476
|
-
*/
|
|
477
|
-
readonly controlled: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
|
|
478
|
-
/**
|
|
479
|
-
* The default value of the attribute in the user-defined component.
|
|
480
|
-
* @example
|
|
481
|
-
* `"/"`
|
|
482
|
-
*/
|
|
483
|
-
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
484
|
-
}, undefined>, undefined>, never>;
|
|
485
|
-
}, undefined>, valibot.ObjectSchema<{
|
|
325
|
+
readonly re: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
486
326
|
/**
|
|
487
327
|
* The name of the user-defined component.
|
|
488
328
|
* @example
|
|
489
329
|
* "Link"
|
|
490
330
|
*/
|
|
491
|
-
readonly name: valibot.StringSchema<undefined>;
|
|
331
|
+
readonly name: valibot.OptionalSchema<valibot.StringSchema<undefined>, "*">;
|
|
492
332
|
/**
|
|
493
333
|
* The ESQuery selector to select the component precisely.
|
|
494
334
|
* @example
|
|
495
|
-
*
|
|
335
|
+
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
496
336
|
*/
|
|
497
|
-
readonly selector: valibot.StringSchema<undefined>;
|
|
337
|
+
readonly selector: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
498
338
|
/**
|
|
499
339
|
* The name of the built-in component that the user-defined component represents.
|
|
500
340
|
* @example
|
|
501
341
|
* "a"
|
|
502
342
|
*/
|
|
503
|
-
readonly as: valibot.StringSchema<undefined>;
|
|
343
|
+
readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
504
344
|
/**
|
|
505
345
|
* Pre-defined attributes that are used in the user-defined component.
|
|
506
346
|
* @example
|
|
@@ -531,8 +371,8 @@ declare const ESLintSettingsSchema: valibot.OptionalSchema<valibot.ObjectSchema<
|
|
|
531
371
|
* `"/"`
|
|
532
372
|
*/
|
|
533
373
|
readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
|
|
534
|
-
}, undefined>, undefined>,
|
|
535
|
-
}, undefined
|
|
374
|
+
}, undefined>, undefined>, readonly []>;
|
|
375
|
+
}, undefined>, undefined>, readonly []>;
|
|
536
376
|
readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
|
|
537
377
|
readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
|
|
538
378
|
readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var utils = require('@typescript-eslint/utils');
|
|
4
|
+
var picomatch = require('picomatch');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var picomatch__default = /*#__PURE__*/_interopDefault(picomatch);
|
|
4
9
|
|
|
5
10
|
// src/constants.ts
|
|
6
11
|
var NPM_SCOPE = "@eslint-react";
|
|
@@ -225,9 +230,9 @@ function _stringify(input) {
|
|
|
225
230
|
return type;
|
|
226
231
|
}
|
|
227
232
|
function _addIssue(context, label, dataset, config2, other) {
|
|
228
|
-
const input =
|
|
229
|
-
const expected =
|
|
230
|
-
const received =
|
|
233
|
+
const input = dataset.value;
|
|
234
|
+
const expected = context.expects ?? null;
|
|
235
|
+
const received = _stringify(input);
|
|
231
236
|
const issue = {
|
|
232
237
|
kind: context.kind,
|
|
233
238
|
type: context.type,
|
|
@@ -244,7 +249,7 @@ function _addIssue(context, label, dataset, config2, other) {
|
|
|
244
249
|
abortPipeEarly: config2.abortPipeEarly
|
|
245
250
|
};
|
|
246
251
|
const isSchema = context.kind === "schema";
|
|
247
|
-
const message =
|
|
252
|
+
const message = // @ts-expect-error
|
|
248
253
|
context.message ?? getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? getSchemaMessage(issue.lang) : null) ?? config2.message ?? getGlobalMessage(issue.lang);
|
|
249
254
|
if (message) {
|
|
250
255
|
issue.message = typeof message === "function" ? message(issue) : message;
|
|
@@ -460,78 +465,6 @@ function string(message) {
|
|
|
460
465
|
}
|
|
461
466
|
};
|
|
462
467
|
}
|
|
463
|
-
function _subIssues(datasets) {
|
|
464
|
-
let issues;
|
|
465
|
-
if (datasets) {
|
|
466
|
-
for (const dataset of datasets) {
|
|
467
|
-
if (issues) {
|
|
468
|
-
issues.push(...dataset.issues);
|
|
469
|
-
} else {
|
|
470
|
-
issues = dataset.issues;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
return issues;
|
|
475
|
-
}
|
|
476
|
-
function union(options, message) {
|
|
477
|
-
return {
|
|
478
|
-
kind: "schema",
|
|
479
|
-
type: "union",
|
|
480
|
-
reference: union,
|
|
481
|
-
expects: [...new Set(options.map((option) => option.expects))].join(" | ") || "never",
|
|
482
|
-
async: false,
|
|
483
|
-
options,
|
|
484
|
-
message,
|
|
485
|
-
_run(dataset, config2) {
|
|
486
|
-
let validDataset;
|
|
487
|
-
let typedDatasets;
|
|
488
|
-
let untypedDatasets;
|
|
489
|
-
for (const schema of this.options) {
|
|
490
|
-
const optionDataset = schema._run(
|
|
491
|
-
{ typed: false, value: dataset.value },
|
|
492
|
-
config2
|
|
493
|
-
);
|
|
494
|
-
if (optionDataset.typed) {
|
|
495
|
-
if (optionDataset.issues) {
|
|
496
|
-
if (typedDatasets) {
|
|
497
|
-
typedDatasets.push(optionDataset);
|
|
498
|
-
} else {
|
|
499
|
-
typedDatasets = [optionDataset];
|
|
500
|
-
}
|
|
501
|
-
} else {
|
|
502
|
-
validDataset = optionDataset;
|
|
503
|
-
break;
|
|
504
|
-
}
|
|
505
|
-
} else {
|
|
506
|
-
if (untypedDatasets) {
|
|
507
|
-
untypedDatasets.push(optionDataset);
|
|
508
|
-
} else {
|
|
509
|
-
untypedDatasets = [optionDataset];
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
if (validDataset) {
|
|
514
|
-
return validDataset;
|
|
515
|
-
}
|
|
516
|
-
if (typedDatasets) {
|
|
517
|
-
if (typedDatasets.length === 1) {
|
|
518
|
-
return typedDatasets[0];
|
|
519
|
-
}
|
|
520
|
-
_addIssue(this, "type", dataset, config2, {
|
|
521
|
-
issues: _subIssues(typedDatasets)
|
|
522
|
-
});
|
|
523
|
-
dataset.typed = true;
|
|
524
|
-
} else if (untypedDatasets?.length === 1) {
|
|
525
|
-
return untypedDatasets[0];
|
|
526
|
-
} else {
|
|
527
|
-
_addIssue(this, "type", dataset, config2, {
|
|
528
|
-
issues: _subIssues(untypedDatasets)
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
return dataset;
|
|
532
|
-
}
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
468
|
function parse(schema, input, config2) {
|
|
536
469
|
const dataset = schema._run(
|
|
537
470
|
{ typed: false, value: input },
|
|
@@ -573,61 +506,43 @@ var CustomAttributeSchema = object({
|
|
|
573
506
|
*/
|
|
574
507
|
defaultValue: optional(string())
|
|
575
508
|
});
|
|
576
|
-
var CustomComponentSchema =
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
* @example
|
|
607
|
-
* `:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
608
|
-
*/
|
|
609
|
-
selector: string(),
|
|
610
|
-
/**
|
|
611
|
-
* The name of the built-in component that the user-defined component represents.
|
|
612
|
-
* @example
|
|
613
|
-
* "a"
|
|
614
|
-
*/
|
|
615
|
-
as: string(),
|
|
616
|
-
/**
|
|
617
|
-
* Pre-defined attributes that are used in the user-defined component.
|
|
618
|
-
* @example
|
|
619
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
620
|
-
*/
|
|
621
|
-
attributes: optional(array(CustomAttributeSchema))
|
|
622
|
-
})
|
|
623
|
-
]);
|
|
509
|
+
var CustomComponentSchema = object({
|
|
510
|
+
/**
|
|
511
|
+
* @internal
|
|
512
|
+
*/
|
|
513
|
+
re: optional(string()),
|
|
514
|
+
/**
|
|
515
|
+
* The name of the user-defined component.
|
|
516
|
+
* @example
|
|
517
|
+
* "Link"
|
|
518
|
+
*/
|
|
519
|
+
name: optional(string(), "*"),
|
|
520
|
+
/**
|
|
521
|
+
* The ESQuery selector to select the component precisely.
|
|
522
|
+
* @example
|
|
523
|
+
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
524
|
+
*/
|
|
525
|
+
selector: optional(string()),
|
|
526
|
+
/**
|
|
527
|
+
* The name of the built-in component that the user-defined component represents.
|
|
528
|
+
* @example
|
|
529
|
+
* "a"
|
|
530
|
+
*/
|
|
531
|
+
as: optional(string()),
|
|
532
|
+
/**
|
|
533
|
+
* Pre-defined attributes that are used in the user-defined component.
|
|
534
|
+
* @example
|
|
535
|
+
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
536
|
+
*/
|
|
537
|
+
attributes: optional(array(CustomAttributeSchema), [])
|
|
538
|
+
});
|
|
624
539
|
var ESLintReactSettingsSchema = object({
|
|
625
540
|
importSource: optional(string()),
|
|
626
541
|
jsxPragma: optional(string()),
|
|
627
542
|
jsxPragmaFrag: optional(string()),
|
|
628
543
|
strict: optional(boolean()),
|
|
629
544
|
version: optional(string()),
|
|
630
|
-
additionalComponents: optional(array(CustomComponentSchema)),
|
|
545
|
+
additionalComponents: optional(array(CustomComponentSchema), []),
|
|
631
546
|
additionalHooks: optional(object({
|
|
632
547
|
use: optional(array(string())),
|
|
633
548
|
useActionState: optional(array(string())),
|
|
@@ -944,13 +859,10 @@ function createMemoizedFunction(fn, options) {
|
|
|
944
859
|
memoized.options = normalizedOptions;
|
|
945
860
|
return memoized;
|
|
946
861
|
}
|
|
947
|
-
|
|
948
|
-
// src/settings.ts
|
|
949
862
|
function decodeSettings(data) {
|
|
950
863
|
return parse(ESLintSettingsSchema, data)["react-x"] ?? {};
|
|
951
864
|
}
|
|
952
865
|
var expandSettings = createMemoizedFunction((settings) => {
|
|
953
|
-
if (Object.keys(settings).length === 0) return {};
|
|
954
866
|
return {
|
|
955
867
|
...settings,
|
|
956
868
|
additionalComponents: settings.additionalComponents?.map((component) => ({
|
|
@@ -958,7 +870,8 @@ var expandSettings = createMemoizedFunction((settings) => {
|
|
|
958
870
|
attributes: component.attributes?.map((attr) => ({
|
|
959
871
|
...attr,
|
|
960
872
|
as: attr.as ?? attr.name
|
|
961
|
-
})) ?? []
|
|
873
|
+
})) ?? [],
|
|
874
|
+
re: picomatch__default.default.parse(component.name).output
|
|
962
875
|
})) ?? []
|
|
963
876
|
};
|
|
964
877
|
}, { isDeepEqual: false });
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
import picomatch from 'picomatch';
|
|
2
3
|
|
|
3
4
|
// src/constants.ts
|
|
4
5
|
var NPM_SCOPE = "@eslint-react";
|
|
@@ -223,9 +224,9 @@ function _stringify(input) {
|
|
|
223
224
|
return type;
|
|
224
225
|
}
|
|
225
226
|
function _addIssue(context, label, dataset, config2, other) {
|
|
226
|
-
const input =
|
|
227
|
-
const expected =
|
|
228
|
-
const received =
|
|
227
|
+
const input = dataset.value;
|
|
228
|
+
const expected = context.expects ?? null;
|
|
229
|
+
const received = _stringify(input);
|
|
229
230
|
const issue = {
|
|
230
231
|
kind: context.kind,
|
|
231
232
|
type: context.type,
|
|
@@ -242,7 +243,7 @@ function _addIssue(context, label, dataset, config2, other) {
|
|
|
242
243
|
abortPipeEarly: config2.abortPipeEarly
|
|
243
244
|
};
|
|
244
245
|
const isSchema = context.kind === "schema";
|
|
245
|
-
const message =
|
|
246
|
+
const message = // @ts-expect-error
|
|
246
247
|
context.message ?? getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? getSchemaMessage(issue.lang) : null) ?? config2.message ?? getGlobalMessage(issue.lang);
|
|
247
248
|
if (message) {
|
|
248
249
|
issue.message = typeof message === "function" ? message(issue) : message;
|
|
@@ -458,78 +459,6 @@ function string(message) {
|
|
|
458
459
|
}
|
|
459
460
|
};
|
|
460
461
|
}
|
|
461
|
-
function _subIssues(datasets) {
|
|
462
|
-
let issues;
|
|
463
|
-
if (datasets) {
|
|
464
|
-
for (const dataset of datasets) {
|
|
465
|
-
if (issues) {
|
|
466
|
-
issues.push(...dataset.issues);
|
|
467
|
-
} else {
|
|
468
|
-
issues = dataset.issues;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
return issues;
|
|
473
|
-
}
|
|
474
|
-
function union(options, message) {
|
|
475
|
-
return {
|
|
476
|
-
kind: "schema",
|
|
477
|
-
type: "union",
|
|
478
|
-
reference: union,
|
|
479
|
-
expects: [...new Set(options.map((option) => option.expects))].join(" | ") || "never",
|
|
480
|
-
async: false,
|
|
481
|
-
options,
|
|
482
|
-
message,
|
|
483
|
-
_run(dataset, config2) {
|
|
484
|
-
let validDataset;
|
|
485
|
-
let typedDatasets;
|
|
486
|
-
let untypedDatasets;
|
|
487
|
-
for (const schema of this.options) {
|
|
488
|
-
const optionDataset = schema._run(
|
|
489
|
-
{ typed: false, value: dataset.value },
|
|
490
|
-
config2
|
|
491
|
-
);
|
|
492
|
-
if (optionDataset.typed) {
|
|
493
|
-
if (optionDataset.issues) {
|
|
494
|
-
if (typedDatasets) {
|
|
495
|
-
typedDatasets.push(optionDataset);
|
|
496
|
-
} else {
|
|
497
|
-
typedDatasets = [optionDataset];
|
|
498
|
-
}
|
|
499
|
-
} else {
|
|
500
|
-
validDataset = optionDataset;
|
|
501
|
-
break;
|
|
502
|
-
}
|
|
503
|
-
} else {
|
|
504
|
-
if (untypedDatasets) {
|
|
505
|
-
untypedDatasets.push(optionDataset);
|
|
506
|
-
} else {
|
|
507
|
-
untypedDatasets = [optionDataset];
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
if (validDataset) {
|
|
512
|
-
return validDataset;
|
|
513
|
-
}
|
|
514
|
-
if (typedDatasets) {
|
|
515
|
-
if (typedDatasets.length === 1) {
|
|
516
|
-
return typedDatasets[0];
|
|
517
|
-
}
|
|
518
|
-
_addIssue(this, "type", dataset, config2, {
|
|
519
|
-
issues: _subIssues(typedDatasets)
|
|
520
|
-
});
|
|
521
|
-
dataset.typed = true;
|
|
522
|
-
} else if (untypedDatasets?.length === 1) {
|
|
523
|
-
return untypedDatasets[0];
|
|
524
|
-
} else {
|
|
525
|
-
_addIssue(this, "type", dataset, config2, {
|
|
526
|
-
issues: _subIssues(untypedDatasets)
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
return dataset;
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
462
|
function parse(schema, input, config2) {
|
|
534
463
|
const dataset = schema._run(
|
|
535
464
|
{ typed: false, value: input },
|
|
@@ -571,61 +500,43 @@ var CustomAttributeSchema = object({
|
|
|
571
500
|
*/
|
|
572
501
|
defaultValue: optional(string())
|
|
573
502
|
});
|
|
574
|
-
var CustomComponentSchema =
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
* @example
|
|
605
|
-
* `:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
606
|
-
*/
|
|
607
|
-
selector: string(),
|
|
608
|
-
/**
|
|
609
|
-
* The name of the built-in component that the user-defined component represents.
|
|
610
|
-
* @example
|
|
611
|
-
* "a"
|
|
612
|
-
*/
|
|
613
|
-
as: string(),
|
|
614
|
-
/**
|
|
615
|
-
* Pre-defined attributes that are used in the user-defined component.
|
|
616
|
-
* @example
|
|
617
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
618
|
-
*/
|
|
619
|
-
attributes: optional(array(CustomAttributeSchema))
|
|
620
|
-
})
|
|
621
|
-
]);
|
|
503
|
+
var CustomComponentSchema = object({
|
|
504
|
+
/**
|
|
505
|
+
* @internal
|
|
506
|
+
*/
|
|
507
|
+
re: optional(string()),
|
|
508
|
+
/**
|
|
509
|
+
* The name of the user-defined component.
|
|
510
|
+
* @example
|
|
511
|
+
* "Link"
|
|
512
|
+
*/
|
|
513
|
+
name: optional(string(), "*"),
|
|
514
|
+
/**
|
|
515
|
+
* The ESQuery selector to select the component precisely.
|
|
516
|
+
* @example
|
|
517
|
+
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
518
|
+
*/
|
|
519
|
+
selector: optional(string()),
|
|
520
|
+
/**
|
|
521
|
+
* The name of the built-in component that the user-defined component represents.
|
|
522
|
+
* @example
|
|
523
|
+
* "a"
|
|
524
|
+
*/
|
|
525
|
+
as: optional(string()),
|
|
526
|
+
/**
|
|
527
|
+
* Pre-defined attributes that are used in the user-defined component.
|
|
528
|
+
* @example
|
|
529
|
+
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
530
|
+
*/
|
|
531
|
+
attributes: optional(array(CustomAttributeSchema), [])
|
|
532
|
+
});
|
|
622
533
|
var ESLintReactSettingsSchema = object({
|
|
623
534
|
importSource: optional(string()),
|
|
624
535
|
jsxPragma: optional(string()),
|
|
625
536
|
jsxPragmaFrag: optional(string()),
|
|
626
537
|
strict: optional(boolean()),
|
|
627
538
|
version: optional(string()),
|
|
628
|
-
additionalComponents: optional(array(CustomComponentSchema)),
|
|
539
|
+
additionalComponents: optional(array(CustomComponentSchema), []),
|
|
629
540
|
additionalHooks: optional(object({
|
|
630
541
|
use: optional(array(string())),
|
|
631
542
|
useActionState: optional(array(string())),
|
|
@@ -942,13 +853,10 @@ function createMemoizedFunction(fn, options) {
|
|
|
942
853
|
memoized.options = normalizedOptions;
|
|
943
854
|
return memoized;
|
|
944
855
|
}
|
|
945
|
-
|
|
946
|
-
// src/settings.ts
|
|
947
856
|
function decodeSettings(data) {
|
|
948
857
|
return parse(ESLintSettingsSchema, data)["react-x"] ?? {};
|
|
949
858
|
}
|
|
950
859
|
var expandSettings = createMemoizedFunction((settings) => {
|
|
951
|
-
if (Object.keys(settings).length === 0) return {};
|
|
952
860
|
return {
|
|
953
861
|
...settings,
|
|
954
862
|
additionalComponents: settings.additionalComponents?.map((component) => ({
|
|
@@ -956,7 +864,8 @@ var expandSettings = createMemoizedFunction((settings) => {
|
|
|
956
864
|
attributes: component.attributes?.map((attr) => ({
|
|
957
865
|
...attr,
|
|
958
866
|
as: attr.as ?? attr.name
|
|
959
|
-
})) ?? []
|
|
867
|
+
})) ?? [],
|
|
868
|
+
re: picomatch.parse(component.name).output
|
|
960
869
|
})) ?? []
|
|
961
870
|
};
|
|
962
871
|
}, { isDeepEqual: false });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "1.6.0-next.
|
|
3
|
+
"version": "1.6.0-next.2",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -35,9 +35,11 @@
|
|
|
35
35
|
"./package.json"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@typescript-eslint/utils": "^7.17.0"
|
|
38
|
+
"@typescript-eslint/utils": "^7.17.0",
|
|
39
|
+
"picomatch": "^4.0.2"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
42
|
+
"@types/picomatch": "^3.0.0",
|
|
41
43
|
"micro-memoize": "4.1.2",
|
|
42
44
|
"tsup": "8.2.3",
|
|
43
45
|
"type-fest": "4.23.0",
|