@eslint-react/shared 1.24.0-next.8 → 1.24.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.js CHANGED
@@ -221,6 +221,10 @@ var getDocsUrl = (pluginName) => (ruleName) => {
221
221
  return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
222
222
  };
223
223
  var createRuleForPlugin = (pluginName) => utils.ESLintUtils.RuleCreator(getDocsUrl(pluginName));
224
+
225
+ // src/get-id.ts
226
+ var id = 0n;
227
+ var getId = () => (id++).toString();
224
228
  var _require = module__default.default.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
225
229
  function getReactVersion(fallback = "19.0.0") {
226
230
  try {
@@ -230,7 +234,7 @@ function getReactVersion(fallback = "19.0.0") {
230
234
  }
231
235
  }
232
236
 
233
- // ../../node_modules/.pnpm/valibot@1.0.0-beta.11_typescript@5.7.3/node_modules/valibot/dist/index.js
237
+ // ../../node_modules/.pnpm/valibot@1.0.0-beta.12_typescript@5.7.3/node_modules/valibot/dist/index.js
234
238
  var store;
235
239
  // @__NO_SIDE_EFFECTS__
236
240
  function getGlobalConfig(config2) {
@@ -417,29 +421,6 @@ function boolean(message) {
417
421
  };
418
422
  }
419
423
  // @__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
424
  function object(entries, message) {
444
425
  return {
445
426
  kind: "schema",
@@ -547,7 +528,6 @@ function string(message) {
547
528
  }
548
529
  };
549
530
  }
550
- // @__NO_SIDE_EFFECTS__
551
531
  function parse(schema, input, config2) {
552
532
  const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
553
533
  if (dataset.issues) {
@@ -557,30 +537,27 @@ function parse(schema, input, config2) {
557
537
  }
558
538
 
559
539
  // src/schemas.ts
560
- var CustomHookSchema = object({
561
- // TODO: Define the schema for custom Hooks
562
- });
563
- var CustomAttributeSchema = object({
540
+ var CustomComponentPropSchema = object({
564
541
  /**
565
- * The name of the attribute in the user-defined component.
542
+ * The name of the prop in the user-defined component.
566
543
  * @example
567
544
  * "to"
568
545
  */
569
546
  name: string(),
570
547
  /**
571
- * The name of the attribute in the built-in component.
548
+ * The name of the prop in the built-in component.
572
549
  * @example
573
550
  * "href"
574
551
  */
575
552
  as: optional(string()),
576
553
  /**
577
- * Whether the attribute is controlled or not in the user-defined component.
554
+ * Whether the prop is controlled or not in the user-defined component.
578
555
  * @example
579
556
  * `true`
580
557
  */
581
558
  controlled: optional(boolean()),
582
559
  /**
583
- * The default value of the attribute in the user-defined component.
560
+ * The default value of the prop in the user-defined component.
584
561
  * @example
585
562
  * `"/"`
586
563
  */
@@ -593,12 +570,6 @@ var CustomComponentSchema = object({
593
570
  * "Link"
594
571
  */
595
572
  name: string(),
596
- /**
597
- * The ESQuery selector to select the component precisely.
598
- * @example
599
- * `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
600
- */
601
- selector: optional(string()),
602
573
  /**
603
574
  * The name of the built-in component that the user-defined component represents.
604
575
  * @example
@@ -606,25 +577,40 @@ var CustomComponentSchema = object({
606
577
  */
607
578
  as: optional(string()),
608
579
  /**
609
- * Pre-defined attributes that are used in the user-defined component.
580
+ * Attributes mapping between the user-defined component and the built-in component.
610
581
  * @example
611
582
  * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
612
583
  */
613
- attributes: optional(array(CustomAttributeSchema))
614
- });
615
- var CustomAttributeNormalizedSchema = object({
616
- name: string(),
617
- as: string(),
618
- controlled: optional(boolean()),
619
- defaultValue: optional(string())
620
- });
621
- var CustomComponentNormalizedSchema = object({
622
- name: string(),
623
- as: string(),
624
- attributes: optional(array(CustomAttributeNormalizedSchema), []),
625
- re: instance(RegExp),
584
+ attributes: optional(array(CustomComponentPropSchema)),
585
+ /**
586
+ * The ESQuery selector to select the component precisely.
587
+ * @internal
588
+ * @example
589
+ * `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
590
+ */
626
591
  selector: optional(string())
627
592
  });
593
+ var CustomHooksSchema = object({
594
+ use: optional(array(string())),
595
+ useActionState: optional(array(string())),
596
+ useCallback: optional(array(string())),
597
+ useContext: optional(array(string())),
598
+ useDebugValue: optional(array(string())),
599
+ useDeferredValue: optional(array(string())),
600
+ useEffect: optional(array(string())),
601
+ useFormStatus: optional(array(string())),
602
+ useId: optional(array(string())),
603
+ useImperativeHandle: optional(array(string())),
604
+ useInsertionEffect: optional(array(string())),
605
+ useLayoutEffect: optional(array(string())),
606
+ useMemo: optional(array(string())),
607
+ useOptimistic: optional(array(string())),
608
+ useReducer: optional(array(string())),
609
+ useRef: optional(array(string())),
610
+ useState: optional(array(string())),
611
+ useSyncExternalStore: optional(array(string())),
612
+ useTransition: optional(array(string()))
613
+ });
628
614
  var ESLintReactSettingsSchema = object({
629
615
  /**
630
616
  * The source where React is imported from.
@@ -655,11 +641,11 @@ var ESLintReactSettingsSchema = object({
655
641
  /**
656
642
  * @internal
657
643
  */
658
- strict: optional(boolean()),
644
+ strict: optional(boolean(), false),
659
645
  /**
660
646
  * @internal
661
647
  */
662
- strictImportCheck: optional(boolean()),
648
+ strictImportCheck: optional(boolean(), false),
663
649
  /**
664
650
  * React version to use, "detect" means auto detect React version from the project’s dependencies.
665
651
  * If `importSource` is specified, an equivalent version of React should be provided here.
@@ -667,38 +653,18 @@ var ESLintReactSettingsSchema = object({
667
653
  * @default `"detect"`
668
654
  */
669
655
  version: optional(string()),
656
+ /**
657
+ * A object to define additional hooks that are equivalent to the built-in React Hooks.
658
+ * @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
659
+ * @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
660
+ */
661
+ additionalHooks: optional(CustomHooksSchema),
670
662
  /**
671
663
  * An array of user-defined components
672
664
  * @description This is used to inform the ESLint React plugins how to treat these components during checks.
673
665
  * @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
674
666
  */
675
- additionalComponents: optional(array(CustomComponentSchema)),
676
- /**
677
- * A object of aliases for React built-in hooks.
678
- * @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
679
- * @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
680
- */
681
- additionalHooks: optional(object({
682
- use: optional(array(string())),
683
- useActionState: optional(array(string())),
684
- useCallback: optional(array(string())),
685
- useContext: optional(array(string())),
686
- useDebugValue: optional(array(string())),
687
- useDeferredValue: optional(array(string())),
688
- useEffect: optional(array(string())),
689
- useFormStatus: optional(array(string())),
690
- useId: optional(array(string())),
691
- useImperativeHandle: optional(array(string())),
692
- useInsertionEffect: optional(array(string())),
693
- useLayoutEffect: optional(array(string())),
694
- useMemo: optional(array(string())),
695
- useOptimistic: optional(array(string())),
696
- useReducer: optional(array(string())),
697
- useRef: optional(array(string())),
698
- useState: optional(array(string())),
699
- useSyncExternalStore: optional(array(string())),
700
- useTransition: optional(array(string()))
701
- }))
667
+ additionalComponents: optional(array(CustomComponentSchema))
702
668
  });
703
669
  var ESLintSettingsSchema = optional(
704
670
  object({
@@ -709,12 +675,17 @@ var ESLintSettingsSchema = optional(
709
675
  {}
710
676
  );
711
677
  var DEFAULT_ESLINT_REACT_SETTINGS = {
712
- additionalHooks: {
713
- useLayoutEffect: ["useIsomorphicLayoutEffect"]
714
- },
678
+ ...parse(ESLintReactSettingsSchema, {}),
679
+ importSource: "react",
680
+ jsxPragma: "createElement",
681
+ jsxPragmaFrag: "Fragment",
715
682
  polymorphicPropName: "as",
683
+ strict: false,
716
684
  strictImportCheck: false,
717
- version: "detect"
685
+ version: "detect",
686
+ additionalHooks: {
687
+ useLayoutEffect: ["useIsomorphicLayoutEffect"]
688
+ }
718
689
  };
719
690
 
720
691
  // ../../node_modules/.pnpm/fast-equals@5.2.2/node_modules/fast-equals/dist/esm/index.mjs
@@ -1419,32 +1390,49 @@ var decodeSettings = createMemoizedFunction((data) => {
1419
1390
  ...parse(ESLintSettingsSchema, data)["react-x"] ?? {}
1420
1391
  };
1421
1392
  }, { isEqual: (a, b) => a === b });
1422
- var normalizeSettings = createMemoizedFunction((settings) => {
1423
- const additionalComponents = settings.additionalComponents ?? [];
1424
- return {
1425
- ...settings,
1426
- additionalComponents: additionalComponents.map((component) => ({
1427
- ...component,
1428
- as: component.as ?? component.name,
1429
- attributes: component.attributes?.map((attr) => ({
1430
- ...attr,
1431
- as: attr.as ?? attr.name
1432
- })) ?? [],
1433
- re: pm__default.default.makeRe(component.name, { fastpaths: true })
1434
- })),
1435
- version: tsPattern.match(settings.version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () => getReactVersion("19.0.0")).otherwise(eff.identity)
1436
- };
1437
- }, { isEqual: shallowEqual });
1393
+ var toNormalizedSettings = createMemoizedFunction(
1394
+ ({
1395
+ additionalComponents = [],
1396
+ additionalHooks = {},
1397
+ importSource = "react",
1398
+ polymorphicPropName = "as",
1399
+ version,
1400
+ ...rest
1401
+ }) => {
1402
+ return {
1403
+ ...rest,
1404
+ additionalComponents: additionalComponents.map(({
1405
+ name,
1406
+ as = name,
1407
+ attributes = [],
1408
+ ...rest2
1409
+ }) => ({
1410
+ ...rest2,
1411
+ name,
1412
+ as,
1413
+ attributes: attributes.map(({ name: name2, as: as2 = name2, ...rest3 }) => ({
1414
+ ...rest3,
1415
+ name: name2,
1416
+ as: as2
1417
+ })),
1418
+ re: pm__default.default.makeRe(name, { fastpaths: true })
1419
+ })),
1420
+ additionalHooks,
1421
+ importSource,
1422
+ polymorphicPropName,
1423
+ version: tsPattern.match(version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () => getReactVersion("19.0.0")).otherwise(eff.identity)
1424
+ };
1425
+ },
1426
+ { isEqual: shallowEqual }
1427
+ );
1438
1428
  function getSettingsFromContext(context) {
1439
- return normalizeSettings(decodeSettings(context.settings));
1429
+ return toNormalizedSettings(decodeSettings(context.settings));
1440
1430
  }
1441
1431
  var defineSettings = eff.identity;
1442
1432
 
1443
- exports.CustomAttributeNormalizedSchema = CustomAttributeNormalizedSchema;
1444
- exports.CustomAttributeSchema = CustomAttributeSchema;
1445
- exports.CustomComponentNormalizedSchema = CustomComponentNormalizedSchema;
1433
+ exports.CustomComponentPropSchema = CustomComponentPropSchema;
1446
1434
  exports.CustomComponentSchema = CustomComponentSchema;
1447
- exports.CustomHookSchema = CustomHookSchema;
1435
+ exports.CustomHooksSchema = CustomHooksSchema;
1448
1436
  exports.DEFAULT_ESLINT_REACT_SETTINGS = DEFAULT_ESLINT_REACT_SETTINGS;
1449
1437
  exports.DOM_HTML_COMPONENT_TYPES = DOM_HTML_COMPONENT_TYPES;
1450
1438
  exports.DOM_SVG_COMPONENT_TYPES = DOM_SVG_COMPONENT_TYPES;
@@ -1463,7 +1451,8 @@ exports.WEBSITE_URL = WEBSITE_URL;
1463
1451
  exports.createRuleForPlugin = createRuleForPlugin;
1464
1452
  exports.decodeSettings = decodeSettings;
1465
1453
  exports.defineSettings = defineSettings;
1454
+ exports.getId = getId;
1466
1455
  exports.getReactVersion = getReactVersion;
1467
1456
  exports.getSettingsFromContext = getSettingsFromContext;
1468
- exports.normalizeSettings = normalizeSettings;
1457
+ exports.toNormalizedSettings = toNormalizedSettings;
1469
1458
  exports.unsafeDecodeSettings = unsafeDecodeSettings;
package/dist/index.mjs CHANGED
@@ -213,6 +213,10 @@ var getDocsUrl = (pluginName) => (ruleName) => {
213
213
  return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
214
214
  };
215
215
  var createRuleForPlugin = (pluginName) => ESLintUtils.RuleCreator(getDocsUrl(pluginName));
216
+
217
+ // src/get-id.ts
218
+ var id = 0n;
219
+ var getId = () => (id++).toString();
216
220
  var _require = module.createRequire(import.meta.url);
217
221
  function getReactVersion(fallback = "19.0.0") {
218
222
  try {
@@ -222,7 +226,7 @@ function getReactVersion(fallback = "19.0.0") {
222
226
  }
223
227
  }
224
228
 
225
- // ../../node_modules/.pnpm/valibot@1.0.0-beta.11_typescript@5.7.3/node_modules/valibot/dist/index.js
229
+ // ../../node_modules/.pnpm/valibot@1.0.0-beta.12_typescript@5.7.3/node_modules/valibot/dist/index.js
226
230
  var store;
227
231
  // @__NO_SIDE_EFFECTS__
228
232
  function getGlobalConfig(config2) {
@@ -409,29 +413,6 @@ function boolean(message) {
409
413
  };
410
414
  }
411
415
  // @__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
416
  function object(entries, message) {
436
417
  return {
437
418
  kind: "schema",
@@ -539,7 +520,6 @@ function string(message) {
539
520
  }
540
521
  };
541
522
  }
542
- // @__NO_SIDE_EFFECTS__
543
523
  function parse(schema, input, config2) {
544
524
  const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
545
525
  if (dataset.issues) {
@@ -549,30 +529,27 @@ function parse(schema, input, config2) {
549
529
  }
550
530
 
551
531
  // src/schemas.ts
552
- var CustomHookSchema = object({
553
- // TODO: Define the schema for custom Hooks
554
- });
555
- var CustomAttributeSchema = object({
532
+ var CustomComponentPropSchema = object({
556
533
  /**
557
- * The name of the attribute in the user-defined component.
534
+ * The name of the prop in the user-defined component.
558
535
  * @example
559
536
  * "to"
560
537
  */
561
538
  name: string(),
562
539
  /**
563
- * The name of the attribute in the built-in component.
540
+ * The name of the prop in the built-in component.
564
541
  * @example
565
542
  * "href"
566
543
  */
567
544
  as: optional(string()),
568
545
  /**
569
- * Whether the attribute is controlled or not in the user-defined component.
546
+ * Whether the prop is controlled or not in the user-defined component.
570
547
  * @example
571
548
  * `true`
572
549
  */
573
550
  controlled: optional(boolean()),
574
551
  /**
575
- * The default value of the attribute in the user-defined component.
552
+ * The default value of the prop in the user-defined component.
576
553
  * @example
577
554
  * `"/"`
578
555
  */
@@ -585,12 +562,6 @@ var CustomComponentSchema = object({
585
562
  * "Link"
586
563
  */
587
564
  name: string(),
588
- /**
589
- * The ESQuery selector to select the component precisely.
590
- * @example
591
- * `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
592
- */
593
- selector: optional(string()),
594
565
  /**
595
566
  * The name of the built-in component that the user-defined component represents.
596
567
  * @example
@@ -598,25 +569,40 @@ var CustomComponentSchema = object({
598
569
  */
599
570
  as: optional(string()),
600
571
  /**
601
- * Pre-defined attributes that are used in the user-defined component.
572
+ * Attributes mapping between the user-defined component and the built-in component.
602
573
  * @example
603
574
  * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
604
575
  */
605
- attributes: optional(array(CustomAttributeSchema))
606
- });
607
- var CustomAttributeNormalizedSchema = object({
608
- name: string(),
609
- as: string(),
610
- controlled: optional(boolean()),
611
- defaultValue: optional(string())
612
- });
613
- var CustomComponentNormalizedSchema = object({
614
- name: string(),
615
- as: string(),
616
- attributes: optional(array(CustomAttributeNormalizedSchema), []),
617
- re: instance(RegExp),
576
+ attributes: optional(array(CustomComponentPropSchema)),
577
+ /**
578
+ * The ESQuery selector to select the component precisely.
579
+ * @internal
580
+ * @example
581
+ * `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
582
+ */
618
583
  selector: optional(string())
619
584
  });
585
+ var CustomHooksSchema = object({
586
+ use: optional(array(string())),
587
+ useActionState: optional(array(string())),
588
+ useCallback: optional(array(string())),
589
+ useContext: optional(array(string())),
590
+ useDebugValue: optional(array(string())),
591
+ useDeferredValue: optional(array(string())),
592
+ useEffect: optional(array(string())),
593
+ useFormStatus: optional(array(string())),
594
+ useId: optional(array(string())),
595
+ useImperativeHandle: optional(array(string())),
596
+ useInsertionEffect: optional(array(string())),
597
+ useLayoutEffect: optional(array(string())),
598
+ useMemo: optional(array(string())),
599
+ useOptimistic: optional(array(string())),
600
+ useReducer: optional(array(string())),
601
+ useRef: optional(array(string())),
602
+ useState: optional(array(string())),
603
+ useSyncExternalStore: optional(array(string())),
604
+ useTransition: optional(array(string()))
605
+ });
620
606
  var ESLintReactSettingsSchema = object({
621
607
  /**
622
608
  * The source where React is imported from.
@@ -647,11 +633,11 @@ var ESLintReactSettingsSchema = object({
647
633
  /**
648
634
  * @internal
649
635
  */
650
- strict: optional(boolean()),
636
+ strict: optional(boolean(), false),
651
637
  /**
652
638
  * @internal
653
639
  */
654
- strictImportCheck: optional(boolean()),
640
+ strictImportCheck: optional(boolean(), false),
655
641
  /**
656
642
  * React version to use, "detect" means auto detect React version from the project’s dependencies.
657
643
  * If `importSource` is specified, an equivalent version of React should be provided here.
@@ -659,38 +645,18 @@ var ESLintReactSettingsSchema = object({
659
645
  * @default `"detect"`
660
646
  */
661
647
  version: optional(string()),
648
+ /**
649
+ * A object to define additional hooks that are equivalent to the built-in React Hooks.
650
+ * @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
651
+ * @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
652
+ */
653
+ additionalHooks: optional(CustomHooksSchema),
662
654
  /**
663
655
  * An array of user-defined components
664
656
  * @description This is used to inform the ESLint React plugins how to treat these components during checks.
665
657
  * @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
666
658
  */
667
- additionalComponents: optional(array(CustomComponentSchema)),
668
- /**
669
- * A object of aliases for React built-in hooks.
670
- * @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
671
- * @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
672
- */
673
- additionalHooks: optional(object({
674
- use: optional(array(string())),
675
- useActionState: optional(array(string())),
676
- useCallback: optional(array(string())),
677
- useContext: optional(array(string())),
678
- useDebugValue: optional(array(string())),
679
- useDeferredValue: optional(array(string())),
680
- useEffect: optional(array(string())),
681
- useFormStatus: optional(array(string())),
682
- useId: optional(array(string())),
683
- useImperativeHandle: optional(array(string())),
684
- useInsertionEffect: optional(array(string())),
685
- useLayoutEffect: optional(array(string())),
686
- useMemo: optional(array(string())),
687
- useOptimistic: optional(array(string())),
688
- useReducer: optional(array(string())),
689
- useRef: optional(array(string())),
690
- useState: optional(array(string())),
691
- useSyncExternalStore: optional(array(string())),
692
- useTransition: optional(array(string()))
693
- }))
659
+ additionalComponents: optional(array(CustomComponentSchema))
694
660
  });
695
661
  var ESLintSettingsSchema = optional(
696
662
  object({
@@ -701,12 +667,17 @@ var ESLintSettingsSchema = optional(
701
667
  {}
702
668
  );
703
669
  var DEFAULT_ESLINT_REACT_SETTINGS = {
704
- additionalHooks: {
705
- useLayoutEffect: ["useIsomorphicLayoutEffect"]
706
- },
670
+ ...parse(ESLintReactSettingsSchema, {}),
671
+ importSource: "react",
672
+ jsxPragma: "createElement",
673
+ jsxPragmaFrag: "Fragment",
707
674
  polymorphicPropName: "as",
675
+ strict: false,
708
676
  strictImportCheck: false,
709
- version: "detect"
677
+ version: "detect",
678
+ additionalHooks: {
679
+ useLayoutEffect: ["useIsomorphicLayoutEffect"]
680
+ }
710
681
  };
711
682
 
712
683
  // ../../node_modules/.pnpm/fast-equals@5.2.2/node_modules/fast-equals/dist/esm/index.mjs
@@ -1411,25 +1382,44 @@ var decodeSettings = createMemoizedFunction((data) => {
1411
1382
  ...parse(ESLintSettingsSchema, data)["react-x"] ?? {}
1412
1383
  };
1413
1384
  }, { isEqual: (a, b) => a === b });
1414
- var normalizeSettings = createMemoizedFunction((settings) => {
1415
- const additionalComponents = settings.additionalComponents ?? [];
1416
- return {
1417
- ...settings,
1418
- additionalComponents: additionalComponents.map((component) => ({
1419
- ...component,
1420
- as: component.as ?? component.name,
1421
- attributes: component.attributes?.map((attr) => ({
1422
- ...attr,
1423
- as: attr.as ?? attr.name
1424
- })) ?? [],
1425
- re: pm.makeRe(component.name, { fastpaths: true })
1426
- })),
1427
- version: match(settings.version).with(P.union(P.nullish, "", "detect"), () => getReactVersion("19.0.0")).otherwise(identity)
1428
- };
1429
- }, { isEqual: shallowEqual });
1385
+ var toNormalizedSettings = createMemoizedFunction(
1386
+ ({
1387
+ additionalComponents = [],
1388
+ additionalHooks = {},
1389
+ importSource = "react",
1390
+ polymorphicPropName = "as",
1391
+ version,
1392
+ ...rest
1393
+ }) => {
1394
+ return {
1395
+ ...rest,
1396
+ additionalComponents: additionalComponents.map(({
1397
+ name,
1398
+ as = name,
1399
+ attributes = [],
1400
+ ...rest2
1401
+ }) => ({
1402
+ ...rest2,
1403
+ name,
1404
+ as,
1405
+ attributes: attributes.map(({ name: name2, as: as2 = name2, ...rest3 }) => ({
1406
+ ...rest3,
1407
+ name: name2,
1408
+ as: as2
1409
+ })),
1410
+ re: pm.makeRe(name, { fastpaths: true })
1411
+ })),
1412
+ additionalHooks,
1413
+ importSource,
1414
+ polymorphicPropName,
1415
+ version: match(version).with(P.union(P.nullish, "", "detect"), () => getReactVersion("19.0.0")).otherwise(identity)
1416
+ };
1417
+ },
1418
+ { isEqual: shallowEqual }
1419
+ );
1430
1420
  function getSettingsFromContext(context) {
1431
- return normalizeSettings(decodeSettings(context.settings));
1421
+ return toNormalizedSettings(decodeSettings(context.settings));
1432
1422
  }
1433
1423
  var defineSettings = identity;
1434
1424
 
1435
- export { CustomAttributeNormalizedSchema, CustomAttributeSchema, CustomComponentNormalizedSchema, CustomComponentSchema, CustomHookSchema, 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, normalizeSettings, unsafeDecodeSettings };
1425
+ 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, getId, 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.8",
3
+ "version": "1.24.0",
4
4
  "description": "ESLint React's Shared constants and functions.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -35,16 +35,16 @@
35
35
  "dependencies": {
36
36
  "@typescript-eslint/utils": "^8.20.0",
37
37
  "picomatch": "^4.0.2",
38
- "ts-pattern": "^5.6.0",
39
- "@eslint-react/eff": "1.24.0-next.8"
38
+ "ts-pattern": "^5.6.1",
39
+ "@eslint-react/eff": "1.24.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/picomatch": "^3.0.1",
42
+ "@types/picomatch": "^3.0.2",
43
43
  "fast-equals": "^5.2.2",
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.11",
47
+ "valibot": "^1.0.0-beta.12",
48
48
  "@workspace/configs": "0.0.0"
49
49
  },
50
50
  "engines": {