@eslint-react/shared 2.0.0-next.14 → 2.0.0-next.141

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +84 -240
  2. package/dist/index.js +4 -18
  3. package/package.json +10 -11
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { _ } from '@eslint-react/eff';
1
+ import { unit } from '@eslint-react/eff';
2
2
  import { RuleContext } from '@eslint-react/kit';
3
- import * as z from '@zod/mini';
3
+ import { z } from 'zod/v4';
4
4
 
5
5
  /**
6
6
  * @internal
@@ -723,252 +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.ZodMiniObject<{
727
- /**
728
- * The name of the prop in the user-defined component.
729
- * @example
730
- * "to"
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.ZodMiniObject<{
760
- /**
761
- * The name of the user-defined component.
762
- * @example
763
- * "Link"
764
- */
765
- name: z.ZodMiniString<string>;
766
- /**
767
- * The name of the host component that the user-defined component represents.
768
- * @example
769
- * "a"
770
- */
771
- as: z.ZodMiniOptional<z.ZodMiniString<string>>;
772
- /**
773
- * Attributes mapping between the user-defined component and the host component.
774
- * @example
775
- * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
776
- */
777
- attributes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
778
- /**
779
- * The name of the prop in the user-defined component.
780
- * @example
781
- * "to"
782
- */
783
- name: z.ZodMiniString<string>;
784
- /**
785
- * The name of the prop in the host component.
786
- * @example
787
- * "href"
788
- */
789
- as: z.ZodMiniOptional<z.ZodMiniString<string>>;
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.ZodMiniObject<{
837
- /**
838
- * The source where React is imported from.
839
- * @description This allows to specify a custom import location for React when not using the official distribution.
840
- * @default `"react"`
841
- * @example `"@pika/react"`
842
- */
843
- importSource: z.ZodMiniOptional<z.ZodMiniString<string>>;
844
- /**
845
- * The identifier that's used for JSX Element creation.
846
- * @default `"createElement"`
847
- * @deprecated
848
- */
849
- jsxPragma: z.ZodMiniOptional<z.ZodMiniString<string>>;
850
- /**
851
- * The identifier that's used for JSX fragment elements.
852
- * @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
853
- * @default `"Fragment"`
854
- * @deprecated
855
- */
856
- jsxPragmaFrag: z.ZodMiniOptional<z.ZodMiniString<string>>;
857
- /**
858
- * The name of the prop that is used for polymorphic components.
859
- * @description This is used to determine the type of the component.
860
- * @example `"as"`
861
- */
862
- polymorphicPropName: z.ZodMiniOptional<z.ZodMiniString<string>>;
863
- /**
864
- * @default `true`
865
- * @internal
866
- */
867
- strict: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
868
- /**
869
- * Check both the shape and the import to determine if an API is from React.
870
- * @default `true`
871
- * @internal
872
- */
873
- skipImportCheck: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
874
- /**
875
- * React version to use, "detect" means auto detect React version from the project's dependencies.
876
- * If `importSource` is specified, an equivalent version of React should be provided here.
877
- * @example `"18.3.1"`
878
- * @default `"detect"`
879
- */
880
- version: z.ZodMiniOptional<z.ZodMiniString<string>>;
881
- /**
882
- * A object to define additional hooks that are equivalent to the built-in React Hooks.
883
- * @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
884
- * @example `{ useEffect: ["useIsomorphicLayoutEffect"] }`
885
- */
886
- additionalHooks: z.ZodMiniOptional<z.ZodMiniObject<{
887
- use: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
888
- useActionState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
889
- useCallback: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
890
- useContext: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
891
- useDebugValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
892
- useDeferredValue: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
893
- useEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
894
- useFormStatus: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
895
- useId: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
896
- useImperativeHandle: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
897
- useInsertionEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
898
- useLayoutEffect: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
899
- useMemo: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
900
- useOptimistic: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
901
- useReducer: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
902
- useRef: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
903
- useState: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
904
- useSyncExternalStore: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
905
- useTransition: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
906
- }, {}>>;
907
- /**
908
- * An array of user-defined components
909
- * @description This is used to inform the ESLint React plugins how to treat these components during checks.
910
- * @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
911
- */
912
- additionalComponents: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
913
- /**
914
- * The name of the user-defined component.
915
- * @example
916
- * "Link"
917
- */
918
- name: z.ZodMiniString<string>;
919
- /**
920
- * The name of the host component that the user-defined component represents.
921
- * @example
922
- * "a"
923
- */
924
- as: z.ZodMiniOptional<z.ZodMiniString<string>>;
925
- /**
926
- * Attributes mapping between the user-defined component and the host component.
927
- * @example
928
- * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
929
- */
930
- attributes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
931
- /**
932
- * The name of the prop in the user-defined component.
933
- * @example
934
- * "to"
935
- */
936
- name: z.ZodMiniString<string>;
937
- /**
938
- * The name of the prop in the host component.
939
- * @example
940
- * "href"
941
- */
942
- as: z.ZodMiniOptional<z.ZodMiniString<string>>;
943
- /**
944
- * Whether the prop is controlled or not in the user-defined component.
945
- * @internal
946
- * @example
947
- * `true`
948
- */
949
- controlled: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
950
- /**
951
- * The default value of the prop in the user-defined component.
952
- * @example
953
- * `"/"`
954
- */
955
- defaultValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
956
- }, {}>>>;
957
- /**
958
- * The ESQuery selector to select the component precisely.
959
- * @internal
960
- * @example
961
- * `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
962
- */
963
- selector: z.ZodMiniOptional<z.ZodMiniString<string>>;
964
- }, {}>>>;
965
- }, {}>;
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>;
966
812
  /**
967
813
  * @internal
968
814
  */
