@eslint-react/shared 1.5.31-next.3 → 1.6.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ESLintUtils } from '@typescript-eslint/utils';
2
2
  import * as valibot from 'valibot';
3
3
  import { InferOutput } from 'valibot';
4
+ import * as micro_memoize from 'micro-memoize';
4
5
 
5
6
  /**
6
7
  * -----------------------------------------------------------------------------
@@ -60,6 +61,12 @@ declare const CustomAttributeSchema: valibot.ObjectSchema<{
60
61
  * "href"
61
62
  */
62
63
  readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
64
+ /**
65
+ * Whether the attribute is controlled or not in the user-defined component.
66
+ * @example
67
+ * `true`
68
+ */
69
+ readonly controlled: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
63
70
  /**
64
71
  * The default value of the attribute in the user-defined component.
65
72
  * @example
@@ -75,13 +82,63 @@ declare const CustomAttributeSchema: valibot.ObjectSchema<{
75
82
  * Which attribute is used as the `href` prop for the user-defined `Link` component that represents the built-in `a` element.
76
83
  * Which attributes are used as `children` props for a user-defined `Button` component to receive children of that component.
77
84
  */
78
- declare const CustomComponentSchema: valibot.ObjectSchema<{
85
+ declare const CustomComponentSchema: valibot.UnionSchema<[valibot.ObjectSchema<{
79
86
  /**
80
87
  * The name of the user-defined component.
81
88
  * @example
82
89
  * "Link"
83
90
  */
84
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"
96
+ */
97
+ readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
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<{
130
+ /**
131
+ * The name of the user-defined component.
132
+ * @example
133
+ * "Link"
134
+ */
135
+ readonly name: valibot.StringSchema<undefined>;
136
+ /**
137
+ * The ESQuery selector to select the component precisely.
138
+ * @example
139
+ * `:has(JSXAttribute[name.name='component'][value.value='a'])`
140
+ */
141
+ readonly selector: valibot.StringSchema<undefined>;
85
142
  /**
86
143
  * The name of the built-in component that the user-defined component represents.
87
144
  * @example
@@ -106,6 +163,12 @@ declare const CustomComponentSchema: valibot.ObjectSchema<{
106
163
  * "href"
107
164
  */
108
165
  readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
166
+ /**
167
+ * Whether the attribute is controlled or not in the user-defined component.
168
+ * @example
169
+ * `true`
170
+ */
171
+ readonly controlled: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
109
172
  /**
110
173
  * The default value of the attribute in the user-defined component.
111
174
  * @example
@@ -113,7 +176,7 @@ declare const CustomComponentSchema: valibot.ObjectSchema<{
113
176
  */
114
177
  readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
115
178
  }, undefined>, undefined>, never>;
116
- }, undefined>;
179
+ }, undefined>], undefined>;
117
180
  /**
118
181
  * @internal
119
182
  */
@@ -123,13 +186,63 @@ declare const ESLintReactSettingsSchema: valibot.ObjectSchema<{
123
186
  readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
124
187
  readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
125
188
  readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
126
- readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
189
+ readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.UnionSchema<[valibot.ObjectSchema<{
190
+ /**
191
+ * The name of the user-defined component.
192
+ * @example
193
+ * "Link"
194
+ */
195
+ readonly name: valibot.StringSchema<undefined>;
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<{
127
234
  /**
128
235
  * The name of the user-defined component.
129
236
  * @example
130
237
  * "Link"
131
238
  */
132
239
  readonly name: valibot.StringSchema<undefined>;
240
+ /**
241
+ * The ESQuery selector to select the component precisely.
242
+ * @example
243
+ * `:has(JSXAttribute[name.name='component'][value.value='a'])`
244
+ */
245
+ readonly selector: valibot.StringSchema<undefined>;
133
246
  /**
134
247
  * The name of the built-in component that the user-defined component represents.
135
248
  * @example
@@ -154,6 +267,12 @@ declare const ESLintReactSettingsSchema: valibot.ObjectSchema<{
154
267
  * "href"
155
268
  */
156
269
  readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
270
+ /**
271
+ * Whether the attribute is controlled or not in the user-defined component.
272
+ * @example
273
+ * `true`
274
+ */
275
+ readonly controlled: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
157
276
  /**
158
277
  * The default value of the attribute in the user-defined component.
159
278
  * @example
@@ -161,7 +280,7 @@ declare const ESLintReactSettingsSchema: valibot.ObjectSchema<{
161
280
  */
162
281
  readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
163
282
  }, undefined>, undefined>, never>;
164
- }, undefined>, undefined>, never>;
283
+ }, undefined>], undefined>, undefined>, never>;
165
284
  readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
166
285
  readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
167
286
  readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
