@eslint-react/shared 2.0.0-next.1 → 2.0.0-next.109
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.ts +124 -267
- package/dist/index.js +11 -25
- package/package.json +10 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unit } from '@eslint-react/eff';
|
|
2
2
|
import { RuleContext } from '@eslint-react/kit';
|
|
3
|
-
import
|
|
3
|
+
import { z } from 'zod/v4';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
declare const getId: () => string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
declare const _require: NodeJS.Require;
|
|
4
14
|
|
|
5
15
|
/**
|
|
6
16
|
* The NPM scope for this project.
|
|
@@ -23,8 +33,6 @@ declare const WEBSITE_URL = "https://eslint-react.xyz";
|
|
|
23
33
|
*/
|
|
24
34
|
declare const getDocsUrl: (pluginName: string) => (ruleName: string) => string;
|
|
25
35
|
|
|
26
|
-
declare const getId: () => string;
|
|
27
|
-
|
|
28
36
|
declare function getReactVersion(fallback: string): string;
|
|
29
37
|
|
|
30
38
|
/**
|
|
@@ -661,27 +669,29 @@ const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true}> = {
|
|
|
661
669
|
type PartialDeep<T, Options extends PartialDeepOptions = {}> =
|
|
662
670
|
_PartialDeep<T, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;
|
|
663
671
|
|
|
664
|
-
type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((
|
|
672
|
+
type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown))
|
|
665
673
|
? T
|
|
666
|
-
: T extends
|
|
667
|
-
?
|
|
668
|
-
: T extends
|
|
669
|
-
?
|
|
670
|
-
: T extends
|
|
671
|
-
?
|
|
672
|
-
: T extends
|
|
673
|
-
?
|
|
674
|
-
: T extends
|
|
675
|
-
?
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
674
|
+
: IsNever<keyof T> extends true // For functions with no properties
|
|
675
|
+
? T
|
|
676
|
+
: T extends Map<infer KeyType, infer ValueType>
|
|
677
|
+
? PartialMapDeep<KeyType, ValueType, Options>
|
|
678
|
+
: T extends Set<infer ItemType>
|
|
679
|
+
? PartialSetDeep<ItemType, Options>
|
|
680
|
+
: T extends ReadonlyMap<infer KeyType, infer ValueType>
|
|
681
|
+
? PartialReadonlyMapDeep<KeyType, ValueType, Options>
|
|
682
|
+
: T extends ReadonlySet<infer ItemType>
|
|
683
|
+
? PartialReadonlySetDeep<ItemType, Options>
|
|
684
|
+
: T extends object
|
|
685
|
+
? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
|
|
686
|
+
? Options['recurseIntoArrays'] extends true
|
|
687
|
+
? ItemType[] extends T // Test for arrays (non-tuples) specifically
|
|
688
|
+
? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
|
|
689
|
+
? ReadonlyArray<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>>
|
|
690
|
+
: Array<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>>
|
|
691
|
+
: PartialObjectDeep<T, Options> // Tuples behave properly
|
|
692
|
+
: T // If they don't opt into array testing, just use the original type
|
|
693
|
+
: PartialObjectDeep<T, Options>
|
|
694
|
+
: unknown;
|
|
685
695
|
|
|
686
696
|
/**
|
|
687
697
|
Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
|
|
@@ -706,256 +716,105 @@ type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {
|
|
|
706
716
|
/**
|
|
707
717
|
Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
|
|
708
718
|
*/
|
|
709
|
-
type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> =
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
* @example
|
|
723
|
-
* "href"
|
|
724
|
-
*/
|
|
725
|
-
as: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
726
|
-
/**
|
|
727
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
728
|
-
* @internal
|
|
729
|
-
* @example
|
|
730
|
-
* `true`
|
|
731
|
-
*/
|
|
732
|
-
controlled: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
733
|
-
/**
|
|
734
|
-
* The default value of the prop in the user-defined component.
|
|
735
|
-
* @example
|
|
736
|
-
* `"/"`
|
|
737
|
-
*/
|
|
738
|
-
defaultValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
739
|
-
}, {}>;
|
|
719
|
+
type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> =
|
|
720
|
+
(ObjectType extends (...arguments_: any) => unknown
|
|
721
|
+
? (...arguments_: Parameters<ObjectType>) => ReturnType<ObjectType>
|
|
722
|
+
: {}) & ({
|
|
723
|
+
[KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options>
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
declare const CustomComponentPropSchema: z.ZodObject<{
|
|
727
|
+
name: z.ZodString;
|
|
728
|
+
as: z.ZodOptional<z.ZodString>;
|
|
729
|
+
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
730
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
731
|
+
}, z.core.$strip>;
|
|
740
732
|
/**
|
|
741
733
|
* @description
|
|
742
734
|
* This will provide some key information to the rule before checking for user-defined components.
|
|
743
735
|
* For example:
|
|
744
736
|
* Which prop is used as the `href` prop for the user-defined `Link` component that represents the built-in `a` element.
|
|
745
737
|
*/
|
|
746
|
-
declare const CustomComponentSchema: z.
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
779
|
-
* @internal
|
|
780
|
-
* @example
|
|
781
|
-
* `true`
|
|
782
|
-
*/
|
|
783
|
-
controlled: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
784
|
-
/**
|
|
785
|
-
* The default value of the prop in the user-defined component.
|
|
786
|
-
* @example
|
|
787
|
-
* `"/"`
|
|
788
|
-
*/
|
|
789
|
-
defaultValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
790
|
-
}, {}>>>;
|
|
791
|
-
/**
|
|
792
|
-
* The ESQuery selector to select the component precisely.
|
|
793
|
-
* @internal
|
|
794
|
-
* @example
|
|
795
|
-
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
796
|
-
*/
|
|
797
|
-
selector: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
798
|
-
}, {}>;
|
|
799
|
-
declare const CustomHooksSchema: z.ZodMiniObject<{
|
|
800
|
-
use: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
801
|
-
useActionState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
802
|
-
useCallback: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
803
|
-
useContext: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
804
|
-
useDebugValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
805
|
-
useDeferredValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
806
|
-
useEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
807
|
-
useFormStatus: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
808
|
-
useId: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
809
|
-
useImperativeHandle: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
810
|
-
useInsertionEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
811
|
-
useLayoutEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
812
|
-
useMemo: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
813
|
-
useOptimistic: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
814
|
-
useReducer: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
815
|
-
useRef: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
816
|
-
useState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
817
|
-
useSyncExternalStore: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
818
|
-
useTransition: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
819
|
-
}, {}>;
|
|
738
|
+
declare const CustomComponentSchema: z.ZodObject<{
|
|
739
|
+
name: z.ZodString;
|
|
740
|
+
as: z.ZodOptional<z.ZodString>;
|
|
741
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
742
|
+
name: z.ZodString;
|
|
743
|
+
as: z.ZodOptional<z.ZodString>;
|
|
744
|
+
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
745
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
746
|
+
}, z.core.$strip>>>;
|
|
747
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
748
|
+
}, z.core.$strip>;
|
|
749
|
+
declare const CustomHooksSchema: z.ZodObject<{
|
|
750
|
+
use: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
751
|
+
useActionState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
752
|
+
useCallback: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
753
|
+
useContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
754
|
+
useDebugValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
755
|
+
useDeferredValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
756
|
+
useEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
757
|
+
useFormStatus: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
758
|
+
useId: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
759
|
+
useImperativeHandle: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
760
|
+
useInsertionEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
761
|
+
useLayoutEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
762
|
+
useMemo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
763
|
+
useOptimistic: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
764
|
+
useReducer: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
765
|
+
useRef: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
766
|
+
useState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
767
|
+
useSyncExternalStore: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
768
|
+
useTransition: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
769
|
+
}, z.core.$strip>;
|
|
820
770
|
/**
|
|
821
771
|
* @internal
|
|
822
772
|
*/
|
|
823
|
-
declare const ESLintReactSettingsSchema: z.
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
* React version to use, "detect" means auto detect React version from the project's dependencies.
|
|
863
|
-
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
864
|
-
* @example `"18.3.1"`
|
|
865
|
-
* @default `"detect"`
|
|
866
|
-
*/
|
|
867
|
-
version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
868
|
-
/**
|
|
869
|
-
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
870
|
-
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
871
|
-
* @example `{ useEffect: ["useIsomorphicLayoutEffect"] }`
|
|
872
|
-
*/
|
|
873
|
-
additionalHooks: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
874
|
-
use: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
875
|
-
useActionState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
876
|
-
useCallback: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
877
|
-
useContext: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
878
|
-
useDebugValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
879
|
-
useDeferredValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
880
|
-
useEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
881
|
-
useFormStatus: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
882
|
-
useId: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
883
|
-
useImperativeHandle: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
884
|
-
useInsertionEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
885
|
-
useLayoutEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
886
|
-
useMemo: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
887
|
-
useOptimistic: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
888
|
-
useReducer: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
889
|
-
useRef: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
890
|
-
useState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
891
|
-
useSyncExternalStore: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
892
|
-
useTransition: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
893
|
-
}, {}>>;
|
|
894
|
-
/**
|
|
895
|
-
* An array of user-defined components
|
|
896
|
-
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
897
|
-
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
898
|
-
*/
|
|
899
|
-
additionalComponents: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
900
|
-
/**
|
|
901
|
-
* The name of the user-defined component.
|
|
902
|
-
* @example
|
|
903
|
-
* "Link"
|
|
904
|
-
*/
|
|
905
|
-
name: z.ZodMiniString<string>;
|
|
906
|
-
/**
|
|
907
|
-
* The name of the host component that the user-defined component represents.
|
|
908
|
-
* @example
|
|
909
|
-
* "a"
|
|
910
|
-
*/
|
|
911
|
-
as: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
912
|
-
/**
|
|
913
|
-
* Attributes mapping between the user-defined component and the host component.
|
|
914
|
-
* @example
|
|
915
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
916
|
-
*/
|
|
917
|
-
attributes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
918
|
-
/**
|
|
919
|
-
* The name of the prop in the user-defined component.
|
|
920
|
-
* @example
|
|
921
|
-
* "to"
|
|
922
|
-
*/
|
|
923
|
-
name: z.ZodMiniString<string>;
|
|
924
|
-
/**
|
|
925
|
-
* The name of the prop in the host component.
|
|
926
|
-
* @example
|
|
927
|
-
* "href"
|
|
928
|
-
*/
|
|
929
|
-
as: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
930
|
-
/**
|
|
931
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
932
|
-
* @internal
|
|
933
|
-
* @example
|
|
934
|
-
* `true`
|
|
935
|
-
*/
|
|
936
|
-
controlled: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
937
|
-
/**
|
|
938
|
-
* The default value of the prop in the user-defined component.
|
|
939
|
-
* @example
|
|
940
|
-
* `"/"`
|
|
941
|
-
*/
|
|
942
|
-
defaultValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
943
|
-
}, {}>>>;
|
|
944
|
-
/**
|
|
945
|
-
* The ESQuery selector to select the component precisely.
|
|
946
|
-
* @internal
|
|
947
|
-
* @example
|
|
948
|
-
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
949
|
-
*/
|
|
950
|
-
selector: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
951
|
-
}, {}>>>;
|
|
952
|
-
}, {}>;
|
|
773
|
+
declare const ESLintReactSettingsSchema: z.ZodObject<{
|
|
774
|
+
importSource: z.ZodOptional<z.ZodString>;
|
|
775
|
+
polymorphicPropName: z.ZodOptional<z.ZodString>;
|
|
776
|
+
strict: z.ZodOptional<z.ZodBoolean>;
|
|
777
|
+
skipImportCheck: z.ZodOptional<z.ZodBoolean>;
|
|
778
|
+
version: z.ZodOptional<z.ZodString>;
|
|
779
|
+
additionalHooks: z.ZodOptional<z.ZodObject<{
|
|
780
|
+
use: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
781
|
+
useActionState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
782
|
+
useCallback: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
783
|
+
useContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
784
|
+
useDebugValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
785
|
+
useDeferredValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
786
|
+
useEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
787
|
+
useFormStatus: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
788
|
+
useId: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
789
|
+
useImperativeHandle: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
790
|
+
useInsertionEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
791
|
+
useLayoutEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
792
|
+
useMemo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
793
|
+
useOptimistic: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
794
|
+
useReducer: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
795
|
+
useRef: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
796
|
+
useState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
797
|
+
useSyncExternalStore: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
798
|
+
useTransition: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
799
|
+
}, z.core.$strip>>;
|
|
800
|
+
additionalComponents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
801
|
+
name: z.ZodString;
|
|
802
|
+
as: z.ZodOptional<z.ZodString>;
|
|
803
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
804
|
+
name: z.ZodString;
|
|
805
|
+
as: z.ZodOptional<z.ZodString>;
|
|
806
|
+
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
807
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
808
|
+
}, z.core.$strip>>>;
|
|
809
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
810
|
+
}, z.core.$strip>>>;
|
|
811
|
+
}, z.core.$strip>;
|
|
953
812
|
/**
|
|
954
813
|
* @internal
|
|
955
814
|
*/
|
|
956
|
-
declare const ESLintSettingsSchema: z.
|
|
957
|
-
"react-x": z.
|
|
958
|
-
},
|
|
815
|
+
declare const ESLintSettingsSchema: z.ZodOptional<z.ZodObject<{
|
|
816
|
+
"react-x": z.ZodOptional<z.ZodUnknown>;
|
|
817
|
+
}, z.core.$strip>>;
|
|
959
818
|
type CustomComponent = z.infer<typeof CustomComponentSchema>;
|
|
960
819
|
type CustomComponentProp = z.infer<typeof CustomComponentPropSchema>;
|
|
961
820
|
type CustomHooks = z.infer<typeof CustomHooksSchema>;
|
|
@@ -995,7 +854,7 @@ declare const DEFAULT_ESLINT_SETTINGS: {
|
|
|
995
854
|
interface CustomComponentPropNormalized {
|
|
996
855
|
name: string;
|
|
997
856
|
as: string;
|
|
998
|
-
defaultValue?: string |
|
|
857
|
+
defaultValue?: string | unit;
|
|
999
858
|
}
|
|
1000
859
|
interface CustomComponentNormalized {
|
|
1001
860
|
name: string;
|
|
@@ -1009,7 +868,7 @@ interface ESLintReactSettingsNormalized {
|
|
|
1009
868
|
additionalHooks: CustomHooks;
|
|
1010
869
|
components: CustomComponentNormalized[];
|
|
1011
870
|
importSource: string;
|
|
1012
|
-
polymorphicPropName: string |
|
|
871
|
+
polymorphicPropName: string | unit;
|
|
1013
872
|
skipImportCheck: boolean;
|
|
1014
873
|
strict: boolean;
|
|
1015
874
|
version: string;
|
|
@@ -1059,8 +918,6 @@ declare const normalizeSettings: ({ additionalComponents, additionalHooks, impor
|
|
|
1059
918
|
readonly skipImportCheck: boolean;
|
|
1060
919
|
readonly strict: boolean;
|
|
1061
920
|
readonly version: string;
|
|
1062
|
-
readonly jsxPragma?: string | undefined;
|
|
1063
|
-
readonly jsxPragmaFrag?: string | undefined;
|
|
1064
921
|
};
|
|
1065
922
|
declare function getSettingsFromContext(context: RuleContext): ESLintReactSettingsNormalized;
|
|
1066
923
|
/**
|
|
@@ -1075,4 +932,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
|
|
|
1075
932
|
}
|
|
1076
933
|
}
|
|
1077
934
|
|
|
1078
|
-
export { type CustomComponent, type CustomComponentNormalized, type CustomComponentProp, type CustomComponentPropNormalized, CustomComponentPropSchema, CustomComponentSchema, type CustomHooks, CustomHooksSchema, DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, type ESLintReactSettings, type ESLintReactSettingsNormalized, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, NPM_SCOPE, WEBSITE_URL, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineSettings, getDocsUrl, getId, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, normalizeSettings };
|
|
935
|
+
export { type CustomComponent, type CustomComponentNormalized, type CustomComponentProp, type CustomComponentPropNormalized, CustomComponentPropSchema, CustomComponentSchema, type CustomHooks, CustomHooksSchema, DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, type ESLintReactSettings, type ESLintReactSettingsNormalized, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, NPM_SCOPE, WEBSITE_URL, _require, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineSettings, getDocsUrl, getId, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, normalizeSettings };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import module from '
|
|
1
|
+
import module from 'module';
|
|
2
|
+
import path from 'path';
|
|
2
3
|
import { identity, getOrElseUpdate } from '@eslint-react/eff';
|
|
3
4
|
import { match, P } from 'ts-pattern';
|
|
4
5
|
import { RegExp } from '@eslint-react/kit';
|
|
5
|
-
import
|
|
6
|
+
import { z } from 'zod/v4';
|
|
7
|
+
|
|
8
|
+
// src/_id.ts
|
|
9
|
+
var id = 0n;
|
|
10
|
+
var getId = () => (id++).toString();
|
|
11
|
+
var _require = module.createRequire(process.cwd() + path.sep);
|
|
6
12
|
|
|
7
13
|
// src/constants.ts
|
|
8
14
|
var NPM_SCOPE = "@eslint-react";
|
|
@@ -16,11 +22,6 @@ var getDocsUrl = (pluginName) => (ruleName) => {
|
|
|
16
22
|
}
|
|
17
23
|
return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
|
|
18
24
|
};
|
|
19
|
-
|
|
20
|
-
// src/get-id.ts
|
|
21
|
-
var id = 0n;
|
|
22
|
-
var getId = () => (id++).toString();
|
|
23
|
-
var _require = module.createRequire(import.meta.url);
|
|
24
25
|
function getReactVersion(fallback) {
|
|
25
26
|
try {
|
|
26
27
|
return match(_require("react")).with({ version: P.select(P.string) }, identity).otherwise(() => fallback);
|
|
@@ -111,19 +112,6 @@ var ESLintReactSettingsSchema = z.object({
|
|
|
111
112
|
* @example `"@pika/react"`
|
|
112
113
|
*/
|
|
113
114
|
importSource: z.optional(z.string()),
|
|
114
|
-
/**
|
|
115
|
-
* The identifier that's used for JSX Element creation.
|
|
116
|
-
* @default `"createElement"`
|
|
117
|
-
* @deprecated
|
|
118
|
-
*/
|
|
119
|
-
jsxPragma: z.optional(z.string()),
|
|
120
|
-
/**
|
|
121
|
-
* The identifier that's used for JSX fragment elements.
|
|
122
|
-
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
123
|
-
* @default `"Fragment"`
|
|
124
|
-
* @deprecated
|
|
125
|
-
*/
|
|
126
|
-
jsxPragmaFrag: z.optional(z.string()),
|
|
127
115
|
/**
|
|
128
116
|
* The name of the prop that is used for polymorphic components.
|
|
129
117
|
* @description This is used to determine the type of the component.
|
|
@@ -164,8 +152,7 @@ var ESLintReactSettingsSchema = z.object({
|
|
|
164
152
|
var ESLintSettingsSchema = z.optional(
|
|
165
153
|
z.object({
|
|
166
154
|
"react-x": z.optional(z.unknown())
|
|
167
|
-
})
|
|
168
|
-
{}
|
|
155
|
+
})
|
|
169
156
|
);
|
|
170
157
|
function isESLintSettings(settings) {
|
|
171
158
|
return ESLintSettingsSchema.safeParse(settings).success;
|
|
@@ -216,7 +203,6 @@ var normalizeSettings = ({
|
|
|
216
203
|
version,
|
|
217
204
|
...rest
|
|
218
205
|
}) => {
|
|
219
|
-
const fallbackVersion = DEFAULT_ESLINT_REACT_SETTINGS.version;
|
|
220
206
|
return {
|
|
221
207
|
...rest,
|
|
222
208
|
components: additionalComponents.map((component) => {
|
|
@@ -239,7 +225,7 @@ var normalizeSettings = ({
|
|
|
239
225
|
polymorphicPropName,
|
|
240
226
|
skipImportCheck,
|
|
241
227
|
strict,
|
|
242
|
-
version: match(version).with(P.union(P.nullish, "", "detect"), () => getReactVersion(
|
|
228
|
+
version: match(version).with(P.union(P.nullish, "", "detect"), () => getReactVersion("19.1.0")).otherwise(identity)
|
|
243
229
|
};
|
|
244
230
|
};
|
|
245
231
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -253,4 +239,4 @@ function getSettingsFromContext(context) {
|
|
|
253
239
|
}
|
|
254
240
|
var defineSettings = identity;
|
|
255
241
|
|
|
256
|
-
export { CustomComponentPropSchema, CustomComponentSchema, CustomHooksSchema, DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, NPM_SCOPE, WEBSITE_URL, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineSettings, getDocsUrl, getId, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, normalizeSettings };
|
|
242
|
+
export { CustomComponentPropSchema, CustomComponentSchema, CustomHooksSchema, DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, NPM_SCOPE, WEBSITE_URL, _require, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineSettings, getDocsUrl, getId, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, normalizeSettings };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.109",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -27,21 +27,20 @@
|
|
|
27
27
|
"./package.json"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@typescript-eslint/utils": "^8.
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"@eslint-react/eff": "2.0.0-next.
|
|
34
|
-
"@eslint-react/kit": "2.0.0-next.
|
|
30
|
+
"@typescript-eslint/utils": "^8.38.0",
|
|
31
|
+
"ts-pattern": "^5.8.0",
|
|
32
|
+
"zod": "^4.0.14",
|
|
33
|
+
"@eslint-react/eff": "2.0.0-next.109",
|
|
34
|
+
"@eslint-react/kit": "2.0.0-next.109"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@tsconfig/node22": "^22.0.
|
|
38
|
-
"@types/picomatch": "^4.0.
|
|
39
|
-
"tsup": "^8.
|
|
40
|
-
"type-fest": "^4.
|
|
37
|
+
"@tsconfig/node22": "^22.0.2",
|
|
38
|
+
"@types/picomatch": "^4.0.2",
|
|
39
|
+
"tsup": "^8.5.0",
|
|
40
|
+
"type-fest": "^4.41.0",
|
|
41
41
|
"@local/configs": "0.0.0"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
|
-
"bun": ">=1.0.15",
|
|
45
44
|
"node": ">=20.19.0"
|
|
46
45
|
},
|
|
47
46
|
"scripts": {
|