@eslint-react/shared 1.50.0-beta.5 → 1.50.0-beta.7
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 +48 -434
- package/dist/index.d.ts +48 -434
- package/dist/index.js +45 -65
- package/dist/index.mjs +2 -3
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ } from '@eslint-react/eff';
|
|
2
2
|
import { RuleContext } from '@eslint-react/kit';
|
|
3
|
-
import
|
|
3
|
+
import { z } from 'zod/v4';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The NPM scope for this project.
|
|
@@ -716,42 +716,11 @@ type PartialObjectDeep<ObjectType extends object, Options extends Required<Parti
|
|
|
716
716
|
});
|
|
717
717
|
|
|
718
718
|
declare const CustomComponentPropSchema: z.ZodObject<{
|
|
719
|
-
/**
|
|
720
|
-
* The name of the prop in the user-defined component.
|
|
721
|
-
* @example
|
|
722
|
-
* "to"
|
|
723
|
-
*/
|
|
724
719
|
name: z.ZodString;
|
|
725
|
-
/**
|
|
726
|
-
* The name of the prop in the host component.
|
|
727
|
-
* @example
|
|
728
|
-
* "href"
|
|
729
|
-
*/
|
|
730
720
|
as: z.ZodOptional<z.ZodString>;
|
|
731
|
-
/**
|
|
732
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
733
|
-
* @internal
|
|
734
|
-
* @example
|
|
735
|
-
* `true`
|
|
736
|
-
*/
|
|
737
721
|
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
738
|
-
/**
|
|
739
|
-
* The default value of the prop in the user-defined component.
|
|
740
|
-
* @example
|
|
741
|
-
* `"/"`
|
|
742
|
-
*/
|
|
743
722
|
defaultValue: z.ZodOptional<z.ZodString>;
|
|
744
|
-
},
|
|
745
|
-
name: string;
|
|
746
|
-
as?: string | undefined;
|
|
747
|
-
controlled?: boolean | undefined;
|
|
748
|
-
defaultValue?: string | undefined;
|
|
749
|
-
}, {
|
|
750
|
-
name: string;
|
|
751
|
-
as?: string | undefined;
|
|
752
|
-
controlled?: boolean | undefined;
|
|
753
|
-
defaultValue?: string | undefined;
|
|
754
|
-
}>;
|
|
723
|
+
}, z.core.$strip>;
|
|
755
724
|
/**
|
|
756
725
|
* @description
|
|
757
726
|
* This will provide some key information to the rule before checking for user-defined components.
|
|
@@ -759,442 +728,87 @@ declare const CustomComponentPropSchema: z.ZodObject<{
|
|
|
759
728
|
* Which prop is used as the `href` prop for the user-defined `Link` component that represents the built-in `a` element.
|
|
760
729
|
*/
|
|
761
730
|
declare const CustomComponentSchema: z.ZodObject<{
|
|
762
|
-
/**
|
|
763
|
-
* The name of the user-defined component.
|
|
764
|
-
* @example
|
|
765
|
-
* "Link"
|
|
766
|
-
*/
|
|
767
731
|
name: z.ZodString;
|
|
768
|
-
/**
|
|
769
|
-
* The name of the host component that the user-defined component represents.
|
|
770
|
-
* @example
|
|
771
|
-
* "a"
|
|
772
|
-
*/
|
|
773
732
|
as: z.ZodOptional<z.ZodString>;
|
|
774
|
-
/**
|
|
775
|
-
* Attributes mapping between the user-defined component and the host component.
|
|
776
|
-
* @example
|
|
777
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
778
|
-
*/
|
|
779
733
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
780
|
-
/**
|
|
781
|
-
* The name of the prop in the user-defined component.
|
|
782
|
-
* @example
|
|
783
|
-
* "to"
|
|
784
|
-
*/
|
|
785
734
|
name: z.ZodString;
|
|
786
|
-
/**
|
|
787
|
-
* The name of the prop in the host component.
|
|
788
|
-
* @example
|
|
789
|
-
* "href"
|
|
790
|
-
*/
|
|
791
735
|
as: z.ZodOptional<z.ZodString>;
|
|
792
|
-
/**
|
|
793
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
794
|
-
* @internal
|
|
795
|
-
* @example
|
|
796
|
-
* `true`
|
|
797
|
-
*/
|
|
798
736
|
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
799
|
-
/**
|
|
800
|
-
* The default value of the prop in the user-defined component.
|
|
801
|
-
* @example
|
|
802
|
-
* `"/"`
|
|
803
|
-
*/
|
|
804
737
|
defaultValue: z.ZodOptional<z.ZodString>;
|
|
805
|
-
},
|
|
806
|
-
name: string;
|
|
807
|
-
as?: string | undefined;
|
|
808
|
-
controlled?: boolean | undefined;
|
|
809
|
-
defaultValue?: string | undefined;
|
|
810
|
-
}, {
|
|
811
|
-
name: string;
|
|
812
|
-
as?: string | undefined;
|
|
813
|
-
controlled?: boolean | undefined;
|
|
814
|
-
defaultValue?: string | undefined;
|
|
815
|
-
}>, "many">>;
|
|
816
|
-
/**
|
|
817
|
-
* The ESQuery selector to select the component precisely.
|
|
818
|
-
* @internal
|
|
819
|
-
* @example
|
|
820
|
-
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
821
|
-
*/
|
|
738
|
+
}, z.core.$strip>>>;
|
|
822
739
|
selector: z.ZodOptional<z.ZodString>;
|
|
823
|
-
},
|
|
824
|
-
name: string;
|
|
825
|
-
as?: string | undefined;
|
|
826
|
-
attributes?: {
|
|
827
|
-
name: string;
|
|
828
|
-
as?: string | undefined;
|
|
829
|
-
controlled?: boolean | undefined;
|
|
830
|
-
defaultValue?: string | undefined;
|
|
831
|
-
}[] | undefined;
|
|
832
|
-
selector?: string | undefined;
|
|
833
|
-
}, {
|
|
834
|
-
name: string;
|
|
835
|
-
as?: string | undefined;
|
|
836
|
-
attributes?: {
|
|
837
|
-
name: string;
|
|
838
|
-
as?: string | undefined;
|
|
839
|
-
controlled?: boolean | undefined;
|
|
840
|
-
defaultValue?: string | undefined;
|
|
841
|
-
}[] | undefined;
|
|
842
|
-
selector?: string | undefined;
|
|
843
|
-
}>;
|
|
740
|
+
}, z.core.$strip>;
|
|
844
741
|
declare const CustomHooksSchema: z.ZodObject<{
|
|
845
|
-
use: z.ZodOptional<z.ZodArray<z.ZodString
|
|
846
|
-
useActionState: z.ZodOptional<z.ZodArray<z.ZodString
|
|
847
|
-
useCallback: z.ZodOptional<z.ZodArray<z.ZodString
|
|
848
|
-
useContext: z.ZodOptional<z.ZodArray<z.ZodString
|
|
849
|
-
useDebugValue: z.ZodOptional<z.ZodArray<z.ZodString
|
|
850
|
-
useDeferredValue: z.ZodOptional<z.ZodArray<z.ZodString
|
|
851
|
-
useEffect: z.ZodOptional<z.ZodArray<z.ZodString
|
|
852
|
-
useFormStatus: z.ZodOptional<z.ZodArray<z.ZodString
|
|
853
|
-
useId: z.ZodOptional<z.ZodArray<z.ZodString
|
|
854
|
-
useImperativeHandle: z.ZodOptional<z.ZodArray<z.ZodString
|
|
855
|
-
useInsertionEffect: z.ZodOptional<z.ZodArray<z.ZodString
|
|
856
|
-
useLayoutEffect: z.ZodOptional<z.ZodArray<z.ZodString
|
|
857
|
-
useMemo: z.ZodOptional<z.ZodArray<z.ZodString
|
|
858
|
-
useOptimistic: z.ZodOptional<z.ZodArray<z.ZodString
|
|
859
|
-
useReducer: z.ZodOptional<z.ZodArray<z.ZodString
|
|
860
|
-
useRef: z.ZodOptional<z.ZodArray<z.ZodString
|
|
861
|
-
useState: z.ZodOptional<z.ZodArray<z.ZodString
|
|
862
|
-
useSyncExternalStore: z.ZodOptional<z.ZodArray<z.ZodString
|
|
863
|
-
useTransition: z.ZodOptional<z.ZodArray<z.ZodString
|
|
864
|
-
},
|
|
865
|
-
use?: string[] | undefined;
|
|
866
|
-
useActionState?: string[] | undefined;
|
|
867
|
-
useCallback?: string[] | undefined;
|
|
868
|
-
useContext?: string[] | undefined;
|
|
869
|
-
useDebugValue?: string[] | undefined;
|
|
870
|
-
useDeferredValue?: string[] | undefined;
|
|
871
|
-
useEffect?: string[] | undefined;
|
|
872
|
-
useFormStatus?: string[] | undefined;
|
|
873
|
-
useId?: string[] | undefined;
|
|
874
|
-
useImperativeHandle?: string[] | undefined;
|
|
875
|
-
useInsertionEffect?: string[] | undefined;
|
|
876
|
-
useLayoutEffect?: string[] | undefined;
|
|
877
|
-
useMemo?: string[] | undefined;
|
|
878
|
-
useOptimistic?: string[] | undefined;
|
|
879
|
-
useReducer?: string[] | undefined;
|
|
880
|
-
useRef?: string[] | undefined;
|
|
881
|
-
useState?: string[] | undefined;
|
|
882
|
-
useSyncExternalStore?: string[] | undefined;
|
|
883
|
-
useTransition?: string[] | undefined;
|
|
884
|
-
}, {
|
|
885
|
-
use?: string[] | undefined;
|
|
886
|
-
useActionState?: string[] | undefined;
|
|
887
|
-
useCallback?: string[] | undefined;
|
|
888
|
-
useContext?: string[] | undefined;
|
|
889
|
-
useDebugValue?: string[] | undefined;
|
|
890
|
-
useDeferredValue?: string[] | undefined;
|
|
891
|
-
useEffect?: string[] | undefined;
|
|
892
|
-
useFormStatus?: string[] | undefined;
|
|
893
|
-
useId?: string[] | undefined;
|
|
894
|
-
useImperativeHandle?: string[] | undefined;
|
|
895
|
-
useInsertionEffect?: string[] | undefined;
|
|
896
|
-
useLayoutEffect?: string[] | undefined;
|
|
897
|
-
useMemo?: string[] | undefined;
|
|
898
|
-
useOptimistic?: string[] | undefined;
|
|
899
|
-
useReducer?: string[] | undefined;
|
|
900
|
-
useRef?: string[] | undefined;
|
|
901
|
-
useState?: string[] | undefined;
|
|
902
|
-
useSyncExternalStore?: string[] | undefined;
|
|
903
|
-
useTransition?: string[] | undefined;
|
|
904
|
-
}>;
|
|
742
|
+
use: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
743
|
+
useActionState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
744
|
+
useCallback: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
745
|
+
useContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
746
|
+
useDebugValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
747
|
+
useDeferredValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
748
|
+
useEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
749
|
+
useFormStatus: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
750
|
+
useId: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
751
|
+
useImperativeHandle: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
752
|
+
useInsertionEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
753
|
+
useLayoutEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
754
|
+
useMemo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
755
|
+
useOptimistic: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
756
|
+
useReducer: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
757
|
+
useRef: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
758
|
+
useState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
759
|
+
useSyncExternalStore: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
760
|
+
useTransition: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
761
|
+
}, z.core.$strip>;
|
|
905
762
|
/**
|
|
906
763
|
* @internal
|
|
907
764
|
*/
|
|
908
765
|
declare const ESLintReactSettingsSchema: z.ZodObject<{
|
|
909
|
-
/**
|
|
910
|
-
* The source where React is imported from.
|
|
911
|
-
* @description This allows to specify a custom import location for React when not using the official distribution.
|
|
912
|
-
* @default `"react"`
|
|
913
|
-
* @example `"@pika/react"`
|
|
914
|
-
*/
|
|
915
766
|
importSource: z.ZodOptional<z.ZodString>;
|
|
916
|
-
/**
|
|
917
|
-
* The identifier that's used for JSX Element creation.
|
|
918
|
-
* @default `"createElement"`
|
|
919
|
-
* @deprecated
|
|
920
|
-
*/
|
|
921
767
|
jsxPragma: z.ZodOptional<z.ZodString>;
|
|
922
|
-
/**
|
|
923
|
-
* The identifier that's used for JSX fragment elements.
|
|
924
|
-
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
925
|
-
* @default `"Fragment"`
|
|
926
|
-
* @deprecated
|
|
927
|
-
*/
|
|
928
768
|
jsxPragmaFrag: z.ZodOptional<z.ZodString>;
|
|
929
|
-
/**
|
|
930
|
-
* The name of the prop that is used for polymorphic components.
|
|
931
|
-
* @description This is used to determine the type of the component.
|
|
932
|
-
* @example `"as"`
|
|
933
|
-
*/
|
|
934
769
|
polymorphicPropName: z.ZodOptional<z.ZodString>;
|
|
935
|
-
/**
|
|
936
|
-
* @default `true`
|
|
937
|
-
* @internal
|
|
938
|
-
*/
|
|
939
770
|
strict: z.ZodOptional<z.ZodBoolean>;
|
|
940
|
-
/**
|
|
941
|
-
* Check both the shape and the import to determine if an API is from React.
|
|
942
|
-
* @default `true`
|
|
943
|
-
* @internal
|
|
944
|
-
*/
|
|
945
771
|
skipImportCheck: z.ZodOptional<z.ZodBoolean>;
|
|
946
|
-
/**
|
|
947
|
-
* React version to use, "detect" means auto detect React version from the project's dependencies.
|
|
948
|
-
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
949
|
-
* @example `"18.3.1"`
|
|
950
|
-
* @default `"detect"`
|
|
951
|
-
*/
|
|
952
772
|
version: z.ZodOptional<z.ZodString>;
|
|
953
|
-
/**
|
|
954
|
-
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
955
|
-
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
956
|
-
* @example `{ useEffect: ["useIsomorphicLayoutEffect"] }`
|
|
957
|
-
*/
|
|
958
773
|
additionalHooks: z.ZodOptional<z.ZodObject<{
|
|
959
|
-
use: z.ZodOptional<z.ZodArray<z.ZodString
|
|
960
|
-
useActionState: z.ZodOptional<z.ZodArray<z.ZodString
|
|
961
|
-
useCallback: z.ZodOptional<z.ZodArray<z.ZodString
|
|
962
|
-
useContext: z.ZodOptional<z.ZodArray<z.ZodString
|
|
963
|
-
useDebugValue: z.ZodOptional<z.ZodArray<z.ZodString
|
|
964
|
-
useDeferredValue: z.ZodOptional<z.ZodArray<z.ZodString
|
|
965
|
-
useEffect: z.ZodOptional<z.ZodArray<z.ZodString
|
|
966
|
-
useFormStatus: z.ZodOptional<z.ZodArray<z.ZodString
|
|
967
|
-
useId: z.ZodOptional<z.ZodArray<z.ZodString
|
|
968
|
-
useImperativeHandle: z.ZodOptional<z.ZodArray<z.ZodString
|
|
969
|
-
useInsertionEffect: z.ZodOptional<z.ZodArray<z.ZodString
|
|
970
|
-
useLayoutEffect: z.ZodOptional<z.ZodArray<z.ZodString
|
|
971
|
-
useMemo: z.ZodOptional<z.ZodArray<z.ZodString
|
|
972
|
-
useOptimistic: z.ZodOptional<z.ZodArray<z.ZodString
|
|
973
|
-
useReducer: z.ZodOptional<z.ZodArray<z.ZodString
|
|
974
|
-
useRef: z.ZodOptional<z.ZodArray<z.ZodString
|
|
975
|
-
useState: z.ZodOptional<z.ZodArray<z.ZodString
|
|
976
|
-
useSyncExternalStore: z.ZodOptional<z.ZodArray<z.ZodString
|
|
977
|
-
useTransition: z.ZodOptional<z.ZodArray<z.ZodString
|
|
978
|
-
},
|
|
979
|
-
use?: string[] | undefined;
|
|
980
|
-
useActionState?: string[] | undefined;
|
|
981
|
-
useCallback?: string[] | undefined;
|
|
982
|
-
useContext?: string[] | undefined;
|
|
983
|
-
useDebugValue?: string[] | undefined;
|
|
984
|
-
useDeferredValue?: string[] | undefined;
|
|
985
|
-
useEffect?: string[] | undefined;
|
|
986
|
-
useFormStatus?: string[] | undefined;
|
|
987
|
-
useId?: string[] | undefined;
|
|
988
|
-
useImperativeHandle?: string[] | undefined;
|
|
989
|
-
useInsertionEffect?: string[] | undefined;
|
|
990
|
-
useLayoutEffect?: string[] | undefined;
|
|
991
|
-
useMemo?: string[] | undefined;
|
|
992
|
-
useOptimistic?: string[] | undefined;
|
|
993
|
-
useReducer?: string[] | undefined;
|
|
994
|
-
useRef?: string[] | undefined;
|
|
995
|
-
useState?: string[] | undefined;
|
|
996
|
-
useSyncExternalStore?: string[] | undefined;
|
|
997
|
-
useTransition?: string[] | undefined;
|
|
998
|
-
}, {
|
|
999
|
-
use?: string[] | undefined;
|
|
1000
|
-
useActionState?: string[] | undefined;
|
|
1001
|
-
useCallback?: string[] | undefined;
|
|
1002
|
-
useContext?: string[] | undefined;
|
|
1003
|
-
useDebugValue?: string[] | undefined;
|
|
1004
|
-
useDeferredValue?: string[] | undefined;
|
|
1005
|
-
useEffect?: string[] | undefined;
|
|
1006
|
-
useFormStatus?: string[] | undefined;
|
|
1007
|
-
useId?: string[] | undefined;
|
|
1008
|
-
useImperativeHandle?: string[] | undefined;
|
|
1009
|
-
useInsertionEffect?: string[] | undefined;
|
|
1010
|
-
useLayoutEffect?: string[] | undefined;
|
|
1011
|
-
useMemo?: string[] | undefined;
|
|
1012
|
-
useOptimistic?: string[] | undefined;
|
|
1013
|
-
useReducer?: string[] | undefined;
|
|
1014
|
-
useRef?: string[] | undefined;
|
|
1015
|
-
useState?: string[] | undefined;
|
|
1016
|
-
useSyncExternalStore?: string[] | undefined;
|
|
1017
|
-
useTransition?: string[] | undefined;
|
|
1018
|
-
}>>;
|
|
1019
|
-
/**
|
|
1020
|
-
* An array of user-defined components
|
|
1021
|
-
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
1022
|
-
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
1023
|
-
*/
|
|
774
|
+
use: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
775
|
+
useActionState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
776
|
+
useCallback: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
777
|
+
useContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
778
|
+
useDebugValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
779
|
+
useDeferredValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
780
|
+
useEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
781
|
+
useFormStatus: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
782
|
+
useId: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
783
|
+
useImperativeHandle: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
784
|
+
useInsertionEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
785
|
+
useLayoutEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
786
|
+
useMemo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
787
|
+
useOptimistic: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
788
|
+
useReducer: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
789
|
+
useRef: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
790
|
+
useState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
791
|
+
useSyncExternalStore: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
792
|
+
useTransition: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
793
|
+
}, z.core.$strip>>;
|
|
1024
794
|
additionalComponents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1025
|
-
/**
|
|
1026
|
-
* The name of the user-defined component.
|
|
1027
|
-
* @example
|
|
1028
|
-
* "Link"
|
|
1029
|
-
*/
|
|
1030
795
|
name: z.ZodString;
|
|
1031
|
-
/**
|
|
1032
|
-
* The name of the host component that the user-defined component represents.
|
|
1033
|
-
* @example
|
|
1034
|
-
* "a"
|
|
1035
|
-
*/
|
|
1036
796
|
as: z.ZodOptional<z.ZodString>;
|
|
1037
|
-
/**
|
|
1038
|
-
* Attributes mapping between the user-defined component and the host component.
|
|
1039
|
-
* @example
|
|
1040
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
1041
|
-
*/
|
|
1042
797
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1043
|
-
/**
|
|
1044
|
-
* The name of the prop in the user-defined component.
|
|
1045
|
-
* @example
|
|
1046
|
-
* "to"
|
|
1047
|
-
*/
|
|
1048
798
|
name: z.ZodString;
|
|
1049
|
-
/**
|
|
1050
|
-
* The name of the prop in the host component.
|
|
1051
|
-
* @example
|
|
1052
|
-
* "href"
|
|
1053
|
-
*/
|
|
1054
799
|
as: z.ZodOptional<z.ZodString>;
|
|
1055
|
-
/**
|
|
1056
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
1057
|
-
* @internal
|
|
1058
|
-
* @example
|
|
1059
|
-
* `true`
|
|
1060
|
-
*/
|
|
1061
800
|
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
1062
|
-
/**
|
|
1063
|
-
* The default value of the prop in the user-defined component.
|
|
1064
|
-
* @example
|
|
1065
|
-
* `"/"`
|
|
1066
|
-
*/
|
|
1067
801
|
defaultValue: z.ZodOptional<z.ZodString>;
|
|
1068
|
-
},
|
|
1069
|
-
name: string;
|
|
1070
|
-
as?: string | undefined;
|
|
1071
|
-
controlled?: boolean | undefined;
|
|
1072
|
-
defaultValue?: string | undefined;
|
|
1073
|
-
}, {
|
|
1074
|
-
name: string;
|
|
1075
|
-
as?: string | undefined;
|
|
1076
|
-
controlled?: boolean | undefined;
|
|
1077
|
-
defaultValue?: string | undefined;
|
|
1078
|
-
}>, "many">>;
|
|
1079
|
-
/**
|
|
1080
|
-
* The ESQuery selector to select the component precisely.
|
|
1081
|
-
* @internal
|
|
1082
|
-
* @example
|
|
1083
|
-
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
1084
|
-
*/
|
|
802
|
+
}, z.core.$strip>>>;
|
|
1085
803
|
selector: z.ZodOptional<z.ZodString>;
|
|
1086
|
-
},
|
|
1087
|
-
|
|
1088
|
-
as?: string | undefined;
|
|
1089
|
-
attributes?: {
|
|
1090
|
-
name: string;
|
|
1091
|
-
as?: string | undefined;
|
|
1092
|
-
controlled?: boolean | undefined;
|
|
1093
|
-
defaultValue?: string | undefined;
|
|
1094
|
-
}[] | undefined;
|
|
1095
|
-
selector?: string | undefined;
|
|
1096
|
-
}, {
|
|
1097
|
-
name: string;
|
|
1098
|
-
as?: string | undefined;
|
|
1099
|
-
attributes?: {
|
|
1100
|
-
name: string;
|
|
1101
|
-
as?: string | undefined;
|
|
1102
|
-
controlled?: boolean | undefined;
|
|
1103
|
-
defaultValue?: string | undefined;
|
|
1104
|
-
}[] | undefined;
|
|
1105
|
-
selector?: string | undefined;
|
|
1106
|
-
}>, "many">>;
|
|
1107
|
-
}, "strip", z.ZodTypeAny, {
|
|
1108
|
-
version?: string | undefined;
|
|
1109
|
-
importSource?: string | undefined;
|
|
1110
|
-
jsxPragma?: string | undefined;
|
|
1111
|
-
jsxPragmaFrag?: string | undefined;
|
|
1112
|
-
polymorphicPropName?: string | undefined;
|
|
1113
|
-
strict?: boolean | undefined;
|
|
1114
|
-
skipImportCheck?: boolean | undefined;
|
|
1115
|
-
additionalHooks?: {
|
|
1116
|
-
use?: string[] | undefined;
|
|
1117
|
-
useActionState?: string[] | undefined;
|
|
1118
|
-
useCallback?: string[] | undefined;
|
|
1119
|
-
useContext?: string[] | undefined;
|
|
1120
|
-
useDebugValue?: string[] | undefined;
|
|
1121
|
-
useDeferredValue?: string[] | undefined;
|
|
1122
|
-
useEffect?: string[] | undefined;
|
|
1123
|
-
useFormStatus?: string[] | undefined;
|
|
1124
|
-
useId?: string[] | undefined;
|
|
1125
|
-
useImperativeHandle?: string[] | undefined;
|
|
1126
|
-
useInsertionEffect?: string[] | undefined;
|
|
1127
|
-
useLayoutEffect?: string[] | undefined;
|
|
1128
|
-
useMemo?: string[] | undefined;
|
|
1129
|
-
useOptimistic?: string[] | undefined;
|
|
1130
|
-
useReducer?: string[] | undefined;
|
|
1131
|
-
useRef?: string[] | undefined;
|
|
1132
|
-
useState?: string[] | undefined;
|
|
1133
|
-
useSyncExternalStore?: string[] | undefined;
|
|
1134
|
-
useTransition?: string[] | undefined;
|
|
1135
|
-
} | undefined;
|
|
1136
|
-
additionalComponents?: {
|
|
1137
|
-
name: string;
|
|
1138
|
-
as?: string | undefined;
|
|
1139
|
-
attributes?: {
|
|
1140
|
-
name: string;
|
|
1141
|
-
as?: string | undefined;
|
|
1142
|
-
controlled?: boolean | undefined;
|
|
1143
|
-
defaultValue?: string | undefined;
|
|
1144
|
-
}[] | undefined;
|
|
1145
|
-
selector?: string | undefined;
|
|
1146
|
-
}[] | undefined;
|
|
1147
|
-
}, {
|
|
1148
|
-
version?: string | undefined;
|
|
1149
|
-
importSource?: string | undefined;
|
|
1150
|
-
jsxPragma?: string | undefined;
|
|
1151
|
-
jsxPragmaFrag?: string | undefined;
|
|
1152
|
-
polymorphicPropName?: string | undefined;
|
|
1153
|
-
strict?: boolean | undefined;
|
|
1154
|
-
skipImportCheck?: boolean | undefined;
|
|
1155
|
-
additionalHooks?: {
|
|
1156
|
-
use?: string[] | undefined;
|
|
1157
|
-
useActionState?: string[] | undefined;
|
|
1158
|
-
useCallback?: string[] | undefined;
|
|
1159
|
-
useContext?: string[] | undefined;
|
|
1160
|
-
useDebugValue?: string[] | undefined;
|
|
1161
|
-
useDeferredValue?: string[] | undefined;
|
|
1162
|
-
useEffect?: string[] | undefined;
|
|
1163
|
-
useFormStatus?: string[] | undefined;
|
|
1164
|
-
useId?: string[] | undefined;
|
|
1165
|
-
useImperativeHandle?: string[] | undefined;
|
|
1166
|
-
useInsertionEffect?: string[] | undefined;
|
|
1167
|
-
useLayoutEffect?: string[] | undefined;
|
|
1168
|
-
useMemo?: string[] | undefined;
|
|
1169
|
-
useOptimistic?: string[] | undefined;
|
|
1170
|
-
useReducer?: string[] | undefined;
|
|
1171
|
-
useRef?: string[] | undefined;
|
|
1172
|
-
useState?: string[] | undefined;
|
|
1173
|
-
useSyncExternalStore?: string[] | undefined;
|
|
1174
|
-
useTransition?: string[] | undefined;
|
|
1175
|
-
} | undefined;
|
|
1176
|
-
additionalComponents?: {
|
|
1177
|
-
name: string;
|
|
1178
|
-
as?: string | undefined;
|
|
1179
|
-
attributes?: {
|
|
1180
|
-
name: string;
|
|
1181
|
-
as?: string | undefined;
|
|
1182
|
-
controlled?: boolean | undefined;
|
|
1183
|
-
defaultValue?: string | undefined;
|
|
1184
|
-
}[] | undefined;
|
|
1185
|
-
selector?: string | undefined;
|
|
1186
|
-
}[] | undefined;
|
|
1187
|
-
}>;
|
|
804
|
+
}, z.core.$strip>>>;
|
|
805
|
+
}, z.core.$strip>;
|
|
1188
806
|
/**
|
|
1189
807
|
* @internal
|
|
1190
808
|
*/
|
|
1191
809
|
declare const ESLintSettingsSchema: z.ZodOptional<z.ZodObject<{
|
|
1192
810
|
"react-x": z.ZodOptional<z.ZodUnknown>;
|
|
1193
|
-
},
|
|
1194
|
-
"react-x"?: unknown;
|
|
1195
|
-
}, {
|
|
1196
|
-
"react-x"?: unknown;
|
|
1197
|
-
}>>;
|
|
811
|
+
}, z.core.$strip>>;
|
|
1198
812
|
type CustomComponent = z.infer<typeof CustomComponentSchema>;
|
|
1199
813
|
type CustomComponentProp = z.infer<typeof CustomComponentPropSchema>;
|
|
1200
814
|
type CustomHooks = z.infer<typeof CustomHooksSchema>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ } from '@eslint-react/eff';
|
|
2
2
|
import { RuleContext } from '@eslint-react/kit';
|
|
3
|
-
import
|
|
3
|
+
import { z } from 'zod/v4';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The NPM scope for this project.
|
|
@@ -716,42 +716,11 @@ type PartialObjectDeep<ObjectType extends object, Options extends Required<Parti
|
|
|
716
716
|
});
|
|
717
717
|
|
|
718
718
|
declare const CustomComponentPropSchema: z.ZodObject<{
|
|
719
|
-
/**
|
|
720
|
-
* The name of the prop in the user-defined component.
|
|
721
|
-
* @example
|
|
722
|
-
* "to"
|
|
723
|
-
*/
|
|
724
719
|
name: z.ZodString;
|
|
725
|
-
/**
|
|
726
|
-
* The name of the prop in the host component.
|
|
727
|
-
* @example
|
|
728
|
-
* "href"
|
|
729
|
-
*/
|
|
730
720
|
as: z.ZodOptional<z.ZodString>;
|
|
731
|
-
/**
|
|
732
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
733
|
-
* @internal
|
|
734
|
-
* @example
|
|
735
|
-
* `true`
|
|
736
|
-
*/
|
|
737
721
|
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
738
|
-
/**
|
|
739
|
-
* The default value of the prop in the user-defined component.
|
|
740
|
-
* @example
|
|
741
|
-
* `"/"`
|
|
742
|
-
*/
|
|
743
722
|
defaultValue: z.ZodOptional<z.ZodString>;
|
|
744
|
-
},
|
|
745
|
-
name: string;
|
|
746
|
-
as?: string | undefined;
|
|
747
|
-
controlled?: boolean | undefined;
|
|
748
|
-
defaultValue?: string | undefined;
|
|
749
|
-
}, {
|
|
750
|
-
name: string;
|
|
751
|
-
as?: string | undefined;
|
|
752
|
-
controlled?: boolean | undefined;
|
|
753
|
-
defaultValue?: string | undefined;
|
|
754
|
-
}>;
|
|
723
|
+
}, z.core.$strip>;
|
|
755
724
|
/**
|
|
756
725
|
* @description
|
|
757
726
|
* This will provide some key information to the rule before checking for user-defined components.
|
|
@@ -759,442 +728,87 @@ declare const CustomComponentPropSchema: z.ZodObject<{
|
|
|
759
728
|
* Which prop is used as the `href` prop for the user-defined `Link` component that represents the built-in `a` element.
|
|
760
729
|
*/
|
|
761
730
|
declare const CustomComponentSchema: z.ZodObject<{
|
|
762
|
-
/**
|
|
763
|
-
* The name of the user-defined component.
|
|
764
|
-
* @example
|
|
765
|
-
* "Link"
|
|
766
|
-
*/
|
|
767
731
|
name: z.ZodString;
|
|
768
|
-
/**
|
|
769
|
-
* The name of the host component that the user-defined component represents.
|
|
770
|
-
* @example
|
|
771
|
-
* "a"
|
|
772
|
-
*/
|
|
773
732
|
as: z.ZodOptional<z.ZodString>;
|
|
774
|
-
/**
|
|
775
|
-
* Attributes mapping between the user-defined component and the host component.
|
|
776
|
-
* @example
|
|
777
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
778
|
-
*/
|
|
779
733
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
780
|
-
/**
|
|
781
|
-
* The name of the prop in the user-defined component.
|
|
782
|
-
* @example
|
|
783
|
-
* "to"
|
|
784
|
-
*/
|
|
785
734
|
name: z.ZodString;
|
|
786
|
-
/**
|
|
787
|
-
* The name of the prop in the host component.
|
|
788
|
-
* @example
|
|
789
|
-
* "href"
|
|
790
|
-
*/
|
|
791
735
|
as: z.ZodOptional<z.ZodString>;
|
|
792
|
-
/**
|
|
793
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
794
|
-
* @internal
|
|
795
|
-
* @example
|
|
796
|
-
* `true`
|
|
797
|
-
*/
|
|
798
736
|
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
799
|
-
/**
|
|
800
|
-
* The default value of the prop in the user-defined component.
|
|
801
|
-
* @example
|
|
802
|
-
* `"/"`
|
|
803
|
-
*/
|
|
804
737
|
defaultValue: z.ZodOptional<z.ZodString>;
|
|
805
|
-
},
|
|
806
|
-
name: string;
|
|
807
|
-
as?: string | undefined;
|
|
808
|
-
controlled?: boolean | undefined;
|
|
809
|
-
defaultValue?: string | undefined;
|
|
810
|
-
}, {
|
|
811
|
-
name: string;
|
|
812
|
-
as?: string | undefined;
|
|
813
|
-
controlled?: boolean | undefined;
|
|
814
|
-
defaultValue?: string | undefined;
|
|
815
|
-
}>, "many">>;
|
|
816
|
-
/**
|
|
817
|
-
* The ESQuery selector to select the component precisely.
|
|
818
|
-
* @internal
|
|
819
|
-
* @example
|
|
820
|
-
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
821
|
-
*/
|
|
738
|
+
}, z.core.$strip>>>;
|
|
822
739
|
selector: z.ZodOptional<z.ZodString>;
|
|
823
|
-
},
|
|
824
|
-
name: string;
|
|
825
|
-
as?: string | undefined;
|
|
826
|
-
attributes?: {
|
|
827
|
-
name: string;
|
|
828
|
-
as?: string | undefined;
|
|
829
|
-
controlled?: boolean | undefined;
|
|
830
|
-
defaultValue?: string | undefined;
|
|
831
|
-
}[] | undefined;
|
|
832
|
-
selector?: string | undefined;
|
|
833
|
-
}, {
|
|
834
|
-
name: string;
|
|
835
|
-
as?: string | undefined;
|
|
836
|
-
attributes?: {
|
|
837
|
-
name: string;
|
|
838
|
-
as?: string | undefined;
|
|
839
|
-
controlled?: boolean | undefined;
|
|
840
|
-
defaultValue?: string | undefined;
|
|
841
|
-
}[] | undefined;
|
|
842
|
-
selector?: string | undefined;
|
|
843
|
-
}>;
|
|
740
|
+
}, z.core.$strip>;
|
|
844
741
|
declare const CustomHooksSchema: z.ZodObject<{
|
|
845
|
-
use: z.ZodOptional<z.ZodArray<z.ZodString
|
|
846
|
-
useActionState: z.ZodOptional<z.ZodArray<z.ZodString
|
|
847
|
-
useCallback: z.ZodOptional<z.ZodArray<z.ZodString
|
|
848
|
-
useContext: z.ZodOptional<z.ZodArray<z.ZodString
|
|
849
|
-
useDebugValue: z.ZodOptional<z.ZodArray<z.ZodString
|
|
850
|
-
useDeferredValue: z.ZodOptional<z.ZodArray<z.ZodString
|
|
851
|
-
useEffect: z.ZodOptional<z.ZodArray<z.ZodString
|
|
852
|
-
useFormStatus: z.ZodOptional<z.ZodArray<z.ZodString
|
|
853
|
-
useId: z.ZodOptional<z.ZodArray<z.ZodString
|
|
854
|
-
useImperativeHandle: z.ZodOptional<z.ZodArray<z.ZodString
|
|
855
|
-
useInsertionEffect: z.ZodOptional<z.ZodArray<z.ZodString
|
|
856
|
-
useLayoutEffect: z.ZodOptional<z.ZodArray<z.ZodString
|
|
857
|
-
useMemo: z.ZodOptional<z.ZodArray<z.ZodString
|
|
858
|
-
useOptimistic: z.ZodOptional<z.ZodArray<z.ZodString
|
|
859
|
-
useReducer: z.ZodOptional<z.ZodArray<z.ZodString
|
|
860
|
-
useRef: z.ZodOptional<z.ZodArray<z.ZodString
|
|
861
|
-
useState: z.ZodOptional<z.ZodArray<z.ZodString
|
|
862
|
-
useSyncExternalStore: z.ZodOptional<z.ZodArray<z.ZodString
|
|
863
|
-
useTransition: z.ZodOptional<z.ZodArray<z.ZodString
|
|
864
|
-
},
|
|
865
|
-
use?: string[] | undefined;
|
|
866
|
-
useActionState?: string[] | undefined;
|
|
867
|
-
useCallback?: string[] | undefined;
|
|
868
|
-
useContext?: string[] | undefined;
|
|
869
|
-
useDebugValue?: string[] | undefined;
|
|
870
|
-
useDeferredValue?: string[] | undefined;
|
|
871
|
-
useEffect?: string[] | undefined;
|
|
872
|
-
useFormStatus?: string[] | undefined;
|
|
873
|
-
useId?: string[] | undefined;
|
|
874
|
-
useImperativeHandle?: string[] | undefined;
|
|
875
|
-
useInsertionEffect?: string[] | undefined;
|
|
876
|
-
useLayoutEffect?: string[] | undefined;
|
|
877
|
-
useMemo?: string[] | undefined;
|
|
878
|
-
useOptimistic?: string[] | undefined;
|
|
879
|
-
useReducer?: string[] | undefined;
|
|
880
|
-
useRef?: string[] | undefined;
|
|
881
|
-
useState?: string[] | undefined;
|
|
882
|
-
useSyncExternalStore?: string[] | undefined;
|
|
883
|
-
useTransition?: string[] | undefined;
|
|
884
|
-
}, {
|
|
885
|
-
use?: string[] | undefined;
|
|
886
|
-
useActionState?: string[] | undefined;
|
|
887
|
-
useCallback?: string[] | undefined;
|
|
888
|
-
useContext?: string[] | undefined;
|
|
889
|
-
useDebugValue?: string[] | undefined;
|
|
890
|
-
useDeferredValue?: string[] | undefined;
|
|
891
|
-
useEffect?: string[] | undefined;
|
|
892
|
-
useFormStatus?: string[] | undefined;
|
|
893
|
-
useId?: string[] | undefined;
|
|
894
|
-
useImperativeHandle?: string[] | undefined;
|
|
895
|
-
useInsertionEffect?: string[] | undefined;
|
|
896
|
-
useLayoutEffect?: string[] | undefined;
|
|
897
|
-
useMemo?: string[] | undefined;
|
|
898
|
-
useOptimistic?: string[] | undefined;
|
|
899
|
-
useReducer?: string[] | undefined;
|
|
900
|
-
useRef?: string[] | undefined;
|
|
901
|
-
useState?: string[] | undefined;
|
|
902
|
-
useSyncExternalStore?: string[] | undefined;
|
|
903
|
-
useTransition?: string[] | undefined;
|
|
904
|
-
}>;
|
|
742
|
+
use: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
743
|
+
useActionState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
744
|
+
useCallback: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
745
|
+
useContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
746
|
+
useDebugValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
747
|
+
useDeferredValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
748
|
+
useEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
749
|
+
useFormStatus: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
750
|
+
useId: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
751
|
+
useImperativeHandle: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
752
|
+
useInsertionEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
753
|
+
useLayoutEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
754
|
+
useMemo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
755
|
+
useOptimistic: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
756
|
+
useReducer: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
757
|
+
useRef: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
758
|
+
useState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
759
|
+
useSyncExternalStore: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
760
|
+
useTransition: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
761
|
+
}, z.core.$strip>;
|
|
905
762
|
/**
|
|
906
763
|
* @internal
|
|
907
764
|
*/
|
|
908
765
|
declare const ESLintReactSettingsSchema: z.ZodObject<{
|
|
909
|
-
/**
|
|
910
|
-
* The source where React is imported from.
|
|
911
|
-
* @description This allows to specify a custom import location for React when not using the official distribution.
|
|
912
|
-
* @default `"react"`
|
|
913
|
-
* @example `"@pika/react"`
|
|
914
|
-
*/
|
|
915
766
|
importSource: z.ZodOptional<z.ZodString>;
|
|
916
|
-
/**
|
|
917
|
-
* The identifier that's used for JSX Element creation.
|
|
918
|
-
* @default `"createElement"`
|
|
919
|
-
* @deprecated
|
|
920
|
-
*/
|
|
921
767
|
jsxPragma: z.ZodOptional<z.ZodString>;
|
|
922
|
-
/**
|
|
923
|
-
* The identifier that's used for JSX fragment elements.
|
|
924
|
-
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
925
|
-
* @default `"Fragment"`
|
|
926
|
-
* @deprecated
|
|
927
|
-
*/
|
|
928
768
|
jsxPragmaFrag: z.ZodOptional<z.ZodString>;
|
|
929
|
-
/**
|
|
930
|
-
* The name of the prop that is used for polymorphic components.
|
|
931
|
-
* @description This is used to determine the type of the component.
|
|
932
|
-
* @example `"as"`
|
|
933
|
-
*/
|
|
934
769
|
polymorphicPropName: z.ZodOptional<z.ZodString>;
|
|
935
|
-
/**
|
|
936
|
-
* @default `true`
|
|
937
|
-
* @internal
|
|
938
|
-
*/
|
|
939
770
|
strict: z.ZodOptional<z.ZodBoolean>;
|
|
940
|
-
/**
|
|
941
|
-
* Check both the shape and the import to determine if an API is from React.
|
|
942
|
-
* @default `true`
|
|
943
|
-
* @internal
|
|
944
|
-
*/
|
|
945
771
|
skipImportCheck: z.ZodOptional<z.ZodBoolean>;
|
|
946
|
-
/**
|
|
947
|
-
* React version to use, "detect" means auto detect React version from the project's dependencies.
|
|
948
|
-
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
949
|
-
* @example `"18.3.1"`
|
|
950
|
-
* @default `"detect"`
|
|
951
|
-
*/
|
|
952
772
|
version: z.ZodOptional<z.ZodString>;
|
|
953
|
-
/**
|
|
954
|
-
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
955
|
-
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
956
|
-
* @example `{ useEffect: ["useIsomorphicLayoutEffect"] }`
|
|
957
|
-
*/
|
|
958
773
|
additionalHooks: z.ZodOptional<z.ZodObject<{
|
|
959
|
-
use: z.ZodOptional<z.ZodArray<z.ZodString
|
|
960
|
-
useActionState: z.ZodOptional<z.ZodArray<z.ZodString
|
|
961
|
-
useCallback: z.ZodOptional<z.ZodArray<z.ZodString
|
|
962
|
-
useContext: z.ZodOptional<z.ZodArray<z.ZodString
|
|
963
|
-
useDebugValue: z.ZodOptional<z.ZodArray<z.ZodString
|
|
964
|
-
useDeferredValue: z.ZodOptional<z.ZodArray<z.ZodString
|
|
965
|
-
useEffect: z.ZodOptional<z.ZodArray<z.ZodString
|
|
966
|
-
useFormStatus: z.ZodOptional<z.ZodArray<z.ZodString
|
|
967
|
-
useId: z.ZodOptional<z.ZodArray<z.ZodString
|
|
968
|
-
useImperativeHandle: z.ZodOptional<z.ZodArray<z.ZodString
|
|
969
|
-
useInsertionEffect: z.ZodOptional<z.ZodArray<z.ZodString
|
|
970
|
-
useLayoutEffect: z.ZodOptional<z.ZodArray<z.ZodString
|
|
971
|
-
useMemo: z.ZodOptional<z.ZodArray<z.ZodString
|
|
972
|
-
useOptimistic: z.ZodOptional<z.ZodArray<z.ZodString
|
|
973
|
-
useReducer: z.ZodOptional<z.ZodArray<z.ZodString
|
|
974
|
-
useRef: z.ZodOptional<z.ZodArray<z.ZodString
|
|
975
|
-
useState: z.ZodOptional<z.ZodArray<z.ZodString
|
|
976
|
-
useSyncExternalStore: z.ZodOptional<z.ZodArray<z.ZodString
|
|
977
|
-
useTransition: z.ZodOptional<z.ZodArray<z.ZodString
|
|
978
|
-
},
|
|
979
|
-
use?: string[] | undefined;
|
|
980
|
-
useActionState?: string[] | undefined;
|
|
981
|
-
useCallback?: string[] | undefined;
|
|
982
|
-
useContext?: string[] | undefined;
|
|
983
|
-
useDebugValue?: string[] | undefined;
|
|
984
|
-
useDeferredValue?: string[] | undefined;
|
|
985
|
-
useEffect?: string[] | undefined;
|
|
986
|
-
useFormStatus?: string[] | undefined;
|
|
987
|
-
useId?: string[] | undefined;
|
|
988
|
-
useImperativeHandle?: string[] | undefined;
|
|
989
|
-
useInsertionEffect?: string[] | undefined;
|
|
990
|
-
useLayoutEffect?: string[] | undefined;
|
|
991
|
-
useMemo?: string[] | undefined;
|
|
992
|
-
useOptimistic?: string[] | undefined;
|
|
993
|
-
useReducer?: string[] | undefined;
|
|
994
|
-
useRef?: string[] | undefined;
|
|
995
|
-
useState?: string[] | undefined;
|
|
996
|
-
useSyncExternalStore?: string[] | undefined;
|
|
997
|
-
useTransition?: string[] | undefined;
|
|
998
|
-
}, {
|
|
999
|
-
use?: string[] | undefined;
|
|
1000
|
-
useActionState?: string[] | undefined;
|
|
1001
|
-
useCallback?: string[] | undefined;
|
|
1002
|
-
useContext?: string[] | undefined;
|
|
1003
|
-
useDebugValue?: string[] | undefined;
|
|
1004
|
-
useDeferredValue?: string[] | undefined;
|
|
1005
|
-
useEffect?: string[] | undefined;
|
|
1006
|
-
useFormStatus?: string[] | undefined;
|
|
1007
|
-
useId?: string[] | undefined;
|
|
1008
|
-
useImperativeHandle?: string[] | undefined;
|
|
1009
|
-
useInsertionEffect?: string[] | undefined;
|
|
1010
|
-
useLayoutEffect?: string[] | undefined;
|
|
1011
|
-
useMemo?: string[] | undefined;
|
|
1012
|
-
useOptimistic?: string[] | undefined;
|
|
1013
|
-
useReducer?: string[] | undefined;
|
|
1014
|
-
useRef?: string[] | undefined;
|
|
1015
|
-
useState?: string[] | undefined;
|
|
1016
|
-
useSyncExternalStore?: string[] | undefined;
|
|
1017
|
-
useTransition?: string[] | undefined;
|
|
1018
|
-
}>>;
|
|
1019
|
-
/**
|
|
1020
|
-
* An array of user-defined components
|
|
1021
|
-
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
1022
|
-
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
1023
|
-
*/
|
|
774
|
+
use: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
775
|
+
useActionState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
776
|
+
useCallback: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
777
|
+
useContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
778
|
+
useDebugValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
779
|
+
useDeferredValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
780
|
+
useEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
781
|
+
useFormStatus: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
782
|
+
useId: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
783
|
+
useImperativeHandle: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
784
|
+
useInsertionEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
785
|
+
useLayoutEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
786
|
+
useMemo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
787
|
+
useOptimistic: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
788
|
+
useReducer: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
789
|
+
useRef: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
790
|
+
useState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
791
|
+
useSyncExternalStore: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
792
|
+
useTransition: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
793
|
+
}, z.core.$strip>>;
|
|
1024
794
|
additionalComponents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1025
|
-
/**
|
|
1026
|
-
* The name of the user-defined component.
|
|
1027
|
-
* @example
|
|
1028
|
-
* "Link"
|
|
1029
|
-
*/
|
|
1030
795
|
name: z.ZodString;
|
|
1031
|
-
/**
|
|
1032
|
-
* The name of the host component that the user-defined component represents.
|
|
1033
|
-
* @example
|
|
1034
|
-
* "a"
|
|
1035
|
-
*/
|
|
1036
796
|
as: z.ZodOptional<z.ZodString>;
|
|
1037
|
-
/**
|
|
1038
|
-
* Attributes mapping between the user-defined component and the host component.
|
|
1039
|
-
* @example
|
|
1040
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
1041
|
-
*/
|
|
1042
797
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1043
|
-
/**
|
|
1044
|
-
* The name of the prop in the user-defined component.
|
|
1045
|
-
* @example
|
|
1046
|
-
* "to"
|
|
1047
|
-
*/
|
|
1048
798
|
name: z.ZodString;
|
|
1049
|
-
/**
|
|
1050
|
-
* The name of the prop in the host component.
|
|
1051
|
-
* @example
|
|
1052
|
-
* "href"
|
|
1053
|
-
*/
|
|
1054
799
|
as: z.ZodOptional<z.ZodString>;
|
|
1055
|
-
/**
|
|
1056
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
1057
|
-
* @internal
|
|
1058
|
-
* @example
|
|
1059
|
-
* `true`
|
|
1060
|
-
*/
|
|
1061
800
|
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
1062
|
-
/**
|
|
1063
|
-
* The default value of the prop in the user-defined component.
|
|
1064
|
-
* @example
|
|
1065
|
-
* `"/"`
|
|
1066
|
-
*/
|
|
1067
801
|
defaultValue: z.ZodOptional<z.ZodString>;
|
|
1068
|
-
},
|
|
1069
|
-
name: string;
|
|
1070
|
-
as?: string | undefined;
|
|
1071
|
-
controlled?: boolean | undefined;
|
|
1072
|
-
defaultValue?: string | undefined;
|
|
1073
|
-
}, {
|
|
1074
|
-
name: string;
|
|
1075
|
-
as?: string | undefined;
|
|
1076
|
-
controlled?: boolean | undefined;
|
|
1077
|
-
defaultValue?: string | undefined;
|
|
1078
|
-
}>, "many">>;
|
|
1079
|
-
/**
|
|
1080
|
-
* The ESQuery selector to select the component precisely.
|
|
1081
|
-
* @internal
|
|
1082
|
-
* @example
|
|
1083
|
-
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
1084
|
-
*/
|
|
802
|
+
}, z.core.$strip>>>;
|
|
1085
803
|
selector: z.ZodOptional<z.ZodString>;
|
|
1086
|
-
},
|
|
1087
|
-
|
|
1088
|
-
as?: string | undefined;
|
|
1089
|
-
attributes?: {
|
|
1090
|
-
name: string;
|
|
1091
|
-
as?: string | undefined;
|
|
1092
|
-
controlled?: boolean | undefined;
|
|
1093
|
-
defaultValue?: string | undefined;
|
|
1094
|
-
}[] | undefined;
|
|
1095
|
-
selector?: string | undefined;
|
|
1096
|
-
}, {
|
|
1097
|
-
name: string;
|
|
1098
|
-
as?: string | undefined;
|
|
1099
|
-
attributes?: {
|
|
1100
|
-
name: string;
|
|
1101
|
-
as?: string | undefined;
|
|
1102
|
-
controlled?: boolean | undefined;
|
|
1103
|
-
defaultValue?: string | undefined;
|
|
1104
|
-
}[] | undefined;
|
|
1105
|
-
selector?: string | undefined;
|
|
1106
|
-
}>, "many">>;
|
|
1107
|
-
}, "strip", z.ZodTypeAny, {
|
|
1108
|
-
version?: string | undefined;
|
|
1109
|
-
importSource?: string | undefined;
|
|
1110
|
-
jsxPragma?: string | undefined;
|
|
1111
|
-
jsxPragmaFrag?: string | undefined;
|
|
1112
|
-
polymorphicPropName?: string | undefined;
|
|
1113
|
-
strict?: boolean | undefined;
|
|
1114
|
-
skipImportCheck?: boolean | undefined;
|
|
1115
|
-
additionalHooks?: {
|
|
1116
|
-
use?: string[] | undefined;
|
|
1117
|
-
useActionState?: string[] | undefined;
|
|
1118
|
-
useCallback?: string[] | undefined;
|
|
1119
|
-
useContext?: string[] | undefined;
|
|
1120
|
-
useDebugValue?: string[] | undefined;
|
|
1121
|
-
useDeferredValue?: string[] | undefined;
|
|
1122
|
-
useEffect?: string[] | undefined;
|
|
1123
|
-
useFormStatus?: string[] | undefined;
|
|
1124
|
-
useId?: string[] | undefined;
|
|
1125
|
-
useImperativeHandle?: string[] | undefined;
|
|
1126
|
-
useInsertionEffect?: string[] | undefined;
|
|
1127
|
-
useLayoutEffect?: string[] | undefined;
|
|
1128
|
-
useMemo?: string[] | undefined;
|
|
1129
|
-
useOptimistic?: string[] | undefined;
|
|
1130
|
-
useReducer?: string[] | undefined;
|
|
1131
|
-
useRef?: string[] | undefined;
|
|
1132
|
-
useState?: string[] | undefined;
|
|
1133
|
-
useSyncExternalStore?: string[] | undefined;
|
|
1134
|
-
useTransition?: string[] | undefined;
|
|
1135
|
-
} | undefined;
|
|
1136
|
-
additionalComponents?: {
|
|
1137
|
-
name: string;
|
|
1138
|
-
as?: string | undefined;
|
|
1139
|
-
attributes?: {
|
|
1140
|
-
name: string;
|
|
1141
|
-
as?: string | undefined;
|
|
1142
|
-
controlled?: boolean | undefined;
|
|
1143
|
-
defaultValue?: string | undefined;
|
|
1144
|
-
}[] | undefined;
|
|
1145
|
-
selector?: string | undefined;
|
|
1146
|
-
}[] | undefined;
|
|
1147
|
-
}, {
|
|
1148
|
-
version?: string | undefined;
|
|
1149
|
-
importSource?: string | undefined;
|
|
1150
|
-
jsxPragma?: string | undefined;
|
|
1151
|
-
jsxPragmaFrag?: string | undefined;
|
|
1152
|
-
polymorphicPropName?: string | undefined;
|
|
1153
|
-
strict?: boolean | undefined;
|
|
1154
|
-
skipImportCheck?: boolean | undefined;
|
|
1155
|
-
additionalHooks?: {
|
|
1156
|
-
use?: string[] | undefined;
|
|
1157
|
-
useActionState?: string[] | undefined;
|
|
1158
|
-
useCallback?: string[] | undefined;
|
|
1159
|
-
useContext?: string[] | undefined;
|
|
1160
|
-
useDebugValue?: string[] | undefined;
|
|
1161
|
-
useDeferredValue?: string[] | undefined;
|
|
1162
|
-
useEffect?: string[] | undefined;
|
|
1163
|
-
useFormStatus?: string[] | undefined;
|
|
1164
|
-
useId?: string[] | undefined;
|
|
1165
|
-
useImperativeHandle?: string[] | undefined;
|
|
1166
|
-
useInsertionEffect?: string[] | undefined;
|
|
1167
|
-
useLayoutEffect?: string[] | undefined;
|
|
1168
|
-
useMemo?: string[] | undefined;
|
|
1169
|
-
useOptimistic?: string[] | undefined;
|
|
1170
|
-
useReducer?: string[] | undefined;
|
|
1171
|
-
useRef?: string[] | undefined;
|
|
1172
|
-
useState?: string[] | undefined;
|
|
1173
|
-
useSyncExternalStore?: string[] | undefined;
|
|
1174
|
-
useTransition?: string[] | undefined;
|
|
1175
|
-
} | undefined;
|
|
1176
|
-
additionalComponents?: {
|
|
1177
|
-
name: string;
|
|
1178
|
-
as?: string | undefined;
|
|
1179
|
-
attributes?: {
|
|
1180
|
-
name: string;
|
|
1181
|
-
as?: string | undefined;
|
|
1182
|
-
controlled?: boolean | undefined;
|
|
1183
|
-
defaultValue?: string | undefined;
|
|
1184
|
-
}[] | undefined;
|
|
1185
|
-
selector?: string | undefined;
|
|
1186
|
-
}[] | undefined;
|
|
1187
|
-
}>;
|
|
804
|
+
}, z.core.$strip>>>;
|
|
805
|
+
}, z.core.$strip>;
|
|
1188
806
|
/**
|
|
1189
807
|
* @internal
|
|
1190
808
|
*/
|
|
1191
809
|
declare const ESLintSettingsSchema: z.ZodOptional<z.ZodObject<{
|
|
1192
810
|
"react-x": z.ZodOptional<z.ZodUnknown>;
|
|
1193
|
-
},
|
|
1194
|
-
"react-x"?: unknown;
|
|
1195
|
-
}, {
|
|
1196
|
-
"react-x"?: unknown;
|
|
1197
|
-
}>>;
|
|
811
|
+
}, z.core.$strip>>;
|
|
1198
812
|
type CustomComponent = z.infer<typeof CustomComponentSchema>;
|
|
1199
813
|
type CustomComponentProp = z.infer<typeof CustomComponentPropSchema>;
|
|
1200
814
|
type CustomHooks = z.infer<typeof CustomHooksSchema>;
|
package/dist/index.js
CHANGED
|
@@ -4,31 +4,12 @@ var module$1 = require('module');
|
|
|
4
4
|
var eff = require('@eslint-react/eff');
|
|
5
5
|
var tsPattern = require('ts-pattern');
|
|
6
6
|
var kit = require('@eslint-react/kit');
|
|
7
|
-
var
|
|
7
|
+
var v4 = require('zod/v4');
|
|
8
8
|
|
|
9
9
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
10
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
|
|
12
|
-
function _interopNamespace(e) {
|
|
13
|
-
if (e && e.__esModule) return e;
|
|
14
|
-
var n = Object.create(null);
|
|
15
|
-
if (e) {
|
|
16
|
-
Object.keys(e).forEach(function (k) {
|
|
17
|
-
if (k !== 'default') {
|
|
18
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () { return e[k]; }
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
n.default = e;
|
|
27
|
-
return Object.freeze(n);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
12
|
var module__default = /*#__PURE__*/_interopDefault(module$1);
|
|
31
|
-
var z__namespace = /*#__PURE__*/_interopNamespace(z);
|
|
32
13
|
|
|
33
14
|
// src/constants.ts
|
|
34
15
|
var NPM_SCOPE = "@eslint-react";
|
|
@@ -54,144 +35,143 @@ function getReactVersion(fallback) {
|
|
|
54
35
|
return fallback;
|
|
55
36
|
}
|
|
56
37
|
}
|
|
57
|
-
var CustomComponentPropSchema =
|
|
38
|
+
var CustomComponentPropSchema = v4.z.object({
|
|
58
39
|
/**
|
|
59
40
|
* The name of the prop in the user-defined component.
|
|
60
41
|
* @example
|
|
61
42
|
* "to"
|
|
62
43
|
*/
|
|
63
|
-
name:
|
|
44
|
+
name: v4.z.string(),
|
|
64
45
|
/**
|
|
65
46
|
* The name of the prop in the host component.
|
|
66
47
|
* @example
|
|
67
48
|
* "href"
|
|
68
49
|
*/
|
|
69
|
-
as:
|
|
50
|
+
as: v4.z.optional(v4.z.string()),
|
|
70
51
|
/**
|
|
71
52
|
* Whether the prop is controlled or not in the user-defined component.
|
|
72
53
|
* @internal
|
|
73
54
|
* @example
|
|
74
55
|
* `true`
|
|
75
56
|
*/
|
|
76
|
-
controlled:
|
|
57
|
+
controlled: v4.z.optional(v4.z.boolean()),
|
|
77
58
|
/**
|
|
78
59
|
* The default value of the prop in the user-defined component.
|
|
79
60
|
* @example
|
|
80
61
|
* `"/"`
|
|
81
62
|
*/
|
|
82
|
-
defaultValue:
|
|
63
|
+
defaultValue: v4.z.optional(v4.z.string())
|
|
83
64
|
});
|
|
84
|
-
var CustomComponentSchema =
|
|
65
|
+
var CustomComponentSchema = v4.z.object({
|
|
85
66
|
/**
|
|
86
67
|
* The name of the user-defined component.
|
|
87
68
|
* @example
|
|
88
69
|
* "Link"
|
|
89
70
|
*/
|
|
90
|
-
name:
|
|
71
|
+
name: v4.z.string(),
|
|
91
72
|
/**
|
|
92
73
|
* The name of the host component that the user-defined component represents.
|
|
93
74
|
* @example
|
|
94
75
|
* "a"
|
|
95
76
|
*/
|
|
96
|
-
as:
|
|
77
|
+
as: v4.z.optional(v4.z.string()),
|
|
97
78
|
/**
|
|
98
79
|
* Attributes mapping between the user-defined component and the host component.
|
|
99
80
|
* @example
|
|
100
81
|
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
101
82
|
*/
|
|
102
|
-
attributes:
|
|
83
|
+
attributes: v4.z.optional(v4.z.array(CustomComponentPropSchema)),
|
|
103
84
|
/**
|
|
104
85
|
* The ESQuery selector to select the component precisely.
|
|
105
86
|
* @internal
|
|
106
87
|
* @example
|
|
107
88
|
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
108
89
|
*/
|
|
109
|
-
selector:
|
|
90
|
+
selector: v4.z.optional(v4.z.string())
|
|
110
91
|
});
|
|
111
|
-
var CustomHooksSchema =
|
|
112
|
-
use:
|
|
113
|
-
useActionState:
|
|
114
|
-
useCallback:
|
|
115
|
-
useContext:
|
|
116
|
-
useDebugValue:
|
|
117
|
-
useDeferredValue:
|
|
118
|
-
useEffect:
|
|
119
|
-
useFormStatus:
|
|
120
|
-
useId:
|
|
121
|
-
useImperativeHandle:
|
|
122
|
-
useInsertionEffect:
|
|
123
|
-
useLayoutEffect:
|
|
124
|
-
useMemo:
|
|
125
|
-
useOptimistic:
|
|
126
|
-
useReducer:
|
|
127
|
-
useRef:
|
|
128
|
-
useState:
|
|
129
|
-
useSyncExternalStore:
|
|
130
|
-
useTransition:
|
|
92
|
+
var CustomHooksSchema = v4.z.object({
|
|
93
|
+
use: v4.z.optional(v4.z.array(v4.z.string())),
|
|
94
|
+
useActionState: v4.z.optional(v4.z.array(v4.z.string())),
|
|
95
|
+
useCallback: v4.z.optional(v4.z.array(v4.z.string())),
|
|
96
|
+
useContext: v4.z.optional(v4.z.array(v4.z.string())),
|
|
97
|
+
useDebugValue: v4.z.optional(v4.z.array(v4.z.string())),
|
|
98
|
+
useDeferredValue: v4.z.optional(v4.z.array(v4.z.string())),
|
|
99
|
+
useEffect: v4.z.optional(v4.z.array(v4.z.string())),
|
|
100
|
+
useFormStatus: v4.z.optional(v4.z.array(v4.z.string())),
|
|
101
|
+
useId: v4.z.optional(v4.z.array(v4.z.string())),
|
|
102
|
+
useImperativeHandle: v4.z.optional(v4.z.array(v4.z.string())),
|
|
103
|
+
useInsertionEffect: v4.z.optional(v4.z.array(v4.z.string())),
|
|
104
|
+
useLayoutEffect: v4.z.optional(v4.z.array(v4.z.string())),
|
|
105
|
+
useMemo: v4.z.optional(v4.z.array(v4.z.string())),
|
|
106
|
+
useOptimistic: v4.z.optional(v4.z.array(v4.z.string())),
|
|
107
|
+
useReducer: v4.z.optional(v4.z.array(v4.z.string())),
|
|
108
|
+
useRef: v4.z.optional(v4.z.array(v4.z.string())),
|
|
109
|
+
useState: v4.z.optional(v4.z.array(v4.z.string())),
|
|
110
|
+
useSyncExternalStore: v4.z.optional(v4.z.array(v4.z.string())),
|
|
111
|
+
useTransition: v4.z.optional(v4.z.array(v4.z.string()))
|
|
131
112
|
});
|
|
132
|
-
var ESLintReactSettingsSchema =
|
|
113
|
+
var ESLintReactSettingsSchema = v4.z.object({
|
|
133
114
|
/**
|
|
134
115
|
* The source where React is imported from.
|
|
135
116
|
* @description This allows to specify a custom import location for React when not using the official distribution.
|
|
136
117
|
* @default `"react"`
|
|
137
118
|
* @example `"@pika/react"`
|
|
138
119
|
*/
|
|
139
|
-
importSource:
|
|
120
|
+
importSource: v4.z.optional(v4.z.string()),
|
|
140
121
|
/**
|
|
141
122
|
* The identifier that's used for JSX Element creation.
|
|
142
123
|
* @default `"createElement"`
|
|
143
124
|
* @deprecated
|
|
144
125
|
*/
|
|
145
|
-
jsxPragma:
|
|
126
|
+
jsxPragma: v4.z.optional(v4.z.string()),
|
|
146
127
|
/**
|
|
147
128
|
* The identifier that's used for JSX fragment elements.
|
|
148
129
|
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
149
130
|
* @default `"Fragment"`
|
|
150
131
|
* @deprecated
|
|
151
132
|
*/
|
|
152
|
-
jsxPragmaFrag:
|
|
133
|
+
jsxPragmaFrag: v4.z.optional(v4.z.string()),
|
|
153
134
|
/**
|
|
154
135
|
* The name of the prop that is used for polymorphic components.
|
|
155
136
|
* @description This is used to determine the type of the component.
|
|
156
137
|
* @example `"as"`
|
|
157
138
|
*/
|
|
158
|
-
polymorphicPropName:
|
|
139
|
+
polymorphicPropName: v4.z.optional(v4.z.string()),
|
|
159
140
|
/**
|
|
160
141
|
* @default `true`
|
|
161
142
|
* @internal
|
|
162
143
|
*/
|
|
163
|
-
strict:
|
|
144
|
+
strict: v4.z.optional(v4.z.boolean()),
|
|
164
145
|
/**
|
|
165
146
|
* Check both the shape and the import to determine if an API is from React.
|
|
166
147
|
* @default `true`
|
|
167
148
|
* @internal
|
|
168
149
|
*/
|
|
169
|
-
skipImportCheck:
|
|
150
|
+
skipImportCheck: v4.z.optional(v4.z.boolean()),
|
|
170
151
|
/**
|
|
171
152
|
* React version to use, "detect" means auto detect React version from the project's dependencies.
|
|
172
153
|
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
173
154
|
* @example `"18.3.1"`
|
|
174
155
|
* @default `"detect"`
|
|
175
156
|
*/
|
|
176
|
-
version:
|
|
157
|
+
version: v4.z.optional(v4.z.string()),
|
|
177
158
|
/**
|
|
178
159
|
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
179
160
|
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
180
161
|
* @example `{ useEffect: ["useIsomorphicLayoutEffect"] }`
|
|
181
162
|
*/
|
|
182
|
-
additionalHooks:
|
|
163
|
+
additionalHooks: v4.z.optional(CustomHooksSchema),
|
|
183
164
|
/**
|
|
184
165
|
* An array of user-defined components
|
|
185
166
|
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
186
167
|
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
187
168
|
*/
|
|
188
|
-
additionalComponents:
|
|
169
|
+
additionalComponents: v4.z.optional(v4.z.array(CustomComponentSchema))
|
|
189
170
|
});
|
|
190
|
-
var ESLintSettingsSchema =
|
|
191
|
-
|
|
192
|
-
"react-x":
|
|
193
|
-
})
|
|
194
|
-
{}
|
|
171
|
+
var ESLintSettingsSchema = v4.z.optional(
|
|
172
|
+
v4.z.object({
|
|
173
|
+
"react-x": v4.z.optional(v4.z.unknown())
|
|
174
|
+
})
|
|
195
175
|
);
|
|
196
176
|
function isESLintSettings(settings) {
|
|
197
177
|
return ESLintSettingsSchema.safeParse(settings).success;
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import module from 'module';
|
|
|
2
2
|
import { identity, getOrElseUpdate } from '@eslint-react/eff';
|
|
3
3
|
import { match, P } from 'ts-pattern';
|
|
4
4
|
import { RegExp } from '@eslint-react/kit';
|
|
5
|
-
import
|
|
5
|
+
import { z } from 'zod/v4';
|
|
6
6
|
|
|
7
7
|
// src/constants.ts
|
|
8
8
|
var NPM_SCOPE = "@eslint-react";
|
|
@@ -164,8 +164,7 @@ var ESLintReactSettingsSchema = z.object({
|
|
|
164
164
|
var ESLintSettingsSchema = z.optional(
|
|
165
165
|
z.object({
|
|
166
166
|
"react-x": z.optional(z.unknown())
|
|
167
|
-
})
|
|
168
|
-
{}
|
|
167
|
+
})
|
|
169
168
|
);
|
|
170
169
|
function isESLintSettings(settings) {
|
|
171
170
|
return ESLintSettingsSchema.safeParse(settings).success;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "1.50.0-beta.
|
|
3
|
+
"version": "1.50.0-beta.7",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@typescript-eslint/utils": "^8.32.1",
|
|
39
39
|
"ts-pattern": "^5.7.1",
|
|
40
40
|
"zod": "^3.25.28",
|
|
41
|
-
"@eslint-react/
|
|
42
|
-
"@eslint-react/
|
|
41
|
+
"@eslint-react/eff": "1.50.0-beta.7",
|
|
42
|
+
"@eslint-react/kit": "1.50.0-beta.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@tsconfig/node22": "^22.0.2",
|