@@ -186,20 +305,70 @@ declare const ESLintReactSettingsSchema: valibot.ObjectSchema<{
186
305
  /**
187
306
  * @internal
188
307
  */
189
- declare const ESLintSettingsSchema: valibot.ObjectSchema<{
308
+ declare const ESLintSettingsSchema: valibot.OptionalSchema<valibot.ObjectSchema<{
190
309
  readonly "react-x": valibot.OptionalSchema<valibot.ObjectSchema<{
191
310
  readonly importSource: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
192
311
  readonly jsxPragma: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
193
312
  readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
194
313
  readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
195
314
  readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
196
- readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
315
+ readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.UnionSchema<[valibot.ObjectSchema<{
197
316
  /**
198
317
  * The name of the user-defined component.
199
318
  * @example
200
319
  * "Link"
201
320
  */
202
321
  readonly name: valibot.StringSchema<undefined>;
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<{
360
+ /**
361
+ * The name of the user-defined component.
362
+ * @example
363
+ * "Link"
364
+ */
365
+ readonly name: valibot.StringSchema<undefined>;
366
+ /**
367
+ * The ESQuery selector to select the component precisely.
368
+ * @example
369
+ * `:has(JSXAttribute[name.name='component'][value.value='a'])`
370
+ */
371
+ readonly selector: valibot.StringSchema<undefined>;
203
372
  /**
204
373
  * The name of the built-in component that the user-defined component represents.
205
374
  * @example
@@ -224,6 +393,12 @@ declare const ESLintSettingsSchema: valibot.ObjectSchema<{
224
393
  * "href"
225
394
  */
226
395
  readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
396
+ /**
397
+ * Whether the attribute is controlled or not in the user-defined component.
398
+ * @example
399
+ * `true`
400
+ */
401
+ readonly controlled: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
227
402
  /**
228
403
  * The default value of the attribute in the user-defined component.
229
404
  * @example
@@ -231,7 +406,7 @@ declare const ESLintSettingsSchema: valibot.ObjectSchema<{
231
406
  */
232
407
  readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
233
408
  }, undefined>, undefined>, never>;
234
- }, undefined>, undefined>, never>;
409
+ }, undefined>], undefined>, undefined>, never>;
235
410
  readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
236
411
  readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
237
412
  readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
@@ -252,8 +427,9 @@ declare const ESLintSettingsSchema: valibot.ObjectSchema<{
252
427
  readonly useSyncExternalStore: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
253
428
  readonly useTransition: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
254
429
  }, undefined>, never>;
255
- }, undefined>, never>;
430
+ }, undefined>, {}>;
256
431
  /**
432
+ * @internal
257
433
  * @deprecated
258
434
  */
259
435
  readonly reactOptions: valibot.OptionalSchema<valibot.ObjectSchema<{
@@ -262,13 +438,63 @@ declare const ESLintSettingsSchema: valibot.ObjectSchema<{
262
438
  readonly jsxPragmaFrag: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
263
439
  readonly strict: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
264
440
  readonly version: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
265
- readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.ObjectSchema<{
441
+ readonly additionalComponents: valibot.OptionalSchema<valibot.ArraySchema<valibot.UnionSchema<[valibot.ObjectSchema<{
266
442
  /**
267
443
  * The name of the user-defined component.
268
444
  * @example
269
445
  * "Link"
270
446
  */
271
447
  readonly name: valibot.StringSchema<undefined>;
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<{
486
+ /**
487
+ * The name of the user-defined component.
488
+ * @example
489
+ * "Link"
490
+ */
491
+ readonly name: valibot.StringSchema<undefined>;
492
+ /**
493
+ * The ESQuery selector to select the component precisely.
494
+ * @example
495
+ * `:has(JSXAttribute[name.name='component'][value.value='a'])`
496
+ */
497
+ readonly selector: valibot.StringSchema<undefined>;
272
498
  /**
273
499
  * The name of the built-in component that the user-defined component represents.
274
500
  * @example
@@ -293,6 +519,12 @@ declare const ESLintSettingsSchema: valibot.ObjectSchema<{
293
519
  * "href"
294
520
  */
295
521
  readonly as: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
522
+ /**
523
+ * Whether the attribute is controlled or not in the user-defined component.
524
+ * @example
525
+ * `true`
526
+ */
527
+ readonly controlled: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, never>;
296
528
  /**
297
529
  * The default value of the attribute in the user-defined component.
298
530
  * @example
@@ -300,7 +532,7 @@ declare const ESLintSettingsSchema: valibot.ObjectSchema<{
300
532
  */
301
533
  readonly defaultValue: valibot.OptionalSchema<valibot.StringSchema<undefined>, never>;
302
534
  }, undefined>, undefined>, never>;
303
- }, undefined>, undefined>, never>;
535
+ }, undefined>], undefined>, undefined>, never>;
304
536
  readonly additionalHooks: valibot.OptionalSchema<valibot.ObjectSchema<{
305
537
  readonly use: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
306
538
  readonly useActionState: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
@@ -321,15 +553,16 @@ declare const ESLintSettingsSchema: valibot.ObjectSchema<{
321
553
  readonly useSyncExternalStore: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
322
554
  readonly useTransition: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, never>;
323
555
  }, undefined>, never>;
324
- }, undefined>, never>;
325
- }, undefined>;
556
+ }, undefined>, {}>;
557
+ }, undefined>, {}>;
326
558
  type CustomHook = InferOutput<typeof CustomHookSchema>;
327
559
  type CustomAttribute = InferOutput<typeof CustomAttributeSchema>;
328
560
  type CustomComponent = InferOutput<typeof CustomComponentSchema>;
329
561
  type ESLintReactSettings = InferOutput<typeof ESLintReactSettingsSchema>;
330
562
  type ESLintSettings = InferOutput<typeof ESLintSettingsSchema>;
331
563
 
332
- declare function parseESLintSettings(data: unknown): ESLintSettings;
564
+ declare function decodeSettings(data: unknown): ESLintReactSettings;
565
+ declare const expandSettings: micro_memoize.Memoized<(settings: ESLintReactSettings) => ESLintReactSettings>;
333
566
  declare const DEFAULT_ESLINT_REACT_SETTINGS: ESLintReactSettings;
334
567
 
335
- export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, CustomComponentSchema, type CustomHook, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, type ESLintReactSettings, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, parseESLintSettings };
568
+ export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, CustomComponentSchema, type CustomHook, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, type ESLintReactSettings, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, expandSettings };