@eslint-react/shared 1.50.0-beta.3 → 1.50.0-beta.6
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 +83 -235
- package/dist/index.d.ts +83 -235
- package/dist/index.js +45 -65
- package/dist/index.mjs +2 -3
- package/package.json +4 -4
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.
|
|
@@ -715,252 +715,100 @@ type PartialObjectDeep<ObjectType extends object, Options extends Required<Parti
|
|
|
715
715
|
[KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options>
|
|
716
716
|
});
|
|
717
717
|
|
|
718
|
-
declare const CustomComponentPropSchema: z.
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
name: z.ZodMiniString<string>;
|
|
725
|
-
/**
|
|
726
|
-
* The name of the prop in the host component.
|
|
727
|
-
* @example
|
|
728
|
-
* "href"
|
|
729
|
-
*/
|
|
730
|
-
as: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
731
|
-
/**
|
|
732
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
733
|
-
* @internal
|
|
734
|
-
* @example
|
|
735
|
-
* `true`
|
|
736
|
-
*/
|
|
737
|
-
controlled: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
738
|
-
/**
|
|
739
|
-
* The default value of the prop in the user-defined component.
|
|
740
|
-
* @example
|
|
741
|
-
* `"/"`
|
|
742
|
-
*/
|
|
743
|
-
defaultValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
744
|
-
}, {}, {}>;
|
|
718
|
+
declare const CustomComponentPropSchema: z.ZodObject<{
|
|
719
|
+
name: z.ZodString;
|
|
720
|
+
as: z.ZodOptional<z.ZodString>;
|
|
721
|
+
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
722
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
723
|
+
}, z.core.$strip>;
|
|
745
724
|
/**
|
|
746
725
|
* @description
|
|
747
726
|
* This will provide some key information to the rule before checking for user-defined components.
|
|
748
727
|
* For example:
|
|
749
728
|
* Which prop is used as the `href` prop for the user-defined `Link` component that represents the built-in `a` element.
|
|
750
729
|
*/
|
|
751
|
-
declare const CustomComponentSchema: z.
|
|
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
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
784
|
-
* @internal
|
|
785
|
-
* @example
|
|
786
|
-
* `true`
|
|
787
|
-
*/
|
|
788
|
-
controlled: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
789
|
-
/**
|
|
790
|
-
* The default value of the prop in the user-defined component.
|
|
791
|
-
* @example
|
|
792
|
-
* `"/"`
|
|
793
|
-
*/
|
|
794
|
-
defaultValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
795
|
-
}, {}, {}>>>;
|
|
796
|
-
/**
|
|
797
|
-
* The ESQuery selector to select the component precisely.
|
|
798
|
-
* @internal
|
|
799
|
-
* @example
|
|
800
|
-
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
801
|
-
*/
|
|
802
|
-
selector: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
803
|
-
}, {}, {}>;
|
|
804
|
-
declare const CustomHooksSchema: z.ZodMiniObject<{
|
|
805
|
-
use: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
806
|
-
useActionState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
807
|
-
useCallback: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
808
|
-
useContext: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
809
|
-
useDebugValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
810
|
-
useDeferredValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
811
|
-
useEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
812
|
-
useFormStatus: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
813
|
-
useId: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
814
|
-
useImperativeHandle: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
815
|
-
useInsertionEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
816
|
-
useLayoutEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
817
|
-
useMemo: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
818
|
-
useOptimistic: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
819
|
-
useReducer: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
820
|
-
useRef: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
821
|
-
useState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
822
|
-
useSyncExternalStore: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
823
|
-
useTransition: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
824
|
-
}, {}, {}>;
|
|
730
|
+
declare const CustomComponentSchema: z.ZodObject<{
|
|
731
|
+
name: z.ZodString;
|
|
732
|
+
as: z.ZodOptional<z.ZodString>;
|
|
733
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
734
|
+
name: z.ZodString;
|
|
735
|
+
as: z.ZodOptional<z.ZodString>;
|
|
736
|
+
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
737
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
738
|
+
}, z.core.$strip>>>;
|
|
739
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
740
|
+
}, z.core.$strip>;
|
|
741
|
+
declare const CustomHooksSchema: z.ZodObject<{
|
|
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>;
|
|
825
762
|
/**
|
|
826
763
|
* @internal
|
|
827
764
|
*/
|
|
828
|
-
declare const ESLintReactSettingsSchema: z.
|
|
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
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
* @example `"18.3.1"`
|
|
870
|
-
* @default `"detect"`
|
|
871
|
-
*/
|
|
872
|
-
version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
873
|
-
/**
|
|
874
|
-
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
875
|
-
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
876
|
-
* @example `{ useEffect: ["useIsomorphicLayoutEffect"] }`
|
|
877
|
-
*/
|
|
878
|
-
additionalHooks: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
879
|
-
use: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
880
|
-
useActionState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
881
|
-
useCallback: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
882
|
-
useContext: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
883
|
-
useDebugValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
884
|
-
useDeferredValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
885
|
-
useEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
886
|
-
useFormStatus: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
887
|
-
useId: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
888
|
-
useImperativeHandle: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
889
|
-
useInsertionEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
890
|
-
useLayoutEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
891
|
-
useMemo: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
892
|
-
useOptimistic: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
893
|
-
useReducer: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
894
|
-
useRef: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
895
|
-
useState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
896
|
-
useSyncExternalStore: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
897
|
-
useTransition: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
898
|
-
}, {}, {}>>;
|
|
899
|
-
/**
|
|
900
|
-
* An array of user-defined components
|
|
901
|
-
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
902
|
-
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
903
|
-
*/
|
|
904
|
-
additionalComponents: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
905
|
-
/**
|
|
906
|
-
* The name of the user-defined component.
|
|
907
|
-
* @example
|
|
908
|
-
* "Link"
|
|
909
|
-
*/
|
|
910
|
-
name: z.ZodMiniString<string>;
|
|
911
|
-
/**
|
|
912
|
-
* The name of the host component that the user-defined component represents.
|
|
913
|
-
* @example
|
|
914
|
-
* "a"
|
|
915
|
-
*/
|
|
916
|
-
as: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
917
|
-
/**
|
|
918
|
-
* Attributes mapping between the user-defined component and the host component.
|
|
919
|
-
* @example
|
|
920
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
921
|
-
*/
|
|
922
|
-
attributes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
923
|
-
/**
|
|
924
|
-
* The name of the prop in the user-defined component.
|
|
925
|
-
* @example
|
|
926
|
-
* "to"
|
|
927
|
-
*/
|
|
928
|
-
name: z.ZodMiniString<string>;
|
|
929
|
-
/**
|
|
930
|
-
* The name of the prop in the host component.
|
|
931
|
-
* @example
|
|
932
|
-
* "href"
|
|
933
|
-
*/
|
|
934
|
-
as: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
935
|
-
/**
|
|
936
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
937
|
-
* @internal
|
|
938
|
-
* @example
|
|
939
|
-
* `true`
|
|
940
|
-
*/
|
|
941
|
-
controlled: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
942
|
-
/**
|
|
943
|
-
* The default value of the prop in the user-defined component.
|
|
944
|
-
* @example
|
|
945
|
-
* `"/"`
|
|
946
|
-
*/
|
|
947
|
-
defaultValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
948
|
-
}, {}, {}>>>;
|
|
949
|
-
/**
|
|
950
|
-
* The ESQuery selector to select the component precisely.
|
|
951
|
-
* @internal
|
|
952
|
-
* @example
|
|
953
|
-
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
954
|
-
*/
|
|
955
|
-
selector: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
956
|
-
}, {}, {}>>>;
|
|
957
|
-
}, {}, {}>;
|
|
765
|
+
declare const ESLintReactSettingsSchema: z.ZodObject<{
|
|
766
|
+
importSource: z.ZodOptional<z.ZodString>;
|
|
767
|
+
jsxPragma: z.ZodOptional<z.ZodString>;
|
|
768
|
+
jsxPragmaFrag: z.ZodOptional<z.ZodString>;
|
|
769
|
+
polymorphicPropName: z.ZodOptional<z.ZodString>;
|
|
770
|
+
strict: z.ZodOptional<z.ZodBoolean>;
|
|
771
|
+
skipImportCheck: z.ZodOptional<z.ZodBoolean>;
|
|
772
|
+
version: z.ZodOptional<z.ZodString>;
|
|
773
|
+
additionalHooks: z.ZodOptional<z.ZodObject<{
|
|
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>>;
|
|
794
|
+
additionalComponents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
795
|
+
name: z.ZodString;
|
|
796
|
+
as: z.ZodOptional<z.ZodString>;
|
|
797
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
798
|
+
name: z.ZodString;
|
|
799
|
+
as: z.ZodOptional<z.ZodString>;
|
|
800
|
+
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
801
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
802
|
+
}, z.core.$strip>>>;
|
|
803
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
804
|
+
}, z.core.$strip>>>;
|
|
805
|
+
}, z.core.$strip>;
|
|
958
806
|
/**
|
|
959
807
|
* @internal
|
|
960
808
|
*/
|
|
961
|
-
declare const ESLintSettingsSchema: z.
|
|
962
|
-
"react-x": z.
|
|
963
|
-
},
|
|
809
|
+
declare const ESLintSettingsSchema: z.ZodOptional<z.ZodObject<{
|
|
810
|
+
"react-x": z.ZodOptional<z.ZodUnknown>;
|
|
811
|
+
}, z.core.$strip>>;
|
|
964
812
|
type CustomComponent = z.infer<typeof CustomComponentSchema>;
|
|
965
813
|
type CustomComponentProp = z.infer<typeof CustomComponentPropSchema>;
|
|
966
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.
|
|
@@ -715,252 +715,100 @@ type PartialObjectDeep<ObjectType extends object, Options extends Required<Parti
|
|
|
715
715
|
[KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options>
|
|
716
716
|
});
|
|
717
717
|
|
|
718
|
-
declare const CustomComponentPropSchema: z.
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
name: z.ZodMiniString<string>;
|
|
725
|
-
/**
|
|
726
|
-
* The name of the prop in the host component.
|
|
727
|
-
* @example
|
|
728
|
-
* "href"
|
|
729
|
-
*/
|
|
730
|
-
as: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
731
|
-
/**
|
|
732
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
733
|
-
* @internal
|
|
734
|
-
* @example
|
|
735
|
-
* `true`
|
|
736
|
-
*/
|
|
737
|
-
controlled: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
738
|
-
/**
|
|
739
|
-
* The default value of the prop in the user-defined component.
|
|
740
|
-
* @example
|
|
741
|
-
* `"/"`
|
|
742
|
-
*/
|
|
743
|
-
defaultValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
744
|
-
}, {}, {}>;
|
|
718
|
+
declare const CustomComponentPropSchema: z.ZodObject<{
|
|
719
|
+
name: z.ZodString;
|
|
720
|
+
as: z.ZodOptional<z.ZodString>;
|
|
721
|
+
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
722
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
723
|
+
}, z.core.$strip>;
|
|
745
724
|
/**
|
|
746
725
|
* @description
|
|
747
726
|
* This will provide some key information to the rule before checking for user-defined components.
|
|
748
727
|
* For example:
|
|
749
728
|
* Which prop is used as the `href` prop for the user-defined `Link` component that represents the built-in `a` element.
|
|
750
729
|
*/
|
|
751
|
-
declare const CustomComponentSchema: z.
|
|
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
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
784
|
-
* @internal
|
|
785
|
-
* @example
|
|
786
|
-
* `true`
|
|
787
|
-
*/
|
|
788
|
-
controlled: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
789
|
-
/**
|
|
790
|
-
* The default value of the prop in the user-defined component.
|
|
791
|
-
* @example
|
|
792
|
-
* `"/"`
|
|
793
|
-
*/
|
|
794
|
-
defaultValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
795
|
-
}, {}, {}>>>;
|
|
796
|
-
/**
|
|
797
|
-
* The ESQuery selector to select the component precisely.
|
|
798
|
-
* @internal
|
|
799
|
-
* @example
|
|
800
|
-
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
801
|
-
*/
|
|
802
|
-
selector: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
803
|
-
}, {}, {}>;
|
|
804
|
-
declare const CustomHooksSchema: z.ZodMiniObject<{
|
|
805
|
-
use: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
806
|
-
useActionState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
807
|
-
useCallback: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
808
|
-
useContext: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
809
|
-
useDebugValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
810
|
-
useDeferredValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
811
|
-
useEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
812
|
-
useFormStatus: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
813
|
-
useId: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
814
|
-
useImperativeHandle: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
815
|
-
useInsertionEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
816
|
-
useLayoutEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
817
|
-
useMemo: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
818
|
-
useOptimistic: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
819
|
-
useReducer: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
820
|
-
useRef: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
821
|
-
useState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
822
|
-
useSyncExternalStore: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
823
|
-
useTransition: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
824
|
-
}, {}, {}>;
|
|
730
|
+
declare const CustomComponentSchema: z.ZodObject<{
|
|
731
|
+
name: z.ZodString;
|
|
732
|
+
as: z.ZodOptional<z.ZodString>;
|
|
733
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
734
|
+
name: z.ZodString;
|
|
735
|
+
as: z.ZodOptional<z.ZodString>;
|
|
736
|
+
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
737
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
738
|
+
}, z.core.$strip>>>;
|
|
739
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
740
|
+
}, z.core.$strip>;
|
|
741
|
+
declare const CustomHooksSchema: z.ZodObject<{
|
|
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>;
|
|
825
762
|
/**
|
|
826
763
|
* @internal
|
|
827
764
|
*/
|
|
828
|
-
declare const ESLintReactSettingsSchema: z.
|
|
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
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
* @example `"18.3.1"`
|
|
870
|
-
* @default `"detect"`
|
|
871
|
-
*/
|
|
872
|
-
version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
873
|
-
/**
|
|
874
|
-
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
875
|
-
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
876
|
-
* @example `{ useEffect: ["useIsomorphicLayoutEffect"] }`
|
|
877
|
-
*/
|
|
878
|
-
additionalHooks: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
879
|
-
use: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
880
|
-
useActionState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
881
|
-
useCallback: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
882
|
-
useContext: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
883
|
-
useDebugValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
884
|
-
useDeferredValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
885
|
-
useEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
886
|
-
useFormStatus: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
887
|
-
useId: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
888
|
-
useImperativeHandle: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
889
|
-
useInsertionEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
890
|
-
useLayoutEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
891
|
-
useMemo: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
892
|
-
useOptimistic: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
893
|
-
useReducer: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
894
|
-
useRef: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
895
|
-
useState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
896
|
-
useSyncExternalStore: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
897
|
-
useTransition: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
898
|
-
}, {}, {}>>;
|
|
899
|
-
/**
|
|
900
|
-
* An array of user-defined components
|
|
901
|
-
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
902
|
-
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
903
|
-
*/
|
|
904
|
-
additionalComponents: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
905
|
-
/**
|
|
906
|
-
* The name of the user-defined component.
|
|
907
|
-
* @example
|
|
908
|
-
* "Link"
|
|
909
|
-
*/
|
|
910
|
-
name: z.ZodMiniString<string>;
|
|
911
|
-
/**
|
|
912
|
-
* The name of the host component that the user-defined component represents.
|
|
913
|
-
* @example
|
|
914
|
-
* "a"
|
|
915
|
-
*/
|
|
916
|
-
as: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
917
|
-
/**
|
|
918
|
-
* Attributes mapping between the user-defined component and the host component.
|
|
919
|
-
* @example
|
|
920
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
921
|
-
*/
|
|
922
|
-
attributes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
923
|
-
/**
|
|
924
|
-
* The name of the prop in the user-defined component.
|
|
925
|
-
* @example
|
|
926
|
-
* "to"
|
|
927
|
-
*/
|
|
928
|
-
name: z.ZodMiniString<string>;
|
|
929
|
-
/**
|
|
930
|
-
* The name of the prop in the host component.
|
|
931
|
-
* @example
|
|
932
|
-
* "href"
|
|
933
|
-
*/
|
|
934
|
-
as: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
935
|
-
/**
|
|
936
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
937
|
-
* @internal
|
|
938
|
-
* @example
|
|
939
|
-
* `true`
|
|
940
|
-
*/
|
|
941
|
-
controlled: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
942
|
-
/**
|
|
943
|
-
* The default value of the prop in the user-defined component.
|
|
944
|
-
* @example
|
|
945
|
-
* `"/"`
|
|
946
|
-
*/
|
|
947
|
-
defaultValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
948
|
-
}, {}, {}>>>;
|
|
949
|
-
/**
|
|
950
|
-
* The ESQuery selector to select the component precisely.
|
|
951
|
-
* @internal
|
|
952
|
-
* @example
|
|
953
|
-
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
954
|
-
*/
|
|
955
|
-
selector: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
956
|
-
}, {}, {}>>>;
|
|
957
|
-
}, {}, {}>;
|
|
765
|
+
declare const ESLintReactSettingsSchema: z.ZodObject<{
|
|
766
|
+
importSource: z.ZodOptional<z.ZodString>;
|
|
767
|
+
jsxPragma: z.ZodOptional<z.ZodString>;
|
|
768
|
+
jsxPragmaFrag: z.ZodOptional<z.ZodString>;
|
|
769
|
+
polymorphicPropName: z.ZodOptional<z.ZodString>;
|
|
770
|
+
strict: z.ZodOptional<z.ZodBoolean>;
|
|
771
|
+
skipImportCheck: z.ZodOptional<z.ZodBoolean>;
|
|
772
|
+
version: z.ZodOptional<z.ZodString>;
|
|
773
|
+
additionalHooks: z.ZodOptional<z.ZodObject<{
|
|
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>>;
|
|
794
|
+
additionalComponents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
795
|
+
name: z.ZodString;
|
|
796
|
+
as: z.ZodOptional<z.ZodString>;
|
|
797
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
798
|
+
name: z.ZodString;
|
|
799
|
+
as: z.ZodOptional<z.ZodString>;
|
|
800
|
+
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
801
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
802
|
+
}, z.core.$strip>>>;
|
|
803
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
804
|
+
}, z.core.$strip>>>;
|
|
805
|
+
}, z.core.$strip>;
|
|
958
806
|
/**
|
|
959
807
|
* @internal
|
|
960
808
|
*/
|
|
961
|
-
declare const ESLintSettingsSchema: z.
|
|
962
|
-
"react-x": z.
|
|
963
|
-
},
|
|
809
|
+
declare const ESLintSettingsSchema: z.ZodOptional<z.ZodObject<{
|
|
810
|
+
"react-x": z.ZodOptional<z.ZodUnknown>;
|
|
811
|
+
}, z.core.$strip>>;
|
|
964
812
|
type CustomComponent = z.infer<typeof CustomComponentSchema>;
|
|
965
813
|
type CustomComponentProp = z.infer<typeof CustomComponentPropSchema>;
|
|
966
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.6",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@typescript-eslint/utils": "^8.32.1",
|
|
39
|
-
"@zod/mini": "^4.0.0-beta.20250505T195954",
|
|
40
39
|
"ts-pattern": "^5.7.1",
|
|
41
|
-
"
|
|
42
|
-
"@eslint-react/eff": "1.50.0-beta.
|
|
40
|
+
"zod": "^3.25.28",
|
|
41
|
+
"@eslint-react/eff": "1.50.0-beta.6",
|
|
42
|
+
"@eslint-react/kit": "1.50.0-beta.6"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@tsconfig/node22": "^22.0.2",
|