@eslint-react/shared 2.0.0-next.21 → 2.0.0-next.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +81 -222
- package/dist/index.js +2 -3
- package/package.json +4 -4
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
|
* @internal
|
|
@@ -723,239 +723,98 @@ type PartialObjectDeep<ObjectType extends object, Options extends Required<Parti
|
|
|
723
723
|
[KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options>
|
|
724
724
|
});
|
|
725
725
|
|
|
726
|
-
declare const CustomComponentPropSchema: z.
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
name: z.ZodMiniString<string>;
|
|
733
|
-
/**
|
|
734
|
-
* The name of the prop in the host component.
|
|
735
|
-
* @example
|
|
736
|
-
* "href"
|
|
737
|
-
*/
|
|
738
|
-
as: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
739
|
-
/**
|
|
740
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
741
|
-
* @internal
|
|
742
|
-
* @example
|
|
743
|
-
* `true`
|
|
744
|
-
*/
|
|
745
|
-
controlled: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
746
|
-
/**
|
|
747
|
-
* The default value of the prop in the user-defined component.
|
|
748
|
-
* @example
|
|
749
|
-
* `"/"`
|
|
750
|
-
*/
|
|
751
|
-
defaultValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
752
|
-
}, {}, {}>;
|
|
726
|
+
declare const CustomComponentPropSchema: z.ZodObject<{
|
|
727
|
+
name: z.ZodString;
|
|
728
|
+
as: z.ZodOptional<z.ZodString>;
|
|
729
|
+
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
730
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
731
|
+
}, z.core.$strip>;
|
|
753
732
|
/**
|
|
754
733
|
* @description
|
|
755
734
|
* This will provide some key information to the rule before checking for user-defined components.
|
|
756
735
|
* For example:
|
|
757
736
|
* Which prop is used as the `href` prop for the user-defined `Link` component that represents the built-in `a` element.
|
|
758
737
|
*/
|
|
759
|
-
declare const CustomComponentSchema: z.
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
792
|
-
* @internal
|
|
793
|
-
* @example
|
|
794
|
-
* `true`
|
|
795
|
-
*/
|
|
796
|
-
controlled: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
797
|
-
/**
|
|
798
|
-
* The default value of the prop in the user-defined component.
|
|
799
|
-
* @example
|
|
800
|
-
* `"/"`
|
|
801
|
-
*/
|
|
802
|
-
defaultValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
803
|
-
}, {}, {}>>>;
|
|
804
|
-
/**
|
|
805
|
-
* The ESQuery selector to select the component precisely.
|
|
806
|
-
* @internal
|
|
807
|
-
* @example
|
|
808
|
-
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
809
|
-
*/
|
|
810
|
-
selector: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
811
|
-
}, {}, {}>;
|
|
812
|
-
declare const CustomHooksSchema: z.ZodMiniObject<{
|
|
813
|
-
use: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
814
|
-
useActionState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
815
|
-
useCallback: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
816
|
-
useContext: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
817
|
-
useDebugValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
818
|
-
useDeferredValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
819
|
-
useEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
820
|
-
useFormStatus: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
821
|
-
useId: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
822
|
-
useImperativeHandle: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
823
|
-
useInsertionEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
824
|
-
useLayoutEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
825
|
-
useMemo: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
826
|
-
useOptimistic: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
827
|
-
useReducer: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
828
|
-
useRef: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
829
|
-
useState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
830
|
-
useSyncExternalStore: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
831
|
-
useTransition: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
832
|
-
}, {}, {}>;
|
|
738
|
+
declare const CustomComponentSchema: z.ZodObject<{
|
|
739
|
+
name: z.ZodString;
|
|
740
|
+
as: z.ZodOptional<z.ZodString>;
|
|
741
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
742
|
+
name: z.ZodString;
|
|
743
|
+
as: z.ZodOptional<z.ZodString>;
|
|
744
|
+
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
745
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
746
|
+
}, z.core.$strip>>>;
|
|
747
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
748
|
+
}, z.core.$strip>;
|
|
749
|
+
declare const CustomHooksSchema: z.ZodObject<{
|
|
750
|
+
use: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
751
|
+
useActionState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
752
|
+
useCallback: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
753
|
+
useContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
754
|
+
useDebugValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
755
|
+
useDeferredValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
756
|
+
useEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
757
|
+
useFormStatus: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
758
|
+
useId: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
759
|
+
useImperativeHandle: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
760
|
+
useInsertionEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
761
|
+
useLayoutEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
762
|
+
useMemo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
763
|
+
useOptimistic: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
764
|
+
useReducer: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
765
|
+
useRef: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
766
|
+
useState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
767
|
+
useSyncExternalStore: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
768
|
+
useTransition: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
769
|
+
}, z.core.$strip>;
|
|
833
770
|
/**
|
|
834
771
|
* @internal
|
|
835
772
|
*/
|
|
836
|
-
declare const ESLintReactSettingsSchema: z.
|
|
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
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
useActionState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
876
|
-
useCallback: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
877
|
-
useContext: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
878
|
-
useDebugValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
879
|
-
useDeferredValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
880
|
-
useEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
881
|
-
useFormStatus: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
882
|
-
useId: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
883
|
-
useImperativeHandle: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
884
|
-
useInsertionEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
885
|
-
useLayoutEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
886
|
-
useMemo: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
887
|
-
useOptimistic: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
888
|
-
useReducer: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
889
|
-
useRef: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
890
|
-
useState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
891
|
-
useSyncExternalStore: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
892
|
-
useTransition: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
893
|
-
}, {}, {}>>;
|
|
894
|
-
/**
|
|
895
|
-
* An array of user-defined components
|
|
896
|
-
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
897
|
-
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
898
|
-
*/
|
|
899
|
-
additionalComponents: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
900
|
-
/**
|
|
901
|
-
* The name of the user-defined component.
|
|
902
|
-
* @example
|
|
903
|
-
* "Link"
|
|
904
|
-
*/
|
|
905
|
-
name: z.ZodMiniString<string>;
|
|
906
|
-
/**
|
|
907
|
-
* The name of the host component that the user-defined component represents.
|
|
908
|
-
* @example
|
|
909
|
-
* "a"
|
|
910
|
-
*/
|
|
911
|
-
as: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
912
|
-
/**
|
|
913
|
-
* Attributes mapping between the user-defined component and the host component.
|
|
914
|
-
* @example
|
|
915
|
-
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
916
|
-
*/
|
|
917
|
-
attributes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
918
|
-
/**
|
|
919
|
-
* The name of the prop in the user-defined component.
|
|
920
|
-
* @example
|
|
921
|
-
* "to"
|
|
922
|
-
*/
|
|
923
|
-
name: z.ZodMiniString<string>;
|
|
924
|
-
/**
|
|
925
|
-
* The name of the prop in the host component.
|
|
926
|
-
* @example
|
|
927
|
-
* "href"
|
|
928
|
-
*/
|
|
929
|
-
as: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
930
|
-
/**
|
|
931
|
-
* Whether the prop is controlled or not in the user-defined component.
|
|
932
|
-
* @internal
|
|
933
|
-
* @example
|
|
934
|
-
* `true`
|
|
935
|
-
*/
|
|
936
|
-
controlled: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
937
|
-
/**
|
|
938
|
-
* The default value of the prop in the user-defined component.
|
|
939
|
-
* @example
|
|
940
|
-
* `"/"`
|
|
941
|
-
*/
|
|
942
|
-
defaultValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
943
|
-
}, {}, {}>>>;
|
|
944
|
-
/**
|
|
945
|
-
* The ESQuery selector to select the component precisely.
|
|
946
|
-
* @internal
|
|
947
|
-
* @example
|
|
948
|
-
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
949
|
-
*/
|
|
950
|
-
selector: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
951
|
-
}, {}, {}>>>;
|
|
952
|
-
}, {}, {}>;
|
|
773
|
+
declare const ESLintReactSettingsSchema: z.ZodObject<{
|
|
774
|
+
importSource: z.ZodOptional<z.ZodString>;
|
|
775
|
+
polymorphicPropName: z.ZodOptional<z.ZodString>;
|
|
776
|
+
strict: z.ZodOptional<z.ZodBoolean>;
|
|
777
|
+
skipImportCheck: z.ZodOptional<z.ZodBoolean>;
|
|
778
|
+
version: z.ZodOptional<z.ZodString>;
|
|
779
|
+
additionalHooks: z.ZodOptional<z.ZodObject<{
|
|
780
|
+
use: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
781
|
+
useActionState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
782
|
+
useCallback: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
783
|
+
useContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
784
|
+
useDebugValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
785
|
+
useDeferredValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
786
|
+
useEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
787
|
+
useFormStatus: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
788
|
+
useId: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
789
|
+
useImperativeHandle: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
790
|
+
useInsertionEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
791
|
+
useLayoutEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
792
|
+
useMemo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
793
|
+
useOptimistic: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
794
|
+
useReducer: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
795
|
+
useRef: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
796
|
+
useState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
797
|
+
useSyncExternalStore: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
798
|
+
useTransition: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
799
|
+
}, z.core.$strip>>;
|
|
800
|
+
additionalComponents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
801
|
+
name: z.ZodString;
|
|
802
|
+
as: z.ZodOptional<z.ZodString>;
|
|
803
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
804
|
+
name: z.ZodString;
|
|
805
|
+
as: z.ZodOptional<z.ZodString>;
|
|
806
|
+
controlled: z.ZodOptional<z.ZodBoolean>;
|
|
807
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
808
|
+
}, z.core.$strip>>>;
|
|
809
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
810
|
+
}, z.core.$strip>>>;
|
|
811
|
+
}, z.core.$strip>;
|
|
953
812
|
/**
|
|
954
813
|
* @internal
|
|
955
814
|
*/
|
|
956
|
-
declare const ESLintSettingsSchema: z.
|
|
957
|
-
"react-x": z.
|
|
958
|
-
},
|
|
815
|
+
declare const ESLintSettingsSchema: z.ZodOptional<z.ZodObject<{
|
|
816
|
+
"react-x": z.ZodOptional<z.ZodUnknown>;
|
|
817
|
+
}, z.core.$strip>>;
|
|
959
818
|
type CustomComponent = z.infer<typeof CustomComponentSchema>;
|
|
960
819
|
type CustomComponentProp = z.infer<typeof CustomComponentPropSchema>;
|
|
961
820
|
type CustomHooks = z.infer<typeof CustomHooksSchema>;
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'path';
|
|
|
3
3
|
import { identity, getOrElseUpdate } from '@eslint-react/eff';
|
|
4
4
|
import { match, P } from 'ts-pattern';
|
|
5
5
|
import { RegExp } from '@eslint-react/kit';
|
|
6
|
-
import
|
|
6
|
+
import { z } from 'zod/v4';
|
|
7
7
|
|
|
8
8
|
// src/_id.ts
|
|
9
9
|
var id = 0n;
|
|
@@ -152,8 +152,7 @@ var ESLintReactSettingsSchema = z.object({
|
|
|
152
152
|
var ESLintSettingsSchema = z.optional(
|
|
153
153
|
z.object({
|
|
154
154
|
"react-x": z.optional(z.unknown())
|
|
155
|
-
})
|
|
156
|
-
{}
|
|
155
|
+
})
|
|
157
156
|
);
|
|
158
157
|
function isESLintSettings(settings) {
|
|
159
158
|
return ESLintSettingsSchema.safeParse(settings).success;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.23",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@typescript-eslint/utils": "^8.32.1",
|
|
31
|
-
"@zod/mini": "^4.0.0-beta.20250505T195954",
|
|
32
31
|
"ts-pattern": "^5.7.1",
|
|
33
|
-
"
|
|
34
|
-
"@eslint-react/
|
|
32
|
+
"zod": "^3.25.28",
|
|
33
|
+
"@eslint-react/eff": "2.0.0-next.23",
|
|
34
|
+
"@eslint-react/kit": "2.0.0-next.23"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@tsconfig/node22": "^22.0.2",
|