@eslint-react/shared 1.40.0 → 1.40.1-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 +149 -1555
- package/dist/index.d.ts +149 -1555
- package/dist/index.js +47 -385
- package/dist/index.mjs +1 -339
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var module$1 = require('module');
|
|
4
4
|
var eff = require('@eslint-react/eff');
|
|
5
5
|
var tsPattern = require('ts-pattern');
|
|
6
|
+
var valibot = require('valibot');
|
|
6
7
|
var pm = require('picomatch');
|
|
7
8
|
|
|
8
9
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
@@ -35,487 +36,148 @@ function getReactVersion(fallback = "19.0.0") {
|
|
|
35
36
|
return fallback;
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
-
// ../../node_modules/.pnpm/valibot@1.0.0_typescript@5.8.2/node_modules/valibot/dist/index.js
|
|
40
|
-
var store;
|
|
41
|
-
// @__NO_SIDE_EFFECTS__
|
|
42
|
-
function getGlobalConfig(config2) {
|
|
43
|
-
return {
|
|
44
|
-
lang: config2?.lang ?? store?.lang,
|
|
45
|
-
message: config2?.message,
|
|
46
|
-
abortEarly: config2?.abortEarly ?? store?.abortEarly,
|
|
47
|
-
abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
var store2;
|
|
51
|
-
// @__NO_SIDE_EFFECTS__
|
|
52
|
-
function getGlobalMessage(lang) {
|
|
53
|
-
return store2?.get(lang);
|
|
54
|
-
}
|
|
55
|
-
var store3;
|
|
56
|
-
// @__NO_SIDE_EFFECTS__
|
|
57
|
-
function getSchemaMessage(lang) {
|
|
58
|
-
return store3?.get(lang);
|
|
59
|
-
}
|
|
60
|
-
var store4;
|
|
61
|
-
// @__NO_SIDE_EFFECTS__
|
|
62
|
-
function getSpecificMessage(reference, lang) {
|
|
63
|
-
return store4?.get(reference)?.get(lang);
|
|
64
|
-
}
|
|
65
|
-
// @__NO_SIDE_EFFECTS__
|
|
66
|
-
function _stringify(input) {
|
|
67
|
-
const type = typeof input;
|
|
68
|
-
if (type === "string") {
|
|
69
|
-
return `"${input}"`;
|
|
70
|
-
}
|
|
71
|
-
if (type === "number" || type === "bigint" || type === "boolean") {
|
|
72
|
-
return `${input}`;
|
|
73
|
-
}
|
|
74
|
-
if (type === "object" || type === "function") {
|
|
75
|
-
return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
76
|
-
}
|
|
77
|
-
return type;
|
|
78
|
-
}
|
|
79
|
-
function _addIssue(context, label, dataset, config2, other) {
|
|
80
|
-
const input = other && "input" in other ? other.input : dataset.value;
|
|
81
|
-
const expected = other?.expected ?? context.expects ?? null;
|
|
82
|
-
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
83
|
-
const issue = {
|
|
84
|
-
kind: context.kind,
|
|
85
|
-
type: context.type,
|
|
86
|
-
input,
|
|
87
|
-
expected,
|
|
88
|
-
received,
|
|
89
|
-
message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
|
|
90
|
-
requirement: context.requirement,
|
|
91
|
-
path: other?.path,
|
|
92
|
-
issues: other?.issues,
|
|
93
|
-
lang: config2.lang,
|
|
94
|
-
abortEarly: config2.abortEarly,
|
|
95
|
-
abortPipeEarly: config2.abortPipeEarly
|
|
96
|
-
};
|
|
97
|
-
const isSchema = context.kind === "schema";
|
|
98
|
-
const message = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
|
|
99
|
-
if (message !== void 0) {
|
|
100
|
-
issue.message = typeof message === "function" ? (
|
|
101
|
-
// @ts-expect-error
|
|
102
|
-
message(issue)
|
|
103
|
-
) : message;
|
|
104
|
-
}
|
|
105
|
-
if (isSchema) {
|
|
106
|
-
dataset.typed = false;
|
|
107
|
-
}
|
|
108
|
-
if (dataset.issues) {
|
|
109
|
-
dataset.issues.push(issue);
|
|
110
|
-
} else {
|
|
111
|
-
dataset.issues = [issue];
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
// @__NO_SIDE_EFFECTS__
|
|
115
|
-
function _getStandardProps(context) {
|
|
116
|
-
return {
|
|
117
|
-
version: 1,
|
|
118
|
-
vendor: "valibot",
|
|
119
|
-
validate(value2) {
|
|
120
|
-
return context["~run"]({ value: value2 }, /* @__PURE__ */ getGlobalConfig());
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
var ValiError = class extends Error {
|
|
125
|
-
/**
|
|
126
|
-
* Creates a Valibot error with useful information.
|
|
127
|
-
*
|
|
128
|
-
* @param issues The error issues.
|
|
129
|
-
*/
|
|
130
|
-
constructor(issues) {
|
|
131
|
-
super(issues[0].message);
|
|
132
|
-
this.name = "ValiError";
|
|
133
|
-
this.issues = issues;
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
// @__NO_SIDE_EFFECTS__
|
|
137
|
-
function getFallback(schema, dataset, config2) {
|
|
138
|
-
return typeof schema.fallback === "function" ? (
|
|
139
|
-
// @ts-expect-error
|
|
140
|
-
schema.fallback(dataset, config2)
|
|
141
|
-
) : (
|
|
142
|
-
// @ts-expect-error
|
|
143
|
-
schema.fallback
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
// @__NO_SIDE_EFFECTS__
|
|
147
|
-
function getDefault(schema, dataset, config2) {
|
|
148
|
-
return typeof schema.default === "function" ? (
|
|
149
|
-
// @ts-expect-error
|
|
150
|
-
schema.default(dataset, config2)
|
|
151
|
-
) : (
|
|
152
|
-
// @ts-expect-error
|
|
153
|
-
schema.default
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
// @__NO_SIDE_EFFECTS__
|
|
157
|
-
function array(item, message) {
|
|
158
|
-
return {
|
|
159
|
-
kind: "schema",
|
|
160
|
-
type: "array",
|
|
161
|
-
reference: array,
|
|
162
|
-
expects: "Array",
|
|
163
|
-
async: false,
|
|
164
|
-
item,
|
|
165
|
-
message,
|
|
166
|
-
get "~standard"() {
|
|
167
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
168
|
-
},
|
|
169
|
-
"~run"(dataset, config2) {
|
|
170
|
-
const input = dataset.value;
|
|
171
|
-
if (Array.isArray(input)) {
|
|
172
|
-
dataset.typed = true;
|
|
173
|
-
dataset.value = [];
|
|
174
|
-
for (let key = 0; key < input.length; key++) {
|
|
175
|
-
const value2 = input[key];
|
|
176
|
-
const itemDataset = this.item["~run"]({ value: value2 }, config2);
|
|
177
|
-
if (itemDataset.issues) {
|
|
178
|
-
const pathItem = {
|
|
179
|
-
type: "array",
|
|
180
|
-
origin: "value",
|
|
181
|
-
input,
|
|
182
|
-
key,
|
|
183
|
-
value: value2
|
|
184
|
-
};
|
|
185
|
-
for (const issue of itemDataset.issues) {
|
|
186
|
-
if (issue.path) {
|
|
187
|
-
issue.path.unshift(pathItem);
|
|
188
|
-
} else {
|
|
189
|
-
issue.path = [pathItem];
|
|
190
|
-
}
|
|
191
|
-
dataset.issues?.push(issue);
|
|
192
|
-
}
|
|
193
|
-
if (!dataset.issues) {
|
|
194
|
-
dataset.issues = itemDataset.issues;
|
|
195
|
-
}
|
|
196
|
-
if (config2.abortEarly) {
|
|
197
|
-
dataset.typed = false;
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
if (!itemDataset.typed) {
|
|
202
|
-
dataset.typed = false;
|
|
203
|
-
}
|
|
204
|
-
dataset.value.push(itemDataset.value);
|
|
205
|
-
}
|
|
206
|
-
} else {
|
|
207
|
-
_addIssue(this, "type", dataset, config2);
|
|
208
|
-
}
|
|
209
|
-
return dataset;
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
// @__NO_SIDE_EFFECTS__
|
|
214
|
-
function boolean(message) {
|
|
215
|
-
return {
|
|
216
|
-
kind: "schema",
|
|
217
|
-
type: "boolean",
|
|
218
|
-
reference: boolean,
|
|
219
|
-
expects: "boolean",
|
|
220
|
-
async: false,
|
|
221
|
-
message,
|
|
222
|
-
get "~standard"() {
|
|
223
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
224
|
-
},
|
|
225
|
-
"~run"(dataset, config2) {
|
|
226
|
-
if (typeof dataset.value === "boolean") {
|
|
227
|
-
dataset.typed = true;
|
|
228
|
-
} else {
|
|
229
|
-
_addIssue(this, "type", dataset, config2);
|
|
230
|
-
}
|
|
231
|
-
return dataset;
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
// @__NO_SIDE_EFFECTS__
|
|
236
|
-
function object(entries, message) {
|
|
237
|
-
return {
|
|
238
|
-
kind: "schema",
|
|
239
|
-
type: "object",
|
|
240
|
-
reference: object,
|
|
241
|
-
expects: "Object",
|
|
242
|
-
async: false,
|
|
243
|
-
entries,
|
|
244
|
-
message,
|
|
245
|
-
get "~standard"() {
|
|
246
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
247
|
-
},
|
|
248
|
-
"~run"(dataset, config2) {
|
|
249
|
-
const input = dataset.value;
|
|
250
|
-
if (input && typeof input === "object") {
|
|
251
|
-
dataset.typed = true;
|
|
252
|
-
dataset.value = {};
|
|
253
|
-
for (const key in this.entries) {
|
|
254
|
-
const valueSchema = this.entries[key];
|
|
255
|
-
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && // @ts-expect-error
|
|
256
|
-
valueSchema.default !== void 0) {
|
|
257
|
-
const value2 = key in input ? (
|
|
258
|
-
// @ts-expect-error
|
|
259
|
-
input[key]
|
|
260
|
-
) : /* @__PURE__ */ getDefault(valueSchema);
|
|
261
|
-
const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
|
|
262
|
-
if (valueDataset.issues) {
|
|
263
|
-
const pathItem = {
|
|
264
|
-
type: "object",
|
|
265
|
-
origin: "value",
|
|
266
|
-
input,
|
|
267
|
-
key,
|
|
268
|
-
value: value2
|
|
269
|
-
};
|
|
270
|
-
for (const issue of valueDataset.issues) {
|
|
271
|
-
if (issue.path) {
|
|
272
|
-
issue.path.unshift(pathItem);
|
|
273
|
-
} else {
|
|
274
|
-
issue.path = [pathItem];
|
|
275
|
-
}
|
|
276
|
-
dataset.issues?.push(issue);
|
|
277
|
-
}
|
|
278
|
-
if (!dataset.issues) {
|
|
279
|
-
dataset.issues = valueDataset.issues;
|
|
280
|
-
}
|
|
281
|
-
if (config2.abortEarly) {
|
|
282
|
-
dataset.typed = false;
|
|
283
|
-
break;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
if (!valueDataset.typed) {
|
|
287
|
-
dataset.typed = false;
|
|
288
|
-
}
|
|
289
|
-
dataset.value[key] = valueDataset.value;
|
|
290
|
-
} else if (valueSchema.fallback !== void 0) {
|
|
291
|
-
dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
292
|
-
} else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
293
|
-
_addIssue(this, "key", dataset, config2, {
|
|
294
|
-
input: void 0,
|
|
295
|
-
expected: `"${key}"`,
|
|
296
|
-
path: [
|
|
297
|
-
{
|
|
298
|
-
type: "object",
|
|
299
|
-
origin: "key",
|
|
300
|
-
input,
|
|
301
|
-
key,
|
|
302
|
-
// @ts-expect-error
|
|
303
|
-
value: input[key]
|
|
304
|
-
}
|
|
305
|
-
]
|
|
306
|
-
});
|
|
307
|
-
if (config2.abortEarly) {
|
|
308
|
-
break;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
} else {
|
|
313
|
-
_addIssue(this, "type", dataset, config2);
|
|
314
|
-
}
|
|
315
|
-
return dataset;
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
// @__NO_SIDE_EFFECTS__
|
|
320
|
-
function optional(wrapped, default_) {
|
|
321
|
-
return {
|
|
322
|
-
kind: "schema",
|
|
323
|
-
type: "optional",
|
|
324
|
-
reference: optional,
|
|
325
|
-
expects: `(${wrapped.expects} | undefined)`,
|
|
326
|
-
async: false,
|
|
327
|
-
wrapped,
|
|
328
|
-
default: default_,
|
|
329
|
-
get "~standard"() {
|
|
330
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
331
|
-
},
|
|
332
|
-
"~run"(dataset, config2) {
|
|
333
|
-
if (dataset.value === void 0) {
|
|
334
|
-
if (this.default !== void 0) {
|
|
335
|
-
dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
|
|
336
|
-
}
|
|
337
|
-
if (dataset.value === void 0) {
|
|
338
|
-
dataset.typed = true;
|
|
339
|
-
return dataset;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
return this.wrapped["~run"](dataset, config2);
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
// @__NO_SIDE_EFFECTS__
|
|
347
|
-
function string(message) {
|
|
348
|
-
return {
|
|
349
|
-
kind: "schema",
|
|
350
|
-
type: "string",
|
|
351
|
-
reference: string,
|
|
352
|
-
expects: "string",
|
|
353
|
-
async: false,
|
|
354
|
-
message,
|
|
355
|
-
get "~standard"() {
|
|
356
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
357
|
-
},
|
|
358
|
-
"~run"(dataset, config2) {
|
|
359
|
-
if (typeof dataset.value === "string") {
|
|
360
|
-
dataset.typed = true;
|
|
361
|
-
} else {
|
|
362
|
-
_addIssue(this, "type", dataset, config2);
|
|
363
|
-
}
|
|
364
|
-
return dataset;
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
function parse(schema, input, config2) {
|
|
369
|
-
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
|
|
370
|
-
if (dataset.issues) {
|
|
371
|
-
throw new ValiError(dataset.issues);
|
|
372
|
-
}
|
|
373
|
-
return dataset.value;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
// src/schemas.ts
|
|
377
|
-
var CustomComponentPropSchema = object({
|
|
39
|
+
var CustomComponentPropSchema = valibot.object({
|
|
378
40
|
/**
|
|
379
41
|
* The name of the prop in the user-defined component.
|
|
380
42
|
* @example
|
|
381
43
|
* "to"
|
|
382
44
|
*/
|
|
383
|
-
name: string(),
|
|
45
|
+
name: valibot.string(),
|
|
384
46
|
/**
|
|
385
47
|
* The name of the prop in the built-in component.
|
|
386
48
|
* @example
|
|
387
49
|
* "href"
|
|
388
50
|
*/
|
|
389
|
-
as: optional(string()),
|
|
51
|
+
as: valibot.optional(valibot.string()),
|
|
390
52
|
/**
|
|
391
53
|
* Whether the prop is controlled or not in the user-defined component.
|
|
392
54
|
* @internal
|
|
393
55
|
* @example
|
|
394
56
|
* `true`
|
|
395
57
|
*/
|
|
396
|
-
controlled: optional(boolean()),
|
|
58
|
+
controlled: valibot.optional(valibot.boolean()),
|
|
397
59
|
/**
|
|
398
60
|
* The default value of the prop in the user-defined component.
|
|
399
61
|
* @example
|
|
400
62
|
* `"/"`
|
|
401
63
|
*/
|
|
402
|
-
defaultValue: optional(string())
|
|
64
|
+
defaultValue: valibot.optional(valibot.string())
|
|
403
65
|
});
|
|
404
|
-
var CustomComponentSchema = object({
|
|
66
|
+
var CustomComponentSchema = valibot.object({
|
|
405
67
|
/**
|
|
406
68
|
* The name of the user-defined component.
|
|
407
69
|
* @example
|
|
408
70
|
* "Link"
|
|
409
71
|
*/
|
|
410
|
-
name: string(),
|
|
72
|
+
name: valibot.string(),
|
|
411
73
|
/**
|
|
412
74
|
* The name of the built-in component that the user-defined component represents.
|
|
413
75
|
* @example
|
|
414
76
|
* "a"
|
|
415
77
|
*/
|
|
416
|
-
as: optional(string()),
|
|
78
|
+
as: valibot.optional(valibot.string()),
|
|
417
79
|
/**
|
|
418
80
|
* Attributes mapping between the user-defined component and the built-in component.
|
|
419
81
|
* @example
|
|
420
82
|
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
421
83
|
*/
|
|
422
|
-
attributes: optional(array(CustomComponentPropSchema)),
|
|
84
|
+
attributes: valibot.optional(valibot.array(CustomComponentPropSchema)),
|
|
423
85
|
/**
|
|
424
86
|
* The ESQuery selector to select the component precisely.
|
|
425
87
|
* @internal
|
|
426
88
|
* @example
|
|
427
89
|
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
428
90
|
*/
|
|
429
|
-
selector: optional(string())
|
|
91
|
+
selector: valibot.optional(valibot.string())
|
|
430
92
|
});
|
|
431
|
-
var CustomHooksSchema = object({
|
|
432
|
-
use: optional(array(string())),
|
|
433
|
-
useActionState: optional(array(string())),
|
|
434
|
-
useCallback: optional(array(string())),
|
|
435
|
-
useContext: optional(array(string())),
|
|
436
|
-
useDebugValue: optional(array(string())),
|
|
437
|
-
useDeferredValue: optional(array(string())),
|
|
438
|
-
useEffect: optional(array(string())),
|
|
439
|
-
useFormStatus: optional(array(string())),
|
|
440
|
-
useId: optional(array(string())),
|
|
441
|
-
useImperativeHandle: optional(array(string())),
|
|
442
|
-
useInsertionEffect: optional(array(string())),
|
|
443
|
-
useLayoutEffect: optional(array(string())),
|
|
444
|
-
useMemo: optional(array(string())),
|
|
445
|
-
useOptimistic: optional(array(string())),
|
|
446
|
-
useReducer: optional(array(string())),
|
|
447
|
-
useRef: optional(array(string())),
|
|
448
|
-
useState: optional(array(string())),
|
|
449
|
-
useSyncExternalStore: optional(array(string())),
|
|
450
|
-
useTransition: optional(array(string()))
|
|
93
|
+
var CustomHooksSchema = valibot.object({
|
|
94
|
+
use: valibot.optional(valibot.array(valibot.string())),
|
|
95
|
+
useActionState: valibot.optional(valibot.array(valibot.string())),
|
|
96
|
+
useCallback: valibot.optional(valibot.array(valibot.string())),
|
|
97
|
+
useContext: valibot.optional(valibot.array(valibot.string())),
|
|
98
|
+
useDebugValue: valibot.optional(valibot.array(valibot.string())),
|
|
99
|
+
useDeferredValue: valibot.optional(valibot.array(valibot.string())),
|
|
100
|
+
useEffect: valibot.optional(valibot.array(valibot.string())),
|
|
101
|
+
useFormStatus: valibot.optional(valibot.array(valibot.string())),
|
|
102
|
+
useId: valibot.optional(valibot.array(valibot.string())),
|
|
103
|
+
useImperativeHandle: valibot.optional(valibot.array(valibot.string())),
|
|
104
|
+
useInsertionEffect: valibot.optional(valibot.array(valibot.string())),
|
|
105
|
+
useLayoutEffect: valibot.optional(valibot.array(valibot.string())),
|
|
106
|
+
useMemo: valibot.optional(valibot.array(valibot.string())),
|
|
107
|
+
useOptimistic: valibot.optional(valibot.array(valibot.string())),
|
|
108
|
+
useReducer: valibot.optional(valibot.array(valibot.string())),
|
|
109
|
+
useRef: valibot.optional(valibot.array(valibot.string())),
|
|
110
|
+
useState: valibot.optional(valibot.array(valibot.string())),
|
|
111
|
+
useSyncExternalStore: valibot.optional(valibot.array(valibot.string())),
|
|
112
|
+
useTransition: valibot.optional(valibot.array(valibot.string()))
|
|
451
113
|
});
|
|
452
|
-
var ESLintReactSettingsSchema = object({
|
|
114
|
+
var ESLintReactSettingsSchema = valibot.object({
|
|
453
115
|
/**
|
|
454
116
|
* The source where React is imported from.
|
|
455
117
|
* @description This allows to specify a custom import location for React when not using the official distribution.
|
|
456
118
|
* @default `"react"`
|
|
457
119
|
* @example `"@pika/react"`
|
|
458
120
|
*/
|
|
459
|
-
importSource: optional(string()),
|
|
121
|
+
importSource: valibot.optional(valibot.string()),
|
|
460
122
|
/**
|
|
461
123
|
* The identifier that's used for JSX Element creation.
|
|
462
124
|
* @default `"createElement"`
|
|
463
125
|
* @deprecated
|
|
464
126
|
*/
|
|
465
|
-
jsxPragma: optional(string()),
|
|
127
|
+
jsxPragma: valibot.optional(valibot.string()),
|
|
466
128
|
/**
|
|
467
129
|
* The identifier that's used for JSX fragment elements.
|
|
468
130
|
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
469
131
|
* @default `"Fragment"`
|
|
470
132
|
* @deprecated
|
|
471
133
|
*/
|
|
472
|
-
jsxPragmaFrag: optional(string()),
|
|
134
|
+
jsxPragmaFrag: valibot.optional(valibot.string()),
|
|
473
135
|
/**
|
|
474
136
|
* The name of the prop that is used for polymorphic components.
|
|
475
137
|
* @description This is used to determine the type of the component.
|
|
476
138
|
* @example `"as"`
|
|
477
139
|
*/
|
|
478
|
-
polymorphicPropName: optional(string()),
|
|
140
|
+
polymorphicPropName: valibot.optional(valibot.string()),
|
|
479
141
|
/**
|
|
480
142
|
* @internal
|
|
481
143
|
*/
|
|
482
|
-
strict: optional(boolean(), false),
|
|
144
|
+
strict: valibot.optional(valibot.boolean(), false),
|
|
483
145
|
/**
|
|
484
146
|
* Check both the shape and the import to determine if an API is from React.
|
|
485
147
|
* @description This can prevent false positives when using a irrelevant third-party library that has similar APIs to React.
|
|
486
148
|
* @default `true`
|
|
487
149
|
*/
|
|
488
|
-
skipImportCheck: optional(boolean(), true),
|
|
150
|
+
skipImportCheck: valibot.optional(valibot.boolean(), true),
|
|
489
151
|
/**
|
|
490
152
|
* React version to use, "detect" means auto detect React version from the project's dependencies.
|
|
491
153
|
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
492
154
|
* @example `"18.3.1"`
|
|
493
155
|
* @default `"detect"`
|
|
494
156
|
*/
|
|
495
|
-
version: optional(string()),
|
|
157
|
+
version: valibot.optional(valibot.string()),
|
|
496
158
|
/**
|
|
497
159
|
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
498
160
|
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
499
161
|
* @example `{ useEffect: ["useIsomorphicLayoutEffect"] }`
|
|
500
162
|
*/
|
|
501
|
-
additionalHooks: optional(CustomHooksSchema),
|
|
163
|
+
additionalHooks: valibot.optional(CustomHooksSchema),
|
|
502
164
|
/**
|
|
503
165
|
* An array of user-defined components
|
|
504
166
|
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
505
167
|
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
506
168
|
*/
|
|
507
|
-
additionalComponents: optional(array(CustomComponentSchema))
|
|
169
|
+
additionalComponents: valibot.optional(valibot.array(CustomComponentSchema))
|
|
508
170
|
});
|
|
509
|
-
var ESLintSettingsSchema = optional(
|
|
510
|
-
object({
|
|
511
|
-
"react-x": optional(ESLintReactSettingsSchema),
|
|
171
|
+
var ESLintSettingsSchema = valibot.optional(
|
|
172
|
+
valibot.object({
|
|
173
|
+
"react-x": valibot.optional(ESLintReactSettingsSchema),
|
|
512
174
|
/** @deprecated Use `react-x` instead */
|
|
513
|
-
reactOptions: optional(ESLintReactSettingsSchema)
|
|
175
|
+
reactOptions: valibot.optional(ESLintReactSettingsSchema)
|
|
514
176
|
}),
|
|
515
177
|
{}
|
|
516
178
|
);
|
|
517
179
|
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
518
|
-
...parse(ESLintReactSettingsSchema, {}),
|
|
180
|
+
...valibot.parse(ESLintReactSettingsSchema, {}),
|
|
519
181
|
importSource: "react",
|
|
520
182
|
polymorphicPropName: "as",
|
|
521
183
|
skipImportCheck: true,
|
|
@@ -1225,7 +887,7 @@ function unsafeDecodeSettings(data) {
|
|
|
1225
887
|
var decodeSettings = createMemoizedFunction((data) => {
|
|
1226
888
|
return {
|
|
1227
889
|
...DEFAULT_ESLINT_REACT_SETTINGS,
|
|
1228
|
-
...parse(ESLintSettingsSchema, data)["react-x"] ?? {}
|
|
890
|
+
...valibot.parse(ESLintSettingsSchema, data)["react-x"] ?? {}
|
|
1229
891
|
};
|
|
1230
892
|
}, { isEqual: (a, b) => a === b });
|
|
1231
893
|
var toNormalizedSettings = createMemoizedFunction(
|