@eslint-react/shared 1.24.0-next.1 → 1.24.0-next.12
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 +218 -220
- package/dist/index.d.ts +218 -220
- package/dist/index.js +79 -99
- package/dist/index.mjs +77 -96
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -230,7 +230,7 @@ function getReactVersion(fallback = "19.0.0") {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
// ../../node_modules/.pnpm/valibot@1.0.0-beta.
|
|
233
|
+
// ../../node_modules/.pnpm/valibot@1.0.0-beta.12_typescript@5.7.3/node_modules/valibot/dist/index.js
|
|
234
234
|
var store;
|
|
235
235
|
// @__NO_SIDE_EFFECTS__
|
|
236
236
|
function getGlobalConfig(config2) {
|
|
@@ -417,29 +417,6 @@ function boolean(message) {
|
|
|
417
417
|
};
|
|
418
418
|
}
|
|
419
419
|
// @__NO_SIDE_EFFECTS__
|
|
420
|
-
function instance(class_, message) {
|
|
421
|
-
return {
|
|
422
|
-
kind: "schema",
|
|
423
|
-
type: "instance",
|
|
424
|
-
reference: instance,
|
|
425
|
-
expects: class_.name,
|
|
426
|
-
async: false,
|
|
427
|
-
class: class_,
|
|
428
|
-
message,
|
|
429
|
-
get "~standard"() {
|
|
430
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
431
|
-
},
|
|
432
|
-
"~run"(dataset, config2) {
|
|
433
|
-
if (dataset.value instanceof this.class) {
|
|
434
|
-
dataset.typed = true;
|
|
435
|
-
} else {
|
|
436
|
-
_addIssue(this, "type", dataset, config2);
|
|
437
|
-
}
|
|
438
|
-
return dataset;
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
// @__NO_SIDE_EFFECTS__
|
|
443
420
|
function object(entries, message) {
|
|
444
421
|
return {
|
|
445
422
|
kind: "schema",
|
|
@@ -547,7 +524,6 @@ function string(message) {
|
|
|
547
524
|
}
|
|
548
525
|
};
|
|
549
526
|
}
|
|
550
|
-
// @__NO_SIDE_EFFECTS__
|
|
551
527
|
function parse(schema, input, config2) {
|
|
552
528
|
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
|
|
553
529
|
if (dataset.issues) {
|
|
@@ -557,30 +533,27 @@ function parse(schema, input, config2) {
|
|
|
557
533
|
}
|
|
558
534
|
|
|
559
535
|
// src/schemas.ts
|
|
560
|
-
var
|
|
561
|
-
// TODO: Define the schema for custom Hooks
|
|
562
|
-
});
|
|
563
|
-
var CustomAttributeSchema = object({
|
|
536
|
+
var CustomComponentPropSchema = object({
|
|
564
537
|
/**
|
|
565
|
-
* The name of the
|
|
538
|
+
* The name of the prop in the user-defined component.
|
|
566
539
|
* @example
|
|
567
540
|
* "to"
|
|
568
541
|
*/
|
|
569
542
|
name: string(),
|
|
570
543
|
/**
|
|
571
|
-
* The name of the
|
|
544
|
+
* The name of the prop in the built-in component.
|
|
572
545
|
* @example
|
|
573
546
|
* "href"
|
|
574
547
|
*/
|
|
575
548
|
as: optional(string()),
|
|
576
549
|
/**
|
|
577
|
-
* Whether the
|
|
550
|
+
* Whether the prop is controlled or not in the user-defined component.
|
|
578
551
|
* @example
|
|
579
552
|
* `true`
|
|
580
553
|
*/
|
|
581
554
|
controlled: optional(boolean()),
|
|
582
555
|
/**
|
|
583
|
-
* The default value of the
|
|
556
|
+
* The default value of the prop in the user-defined component.
|
|
584
557
|
* @example
|
|
585
558
|
* `"/"`
|
|
586
559
|
*/
|
|
@@ -595,6 +568,7 @@ var CustomComponentSchema = object({
|
|
|
595
568
|
name: string(),
|
|
596
569
|
/**
|
|
597
570
|
* The ESQuery selector to select the component precisely.
|
|
571
|
+
* @internal
|
|
598
572
|
* @example
|
|
599
573
|
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
600
574
|
*/
|
|
@@ -606,18 +580,32 @@ var CustomComponentSchema = object({
|
|
|
606
580
|
*/
|
|
607
581
|
as: optional(string()),
|
|
608
582
|
/**
|
|
609
|
-
*
|
|
583
|
+
* Attributes mapping between the user-defined component and the built-in component.
|
|
610
584
|
* @example
|
|
611
585
|
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
612
586
|
*/
|
|
613
|
-
attributes: optional(array(
|
|
587
|
+
attributes: optional(array(CustomComponentPropSchema))
|
|
614
588
|
});
|
|
615
|
-
var
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
589
|
+
var CustomHooksSchema = object({
|
|
590
|
+
use: optional(array(string())),
|
|
591
|
+
useActionState: optional(array(string())),
|
|
592
|
+
useCallback: optional(array(string())),
|
|
593
|
+
useContext: optional(array(string())),
|
|
594
|
+
useDebugValue: optional(array(string())),
|
|
595
|
+
useDeferredValue: optional(array(string())),
|
|
596
|
+
useEffect: optional(array(string())),
|
|
597
|
+
useFormStatus: optional(array(string())),
|
|
598
|
+
useId: optional(array(string())),
|
|
599
|
+
useImperativeHandle: optional(array(string())),
|
|
600
|
+
useInsertionEffect: optional(array(string())),
|
|
601
|
+
useLayoutEffect: optional(array(string())),
|
|
602
|
+
useMemo: optional(array(string())),
|
|
603
|
+
useOptimistic: optional(array(string())),
|
|
604
|
+
useReducer: optional(array(string())),
|
|
605
|
+
useRef: optional(array(string())),
|
|
606
|
+
useState: optional(array(string())),
|
|
607
|
+
useSyncExternalStore: optional(array(string())),
|
|
608
|
+
useTransition: optional(array(string()))
|
|
621
609
|
});
|
|
622
610
|
var ESLintReactSettingsSchema = object({
|
|
623
611
|
/**
|
|
@@ -626,41 +614,41 @@ var ESLintReactSettingsSchema = object({
|
|
|
626
614
|
* @default `"react"`
|
|
627
615
|
* @example `"@pika/react"`
|
|
628
616
|
*/
|
|
629
|
-
importSource: optional(string()),
|
|
617
|
+
importSource: optional(string(), "react"),
|
|
630
618
|
/**
|
|
631
619
|
* The identifier that’s used for JSX Element creation.
|
|
632
620
|
* @default `"createElement"`
|
|
633
621
|
* @deprecated
|
|
634
622
|
*/
|
|
635
|
-
jsxPragma: optional(string()),
|
|
623
|
+
jsxPragma: optional(string(), "createElement"),
|
|
636
624
|
/**
|
|
637
625
|
* The identifier that’s used for JSX fragment elements.
|
|
638
626
|
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
639
627
|
* @default `"Fragment"`
|
|
640
628
|
* @deprecated
|
|
641
629
|
*/
|
|
642
|
-
jsxPragmaFrag: optional(string()),
|
|
630
|
+
jsxPragmaFrag: optional(string(), "Fragment"),
|
|
643
631
|
/**
|
|
644
632
|
* The name of the prop that is used for polymorphic components.
|
|
645
633
|
* @description This is used to determine the type of the component.
|
|
646
634
|
* @example `"as"`
|
|
647
635
|
*/
|
|
648
|
-
polymorphicPropName: optional(string()),
|
|
636
|
+
polymorphicPropName: optional(string(), "as"),
|
|
649
637
|
/**
|
|
650
638
|
* @internal
|
|
651
639
|
*/
|
|
652
|
-
strict: optional(boolean()),
|
|
640
|
+
strict: optional(boolean(), false),
|
|
653
641
|
/**
|
|
654
642
|
* @internal
|
|
655
643
|
*/
|
|
656
|
-
strictImportCheck: optional(boolean()),
|
|
644
|
+
strictImportCheck: optional(boolean(), false),
|
|
657
645
|
/**
|
|
658
646
|
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
659
647
|
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
660
648
|
* @example `"18.3.1"`
|
|
661
649
|
* @default `"detect"`
|
|
662
650
|
*/
|
|
663
|
-
version: optional(string()),
|
|
651
|
+
version: optional(string(), "detect"),
|
|
664
652
|
/**
|
|
665
653
|
* An array of user-defined components
|
|
666
654
|
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
@@ -668,31 +656,11 @@ var ESLintReactSettingsSchema = object({
|
|
|
668
656
|
*/
|
|
669
657
|
additionalComponents: optional(array(CustomComponentSchema)),
|
|
670
658
|
/**
|
|
671
|
-
* A object
|
|
659
|
+
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
672
660
|
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
673
661
|
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
674
662
|
*/
|
|
675
|
-
additionalHooks: optional(
|
|
676
|
-
use: optional(array(string())),
|
|
677
|
-
useActionState: optional(array(string())),
|
|
678
|
-
useCallback: optional(array(string())),
|
|
679
|
-
useContext: optional(array(string())),
|
|
680
|
-
useDebugValue: optional(array(string())),
|
|
681
|
-
useDeferredValue: optional(array(string())),
|
|
682
|
-
useEffect: optional(array(string())),
|
|
683
|
-
useFormStatus: optional(array(string())),
|
|
684
|
-
useId: optional(array(string())),
|
|
685
|
-
useImperativeHandle: optional(array(string())),
|
|
686
|
-
useInsertionEffect: optional(array(string())),
|
|
687
|
-
useLayoutEffect: optional(array(string())),
|
|
688
|
-
useMemo: optional(array(string())),
|
|
689
|
-
useOptimistic: optional(array(string())),
|
|
690
|
-
useReducer: optional(array(string())),
|
|
691
|
-
useRef: optional(array(string())),
|
|
692
|
-
useState: optional(array(string())),
|
|
693
|
-
useSyncExternalStore: optional(array(string())),
|
|
694
|
-
useTransition: optional(array(string()))
|
|
695
|
-
}))
|
|
663
|
+
additionalHooks: optional(CustomHooksSchema)
|
|
696
664
|
});
|
|
697
665
|
var ESLintSettingsSchema = optional(
|
|
698
666
|
object({
|
|
@@ -702,6 +670,12 @@ var ESLintSettingsSchema = optional(
|
|
|
702
670
|
}),
|
|
703
671
|
{}
|
|
704
672
|
);
|
|
673
|
+
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
674
|
+
...parse(ESLintReactSettingsSchema, {}),
|
|
675
|
+
additionalHooks: {
|
|
676
|
+
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
677
|
+
}
|
|
678
|
+
};
|
|
705
679
|
|
|
706
680
|
// ../../node_modules/.pnpm/fast-equals@5.2.2/node_modules/fast-equals/dist/esm/index.mjs
|
|
707
681
|
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
@@ -1396,14 +1370,6 @@ function createMemoizedFunction(fn, options) {
|
|
|
1396
1370
|
memoized.options = normalizedOptions;
|
|
1397
1371
|
return memoized;
|
|
1398
1372
|
}
|
|
1399
|
-
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
1400
|
-
additionalHooks: {
|
|
1401
|
-
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
1402
|
-
},
|
|
1403
|
-
polymorphicPropName: "as",
|
|
1404
|
-
strictImportCheck: false,
|
|
1405
|
-
version: "detect"
|
|
1406
|
-
};
|
|
1407
1373
|
function unsafeDecodeSettings(data) {
|
|
1408
1374
|
return data?.["react-x"] ?? {};
|
|
1409
1375
|
}
|
|
@@ -1413,31 +1379,45 @@ var decodeSettings = createMemoizedFunction((data) => {
|
|
|
1413
1379
|
...parse(ESLintSettingsSchema, data)["react-x"] ?? {}
|
|
1414
1380
|
};
|
|
1415
1381
|
}, { isEqual: (a, b) => a === b });
|
|
1416
|
-
var
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1382
|
+
var toNormalizedSettings = createMemoizedFunction(
|
|
1383
|
+
({
|
|
1384
|
+
additionalComponents = [],
|
|
1385
|
+
additionalHooks = {},
|
|
1386
|
+
version,
|
|
1387
|
+
...rest
|
|
1388
|
+
}) => {
|
|
1389
|
+
return {
|
|
1390
|
+
...rest,
|
|
1391
|
+
additionalComponents: additionalComponents.map(({
|
|
1392
|
+
name,
|
|
1393
|
+
as = name,
|
|
1394
|
+
attributes = [],
|
|
1395
|
+
...rest2
|
|
1396
|
+
}) => ({
|
|
1397
|
+
...rest2,
|
|
1398
|
+
name,
|
|
1399
|
+
as,
|
|
1400
|
+
attributes: attributes.map(({ name: name2, as: as2 = name2, ...rest3 }) => ({
|
|
1401
|
+
...rest3,
|
|
1402
|
+
name: name2,
|
|
1403
|
+
as: as2
|
|
1404
|
+
})),
|
|
1405
|
+
re: pm__default.default.makeRe(name, { fastpaths: true })
|
|
1406
|
+
})),
|
|
1407
|
+
additionalHooks,
|
|
1408
|
+
version: tsPattern.match(version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () => getReactVersion("19.0.0")).otherwise(eff.identity)
|
|
1409
|
+
};
|
|
1410
|
+
},
|
|
1411
|
+
{ isEqual: shallowEqual }
|
|
1412
|
+
);
|
|
1432
1413
|
function getSettingsFromContext(context) {
|
|
1433
|
-
return
|
|
1414
|
+
return toNormalizedSettings(decodeSettings(context.settings));
|
|
1434
1415
|
}
|
|
1435
1416
|
var defineSettings = eff.identity;
|
|
1436
1417
|
|
|
1437
|
-
exports.
|
|
1438
|
-
exports.CustomComponentNormalizedSchema = CustomComponentNormalizedSchema;
|
|
1418
|
+
exports.CustomComponentPropSchema = CustomComponentPropSchema;
|
|
1439
1419
|
exports.CustomComponentSchema = CustomComponentSchema;
|
|
1440
|
-
exports.
|
|
1420
|
+
exports.CustomHooksSchema = CustomHooksSchema;
|
|
1441
1421
|
exports.DEFAULT_ESLINT_REACT_SETTINGS = DEFAULT_ESLINT_REACT_SETTINGS;
|
|
1442
1422
|
exports.DOM_HTML_COMPONENT_TYPES = DOM_HTML_COMPONENT_TYPES;
|
|
1443
1423
|
exports.DOM_SVG_COMPONENT_TYPES = DOM_SVG_COMPONENT_TYPES;
|
|
@@ -1458,5 +1438,5 @@ exports.decodeSettings = decodeSettings;
|
|
|
1458
1438
|
exports.defineSettings = defineSettings;
|
|
1459
1439
|
exports.getReactVersion = getReactVersion;
|
|
1460
1440
|
exports.getSettingsFromContext = getSettingsFromContext;
|
|
1461
|
-
exports.
|
|
1441
|
+
exports.toNormalizedSettings = toNormalizedSettings;
|
|
1462
1442
|
exports.unsafeDecodeSettings = unsafeDecodeSettings;
|
package/dist/index.mjs
CHANGED
|
@@ -222,7 +222,7 @@ function getReactVersion(fallback = "19.0.0") {
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
// ../../node_modules/.pnpm/valibot@1.0.0-beta.
|
|
225
|
+
// ../../node_modules/.pnpm/valibot@1.0.0-beta.12_typescript@5.7.3/node_modules/valibot/dist/index.js
|
|
226
226
|
var store;
|
|
227
227
|
// @__NO_SIDE_EFFECTS__
|
|
228
228
|
function getGlobalConfig(config2) {
|
|
@@ -409,29 +409,6 @@ function boolean(message) {
|
|
|
409
409
|
};
|
|
410
410
|
}
|
|
411
411
|
// @__NO_SIDE_EFFECTS__
|
|
412
|
-
function instance(class_, message) {
|
|
413
|
-
return {
|
|
414
|
-
kind: "schema",
|
|
415
|
-
type: "instance",
|
|
416
|
-
reference: instance,
|
|
417
|
-
expects: class_.name,
|
|
418
|
-
async: false,
|
|
419
|
-
class: class_,
|
|
420
|
-
message,
|
|
421
|
-
get "~standard"() {
|
|
422
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
423
|
-
},
|
|
424
|
-
"~run"(dataset, config2) {
|
|
425
|
-
if (dataset.value instanceof this.class) {
|
|
426
|
-
dataset.typed = true;
|
|
427
|
-
} else {
|
|
428
|
-
_addIssue(this, "type", dataset, config2);
|
|
429
|
-
}
|
|
430
|
-
return dataset;
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
// @__NO_SIDE_EFFECTS__
|
|
435
412
|
function object(entries, message) {
|
|
436
413
|
return {
|
|
437
414
|
kind: "schema",
|
|
@@ -539,7 +516,6 @@ function string(message) {
|
|
|
539
516
|
}
|
|
540
517
|
};
|
|
541
518
|
}
|
|
542
|
-
// @__NO_SIDE_EFFECTS__
|
|
543
519
|
function parse(schema, input, config2) {
|
|
544
520
|
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
|
|
545
521
|
if (dataset.issues) {
|
|
@@ -549,30 +525,27 @@ function parse(schema, input, config2) {
|
|
|
549
525
|
}
|
|
550
526
|
|
|
551
527
|
// src/schemas.ts
|
|
552
|
-
var
|
|
553
|
-
// TODO: Define the schema for custom Hooks
|
|
554
|
-
});
|
|
555
|
-
var CustomAttributeSchema = object({
|
|
528
|
+
var CustomComponentPropSchema = object({
|
|
556
529
|
/**
|
|
557
|
-
* The name of the
|
|
530
|
+
* The name of the prop in the user-defined component.
|
|
558
531
|
* @example
|
|
559
532
|
* "to"
|
|
560
533
|
*/
|
|
561
534
|
name: string(),
|
|
562
535
|
/**
|
|
563
|
-
* The name of the
|
|
536
|
+
* The name of the prop in the built-in component.
|
|
564
537
|
* @example
|
|
565
538
|
* "href"
|
|
566
539
|
*/
|
|
567
540
|
as: optional(string()),
|
|
568
541
|
/**
|
|
569
|
-
* Whether the
|
|
542
|
+
* Whether the prop is controlled or not in the user-defined component.
|
|
570
543
|
* @example
|
|
571
544
|
* `true`
|
|
572
545
|
*/
|
|
573
546
|
controlled: optional(boolean()),
|
|
574
547
|
/**
|
|
575
|
-
* The default value of the
|
|
548
|
+
* The default value of the prop in the user-defined component.
|
|
576
549
|
* @example
|
|
577
550
|
* `"/"`
|
|
578
551
|
*/
|
|
@@ -587,6 +560,7 @@ var CustomComponentSchema = object({
|
|
|
587
560
|
name: string(),
|
|
588
561
|
/**
|
|
589
562
|
* The ESQuery selector to select the component precisely.
|
|
563
|
+
* @internal
|
|
590
564
|
* @example
|
|
591
565
|
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
592
566
|
*/
|
|
@@ -598,18 +572,32 @@ var CustomComponentSchema = object({
|
|
|
598
572
|
*/
|
|
599
573
|
as: optional(string()),
|
|
600
574
|
/**
|
|
601
|
-
*
|
|
575
|
+
* Attributes mapping between the user-defined component and the built-in component.
|
|
602
576
|
* @example
|
|
603
577
|
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
604
578
|
*/
|
|
605
|
-
attributes: optional(array(
|
|
579
|
+
attributes: optional(array(CustomComponentPropSchema))
|
|
606
580
|
});
|
|
607
|
-
var
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
581
|
+
var CustomHooksSchema = object({
|
|
582
|
+
use: optional(array(string())),
|
|
583
|
+
useActionState: optional(array(string())),
|
|
584
|
+
useCallback: optional(array(string())),
|
|
585
|
+
useContext: optional(array(string())),
|
|
586
|
+
useDebugValue: optional(array(string())),
|
|
587
|
+
useDeferredValue: optional(array(string())),
|
|
588
|
+
useEffect: optional(array(string())),
|
|
589
|
+
useFormStatus: optional(array(string())),
|
|
590
|
+
useId: optional(array(string())),
|
|
591
|
+
useImperativeHandle: optional(array(string())),
|
|
592
|
+
useInsertionEffect: optional(array(string())),
|
|
593
|
+
useLayoutEffect: optional(array(string())),
|
|
594
|
+
useMemo: optional(array(string())),
|
|
595
|
+
useOptimistic: optional(array(string())),
|
|
596
|
+
useReducer: optional(array(string())),
|
|
597
|
+
useRef: optional(array(string())),
|
|
598
|
+
useState: optional(array(string())),
|
|
599
|
+
useSyncExternalStore: optional(array(string())),
|
|
600
|
+
useTransition: optional(array(string()))
|
|
613
601
|
});
|
|
614
602
|
var ESLintReactSettingsSchema = object({
|
|
615
603
|
/**
|
|
@@ -618,41 +606,41 @@ var ESLintReactSettingsSchema = object({
|
|
|
618
606
|
* @default `"react"`
|
|
619
607
|
* @example `"@pika/react"`
|
|
620
608
|
*/
|
|
621
|
-
importSource: optional(string()),
|
|
609
|
+
importSource: optional(string(), "react"),
|
|
622
610
|
/**
|
|
623
611
|
* The identifier that’s used for JSX Element creation.
|
|
624
612
|
* @default `"createElement"`
|
|
625
613
|
* @deprecated
|
|
626
614
|
*/
|
|
627
|
-
jsxPragma: optional(string()),
|
|
615
|
+
jsxPragma: optional(string(), "createElement"),
|
|
628
616
|
/**
|
|
629
617
|
* The identifier that’s used for JSX fragment elements.
|
|
630
618
|
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
631
619
|
* @default `"Fragment"`
|
|
632
620
|
* @deprecated
|
|
633
621
|
*/
|
|
634
|
-
jsxPragmaFrag: optional(string()),
|
|
622
|
+
jsxPragmaFrag: optional(string(), "Fragment"),
|
|
635
623
|
/**
|
|
636
624
|
* The name of the prop that is used for polymorphic components.
|
|
637
625
|
* @description This is used to determine the type of the component.
|
|
638
626
|
* @example `"as"`
|
|
639
627
|
*/
|
|
640
|
-
polymorphicPropName: optional(string()),
|
|
628
|
+
polymorphicPropName: optional(string(), "as"),
|
|
641
629
|
/**
|
|
642
630
|
* @internal
|
|
643
631
|
*/
|
|
644
|
-
strict: optional(boolean()),
|
|
632
|
+
strict: optional(boolean(), false),
|
|
645
633
|
/**
|
|
646
634
|
* @internal
|
|
647
635
|
*/
|
|
648
|
-
strictImportCheck: optional(boolean()),
|
|
636
|
+
strictImportCheck: optional(boolean(), false),
|
|
649
637
|
/**
|
|
650
638
|
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
651
639
|
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
652
640
|
* @example `"18.3.1"`
|
|
653
641
|
* @default `"detect"`
|
|
654
642
|
*/
|
|
655
|
-
version: optional(string()),
|
|
643
|
+
version: optional(string(), "detect"),
|
|
656
644
|
/**
|
|
657
645
|
* An array of user-defined components
|
|
658
646
|
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
@@ -660,31 +648,11 @@ var ESLintReactSettingsSchema = object({
|
|
|
660
648
|
*/
|
|
661
649
|
additionalComponents: optional(array(CustomComponentSchema)),
|
|
662
650
|
/**
|
|
663
|
-
* A object
|
|
651
|
+
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
664
652
|
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
665
653
|
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
666
654
|
*/
|
|
667
|
-
additionalHooks: optional(
|
|
668
|
-
use: optional(array(string())),
|
|
669
|
-
useActionState: optional(array(string())),
|
|
670
|
-
useCallback: optional(array(string())),
|
|
671
|
-
useContext: optional(array(string())),
|
|
672
|
-
useDebugValue: optional(array(string())),
|
|
673
|
-
useDeferredValue: optional(array(string())),
|
|
674
|
-
useEffect: optional(array(string())),
|
|
675
|
-
useFormStatus: optional(array(string())),
|
|
676
|
-
useId: optional(array(string())),
|
|
677
|
-
useImperativeHandle: optional(array(string())),
|
|
678
|
-
useInsertionEffect: optional(array(string())),
|
|
679
|
-
useLayoutEffect: optional(array(string())),
|
|
680
|
-
useMemo: optional(array(string())),
|
|
681
|
-
useOptimistic: optional(array(string())),
|
|
682
|
-
useReducer: optional(array(string())),
|
|
683
|
-
useRef: optional(array(string())),
|
|
684
|
-
useState: optional(array(string())),
|
|
685
|
-
useSyncExternalStore: optional(array(string())),
|
|
686
|
-
useTransition: optional(array(string()))
|
|
687
|
-
}))
|
|
655
|
+
additionalHooks: optional(CustomHooksSchema)
|
|
688
656
|
});
|
|
689
657
|
var ESLintSettingsSchema = optional(
|
|
690
658
|
object({
|
|
@@ -694,6 +662,12 @@ var ESLintSettingsSchema = optional(
|
|
|
694
662
|
}),
|
|
695
663
|
{}
|
|
696
664
|
);
|
|
665
|
+
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
666
|
+
...parse(ESLintReactSettingsSchema, {}),
|
|
667
|
+
additionalHooks: {
|
|
668
|
+
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
669
|
+
}
|
|
670
|
+
};
|
|
697
671
|
|
|
698
672
|
// ../../node_modules/.pnpm/fast-equals@5.2.2/node_modules/fast-equals/dist/esm/index.mjs
|
|
699
673
|
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
@@ -1388,14 +1362,6 @@ function createMemoizedFunction(fn, options) {
|
|
|
1388
1362
|
memoized.options = normalizedOptions;
|
|
1389
1363
|
return memoized;
|
|
1390
1364
|
}
|
|
1391
|
-
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
1392
|
-
additionalHooks: {
|
|
1393
|
-
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
1394
|
-
},
|
|
1395
|
-
polymorphicPropName: "as",
|
|
1396
|
-
strictImportCheck: false,
|
|
1397
|
-
version: "detect"
|
|
1398
|
-
};
|
|
1399
1365
|
function unsafeDecodeSettings(data) {
|
|
1400
1366
|
return data?.["react-x"] ?? {};
|
|
1401
1367
|
}
|
|
@@ -1405,25 +1371,40 @@ var decodeSettings = createMemoizedFunction((data) => {
|
|
|
1405
1371
|
...parse(ESLintSettingsSchema, data)["react-x"] ?? {}
|
|
1406
1372
|
};
|
|
1407
1373
|
}, { isEqual: (a, b) => a === b });
|
|
1408
|
-
var
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1374
|
+
var toNormalizedSettings = createMemoizedFunction(
|
|
1375
|
+
({
|
|
1376
|
+
additionalComponents = [],
|
|
1377
|
+
additionalHooks = {},
|
|
1378
|
+
version,
|
|
1379
|
+
...rest
|
|
1380
|
+
}) => {
|
|
1381
|
+
return {
|
|
1382
|
+
...rest,
|
|
1383
|
+
additionalComponents: additionalComponents.map(({
|
|
1384
|
+
name,
|
|
1385
|
+
as = name,
|
|
1386
|
+
attributes = [],
|
|
1387
|
+
...rest2
|
|
1388
|
+
}) => ({
|
|
1389
|
+
...rest2,
|
|
1390
|
+
name,
|
|
1391
|
+
as,
|
|
1392
|
+
attributes: attributes.map(({ name: name2, as: as2 = name2, ...rest3 }) => ({
|
|
1393
|
+
...rest3,
|
|
1394
|
+
name: name2,
|
|
1395
|
+
as: as2
|
|
1396
|
+
})),
|
|
1397
|
+
re: pm.makeRe(name, { fastpaths: true })
|
|
1398
|
+
})),
|
|
1399
|
+
additionalHooks,
|
|
1400
|
+
version: match(version).with(P.union(P.nullish, "", "detect"), () => getReactVersion("19.0.0")).otherwise(identity)
|
|
1401
|
+
};
|
|
1402
|
+
},
|
|
1403
|
+
{ isEqual: shallowEqual }
|
|
1404
|
+
);
|
|
1424
1405
|
function getSettingsFromContext(context) {
|
|
1425
|
-
return
|
|
1406
|
+
return toNormalizedSettings(decodeSettings(context.settings));
|
|
1426
1407
|
}
|
|
1427
1408
|
var defineSettings = identity;
|
|
1428
1409
|
|
|
1429
|
-
export {
|
|
1410
|
+
export { CustomComponentPropSchema, CustomComponentSchema, CustomHooksSchema, DEFAULT_ESLINT_REACT_SETTINGS, DOM_HTML_COMPONENT_TYPES, DOM_SVG_COMPONENT_TYPES, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, getReactVersion, getSettingsFromContext, toNormalizedSettings, unsafeDecodeSettings };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "1.24.0-next.
|
|
3
|
+
"version": "1.24.0-next.12",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"./package.json"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@typescript-eslint/utils": "^8.
|
|
36
|
+
"@typescript-eslint/utils": "^8.20.0",
|
|
37
37
|
"picomatch": "^4.0.2",
|
|
38
38
|
"ts-pattern": "^5.6.0",
|
|
39
|
-
"@eslint-react/eff": "1.24.0-next.
|
|
39
|
+
"@eslint-react/eff": "1.24.0-next.12"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/picomatch": "^3.0.1",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"micro-memoize": "^4.1.3",
|
|
45
45
|
"tsup": "^8.3.5",
|
|
46
46
|
"type-fest": "^4.32.0",
|
|
47
|
-
"valibot": "^1.0.0-beta.
|
|
47
|
+
"valibot": "^1.0.0-beta.12",
|
|
48
48
|
"@workspace/configs": "0.0.0"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|