969
- declare const ESLintSettingsSchema: z.ZodMiniOptional<z.ZodMiniObject<{
970
- "react-x": z.ZodMiniOptional<z.ZodMiniUnknown>;
971
- }, {}>>;
815
+ declare const ESLintSettingsSchema: z.ZodOptional<z.ZodObject<{
816
+ "react-x": z.ZodOptional<z.ZodUnknown>;
817
+ }, z.core.$strip>>;
972
818
  type CustomComponent = z.infer<typeof CustomComponentSchema>;
973
819
  type CustomComponentProp = z.infer<typeof CustomComponentPropSchema>;
974
820
  type CustomHooks = z.infer<typeof CustomHooksSchema>;
@@ -1008,7 +854,7 @@ declare const DEFAULT_ESLINT_SETTINGS: {
1008
854
  interface CustomComponentPropNormalized {
1009
855
  name: string;
1010
856
  as: string;
1011
- defaultValue?: string | _;
857
+ defaultValue?: string | unit;
1012
858
  }
1013
859
  interface CustomComponentNormalized {
1014
860
  name: string;
@@ -1022,7 +868,7 @@ interface ESLintReactSettingsNormalized {
1022
868
  additionalHooks: CustomHooks;
1023
869
  components: CustomComponentNormalized[];
1024
870
  importSource: string;
1025
- polymorphicPropName: string | _;
871
+ polymorphicPropName: string | unit;
1026
872
  skipImportCheck: boolean;
1027
873
  strict: boolean;
1028
874
  version: string;
@@ -1072,8 +918,6 @@ declare const normalizeSettings: ({ additionalComponents, additionalHooks, impor
1072
918
  readonly skipImportCheck: boolean;
1073
919
  readonly strict: boolean;
1074
920
  readonly version: string;
1075
- readonly jsxPragma?: string | undefined;
1076
- readonly jsxPragmaFrag?: string | undefined;
1077
921
  };
1078
922
  declare function getSettingsFromContext(context: RuleContext): ESLintReactSettingsNormalized;
1079
923
  /**
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import module from 'node:module';
2
- import path from 'node:path';
1
+ import module from 'module';
2
+ 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 * as z from '@zod/mini';
6
+ import { z } from 'zod/v4';
7
7
 
8
8
  // src/_id.ts
9
9
  var id = 0n;
@@ -112,19 +112,6 @@ var ESLintReactSettingsSchema = z.object({
112
112
  * @example `"@pika/react"`
113
113
  */
114
114
  importSource: z.optional(z.string()),
115
- /**
116
- * The identifier that's used for JSX Element creation.
117
- * @default `"createElement"`
118
- * @deprecated
119
- */
120
- jsxPragma: z.optional(z.string()),
121
- /**
122
- * The identifier that's used for JSX fragment elements.
123
- * @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
124
- * @default `"Fragment"`
125
- * @deprecated
126
- */
127
- jsxPragmaFrag: z.optional(z.string()),
128
115
  /**
129
116
  * The name of the prop that is used for polymorphic components.
130
117
  * @description This is used to determine the type of the component.
@@ -165,8 +152,7 @@ var ESLintReactSettingsSchema = z.object({
165
152
  var ESLintSettingsSchema = z.optional(
166
153
  z.object({
167
154
  "react-x": z.optional(z.unknown())
168
- }),
169
- {}
155
+ })
170
156
  );
171
157
  function isESLintSettings(settings) {
172
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.14",
3
+ "version": "2.0.0-next.141",
4
4
  "description": "ESLint React's Shared constants and functions.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -27,21 +27,20 @@
27
27
  "./package.json"
28
28
  ],
29
29
  "dependencies": {
30
- "@typescript-eslint/utils": "^8.31.1",
31
- "@zod/mini": "^4.0.0-beta.20250503T014749",
32
- "ts-pattern": "^5.7.0",
33
- "@eslint-react/eff": "2.0.0-next.14",
34
- "@eslint-react/kit": "2.0.0-next.14"
30
+ "@typescript-eslint/utils": "^8.40.0",
31
+ "ts-pattern": "^5.8.0",
32
+ "zod": "^4.0.17",
33
+ "@eslint-react/eff": "2.0.0-next.141",
34
+ "@eslint-react/kit": "2.0.0-next.141"
35
35
  },
36
36
  "devDependencies": {
37
- "@tsconfig/node22": "^22.0.1",
38
- "@types/picomatch": "^4.0.0",
39
- "tsup": "^8.4.0",
40
- "type-fest": "^4.40.1",
37
+ "@tsconfig/node22": "^22.0.2",
38
+ "@types/picomatch": "^4.0.2",
39
+ "tsup": "^8.5.0",
40
+ "type-fest": "^4.41.0",
41
41
  "@local/configs": "0.0.0"
42
42
  },
43
43
  "engines": {
44
- "bun": ">=1.0.15",
45
44
  "node": ">=20.19.0"
46
45
  },
47
46
  "scripts": {