@eslint-react/shared 2.0.0-next.172 → 2.0.0-next.174
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 +1 -90
- package/dist/index.js +4 -40
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -61,30 +61,6 @@ declare const getDocsUrl: (pluginName: string) => (ruleName: string) => string;
|
|
|
61
61
|
declare function getReactVersion(fallback: string): string;
|
|
62
62
|
//#endregion
|
|
63
63
|
//#region src/settings.d.ts
|
|
64
|
-
/**
|
|
65
|
-
* Schema for custom hooks aliases that should be treated as React Hooks
|
|
66
|
-
*/
|
|
67
|
-
declare const CustomHooksSchema: z.ZodObject<{
|
|
68
|
-
use: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
69
|
-
useActionState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
|
-
useCallback: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
71
|
-
useContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
72
|
-
useDebugValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
73
|
-
useDeferredValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
74
|
-
useEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
75
|
-
useFormStatus: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
76
|
-
useId: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
77
|
-
useImperativeHandle: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
78
|
-
useInsertionEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
79
|
-
useLayoutEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
80
|
-
useMemo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
81
|
-
useOptimistic: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
82
|
-
useReducer: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
83
|
-
useRef: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
84
|
-
useState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
85
|
-
useSyncExternalStore: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
86
|
-
useTransition: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
87
|
-
}, z.core.$strip>;
|
|
88
64
|
/**
|
|
89
65
|
* Schema for ESLint React settings configuration
|
|
90
66
|
* @internal
|
|
@@ -92,30 +68,7 @@ declare const CustomHooksSchema: z.ZodObject<{
|
|
|
92
68
|
declare const ESLintReactSettingsSchema: z.ZodObject<{
|
|
93
69
|
importSource: z.ZodOptional<z.ZodString>;
|
|
94
70
|
polymorphicPropName: z.ZodOptional<z.ZodString>;
|
|
95
|
-
strict: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
-
skipImportCheck: z.ZodOptional<z.ZodBoolean>;
|
|
97
71
|
version: z.ZodOptional<z.ZodString>;
|
|
98
|
-
additionalHooks: z.ZodOptional<z.ZodObject<{
|
|
99
|
-
use: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
100
|
-
useActionState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
101
|
-
useCallback: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
102
|
-
useContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
103
|
-
useDebugValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
104
|
-
useDeferredValue: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
105
|
-
useEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
106
|
-
useFormStatus: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
107
|
-
useId: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
108
|
-
useImperativeHandle: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
109
|
-
useInsertionEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
110
|
-
useLayoutEffect: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
111
|
-
useMemo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
112
|
-
useOptimistic: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
113
|
-
useReducer: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
114
|
-
useRef: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
115
|
-
useState: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
116
|
-
useSyncExternalStore: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
117
|
-
useTransition: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
118
|
-
}, z.core.$strip>>;
|
|
119
72
|
}, z.core.$strip>;
|
|
120
73
|
/**
|
|
121
74
|
* Schema for ESLint settings
|
|
@@ -124,18 +77,14 @@ declare const ESLintReactSettingsSchema: z.ZodObject<{
|
|
|
124
77
|
declare const ESLintSettingsSchema: z.ZodOptional<z.ZodObject<{
|
|
125
78
|
"react-x": z.ZodOptional<z.ZodUnknown>;
|
|
126
79
|
}, z.core.$strip>>;
|
|
127
|
-
type CustomHooks = z.infer<typeof CustomHooksSchema>;
|
|
128
80
|
type ESLintSettings = z.infer<typeof ESLintSettingsSchema>;
|
|
129
81
|
type ESLintReactSettings = z.infer<typeof ESLintReactSettingsSchema>;
|
|
130
82
|
/**
|
|
131
83
|
* Normalized ESLint React settings with processed values
|
|
132
84
|
*/
|
|
133
85
|
interface ESLintReactSettingsNormalized {
|
|
134
|
-
additionalHooks: CustomHooks;
|
|
135
86
|
importSource: string;
|
|
136
87
|
polymorphicPropName: string | unit;
|
|
137
|
-
skipImportCheck: boolean;
|
|
138
|
-
strict: boolean;
|
|
139
88
|
version: string;
|
|
140
89
|
}
|
|
141
90
|
/**
|
|
@@ -144,13 +93,7 @@ interface ESLintReactSettingsNormalized {
|
|
|
144
93
|
declare const DEFAULT_ESLINT_REACT_SETTINGS: {
|
|
145
94
|
readonly version: "detect";
|
|
146
95
|
readonly importSource: "react";
|
|
147
|
-
readonly strict: true;
|
|
148
|
-
readonly skipImportCheck: true;
|
|
149
96
|
readonly polymorphicPropName: "as";
|
|
150
|
-
readonly additionalHooks: {
|
|
151
|
-
readonly useEffect: ["useIsomorphicLayoutEffect"];
|
|
152
|
-
readonly useLayoutEffect: ["useIsomorphicLayoutEffect"];
|
|
153
|
-
};
|
|
154
97
|
};
|
|
155
98
|
/**
|
|
156
99
|
* Default ESLint settings with React settings included
|
|
@@ -159,13 +102,7 @@ declare const DEFAULT_ESLINT_SETTINGS: {
|
|
|
159
102
|
readonly "react-x": {
|
|
160
103
|
readonly version: "detect";
|
|
161
104
|
readonly importSource: "react";
|
|
162
|
-
readonly strict: true;
|
|
163
|
-
readonly skipImportCheck: true;
|
|
164
105
|
readonly polymorphicPropName: "as";
|
|
165
|
-
readonly additionalHooks: {
|
|
166
|
-
readonly useEffect: ["useIsomorphicLayoutEffect"];
|
|
167
|
-
readonly useLayoutEffect: ["useIsomorphicLayoutEffect"];
|
|
168
|
-
};
|
|
169
106
|
};
|
|
170
107
|
};
|
|
171
108
|
/**
|
|
@@ -203,39 +140,13 @@ declare const decodeSettings: (settings: unknown) => ESLintReactSettings;
|
|
|
203
140
|
* Transforms component definitions and resolves version information
|
|
204
141
|
*/
|
|
205
142
|
declare const normalizeSettings: ({
|
|
206
|
-
additionalHooks,
|
|
207
143
|
importSource,
|
|
208
144
|
polymorphicPropName,
|
|
209
|
-
skipImportCheck,
|
|
210
|
-
strict,
|
|
211
145
|
version,
|
|
212
146
|
...rest
|
|
213
147
|
}: ESLintReactSettings) => {
|
|
214
|
-
readonly additionalHooks: {
|
|
215
|
-
use?: string[] | undefined;
|
|
216
|
-
useActionState?: string[] | undefined;
|
|
217
|
-
useCallback?: string[] | undefined;
|
|
218
|
-
useContext?: string[] | undefined;
|
|
219
|
-
useDebugValue?: string[] | undefined;
|
|
220
|
-
useDeferredValue?: string[] | undefined;
|
|
221
|
-
useEffect?: string[] | undefined;
|
|
222
|
-
useFormStatus?: string[] | undefined;
|
|
223
|
-
useId?: string[] | undefined;
|
|
224
|
-
useImperativeHandle?: string[] | undefined;
|
|
225
|
-
useInsertionEffect?: string[] | undefined;
|
|
226
|
-
useLayoutEffect?: string[] | undefined;
|
|
227
|
-
useMemo?: string[] | undefined;
|
|
228
|
-
useOptimistic?: string[] | undefined;
|
|
229
|
-
useReducer?: string[] | undefined;
|
|
230
|
-
useRef?: string[] | undefined;
|
|
231
|
-
useState?: string[] | undefined;
|
|
232
|
-
useSyncExternalStore?: string[] | undefined;
|
|
233
|
-
useTransition?: string[] | undefined;
|
|
234
|
-
};
|
|
235
148
|
readonly importSource: string;
|
|
236
149
|
readonly polymorphicPropName: string;
|
|
237
|
-
readonly skipImportCheck: boolean;
|
|
238
|
-
readonly strict: boolean;
|
|
239
150
|
readonly version: string;
|
|
240
151
|
};
|
|
241
152
|
/**
|
|
@@ -255,4 +166,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
|
|
|
255
166
|
}
|
|
256
167
|
}
|
|
257
168
|
//#endregion
|
|
258
|
-
export {
|
|
169
|
+
export { DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettings, ESLintReactSettingsNormalized, ESLintReactSettingsSchema, ESLintSettings, ESLintSettingsSchema, GITHUB_URL, NPM_SCOPE, WEBSITE_URL, _require, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineSettings, getConfigAdapters, getDocsUrl, getId, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, normalizeSettings };
|
package/dist/index.js
CHANGED
|
@@ -81,40 +81,13 @@ function getReactVersion(fallback) {
|
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/settings.ts
|
|
83
83
|
/**
|
|
84
|
-
* Schema for custom hooks aliases that should be treated as React Hooks
|
|
85
|
-
*/
|
|
86
|
-
const CustomHooksSchema = z.object({
|
|
87
|
-
use: z.optional(z.array(z.string())),
|
|
88
|
-
useActionState: z.optional(z.array(z.string())),
|
|
89
|
-
useCallback: z.optional(z.array(z.string())),
|
|
90
|
-
useContext: z.optional(z.array(z.string())),
|
|
91
|
-
useDebugValue: z.optional(z.array(z.string())),
|
|
92
|
-
useDeferredValue: z.optional(z.array(z.string())),
|
|
93
|
-
useEffect: z.optional(z.array(z.string())),
|
|
94
|
-
useFormStatus: z.optional(z.array(z.string())),
|
|
95
|
-
useId: z.optional(z.array(z.string())),
|
|
96
|
-
useImperativeHandle: z.optional(z.array(z.string())),
|
|
97
|
-
useInsertionEffect: z.optional(z.array(z.string())),
|
|
98
|
-
useLayoutEffect: z.optional(z.array(z.string())),
|
|
99
|
-
useMemo: z.optional(z.array(z.string())),
|
|
100
|
-
useOptimistic: z.optional(z.array(z.string())),
|
|
101
|
-
useReducer: z.optional(z.array(z.string())),
|
|
102
|
-
useRef: z.optional(z.array(z.string())),
|
|
103
|
-
useState: z.optional(z.array(z.string())),
|
|
104
|
-
useSyncExternalStore: z.optional(z.array(z.string())),
|
|
105
|
-
useTransition: z.optional(z.array(z.string()))
|
|
106
|
-
});
|
|
107
|
-
/**
|
|
108
84
|
* Schema for ESLint React settings configuration
|
|
109
85
|
* @internal
|
|
110
86
|
*/
|
|
111
87
|
const ESLintReactSettingsSchema = z.object({
|
|
112
88
|
importSource: z.optional(z.string()),
|
|
113
89
|
polymorphicPropName: z.optional(z.string()),
|
|
114
|
-
|
|
115
|
-
skipImportCheck: z.optional(z.boolean()),
|
|
116
|
-
version: z.optional(z.string()),
|
|
117
|
-
additionalHooks: z.optional(CustomHooksSchema)
|
|
90
|
+
version: z.optional(z.string())
|
|
118
91
|
});
|
|
119
92
|
/**
|
|
120
93
|
* Schema for ESLint settings
|
|
@@ -127,13 +100,7 @@ const ESLintSettingsSchema = z.optional(z.object({ "react-x": z.optional(z.unkno
|
|
|
127
100
|
const DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
128
101
|
version: "detect",
|
|
129
102
|
importSource: "react",
|
|
130
|
-
|
|
131
|
-
skipImportCheck: true,
|
|
132
|
-
polymorphicPropName: "as",
|
|
133
|
-
additionalHooks: {
|
|
134
|
-
useEffect: ["useIsomorphicLayoutEffect"],
|
|
135
|
-
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
136
|
-
}
|
|
103
|
+
polymorphicPropName: "as"
|
|
137
104
|
};
|
|
138
105
|
/**
|
|
139
106
|
* Default ESLint settings with React settings included
|
|
@@ -187,14 +154,11 @@ const decodeSettings = (settings) => {
|
|
|
187
154
|
* Normalizes ESLint React settings to a consistent internal format
|
|
188
155
|
* Transforms component definitions and resolves version information
|
|
189
156
|
*/
|
|
190
|
-
const normalizeSettings = ({
|
|
157
|
+
const normalizeSettings = ({ importSource = "react", polymorphicPropName = "as", version,...rest }) => {
|
|
191
158
|
return {
|
|
192
159
|
...rest,
|
|
193
|
-
additionalHooks,
|
|
194
160
|
importSource,
|
|
195
161
|
polymorphicPropName,
|
|
196
|
-
skipImportCheck,
|
|
197
|
-
strict,
|
|
198
162
|
version: match(version).with(P.union(P.nullish, "", "detect"), () => getReactVersion("19.1.0")).otherwise(identity)
|
|
199
163
|
};
|
|
200
164
|
};
|
|
@@ -215,4 +179,4 @@ function getSettingsFromContext(context) {
|
|
|
215
179
|
const defineSettings = identity;
|
|
216
180
|
|
|
217
181
|
//#endregion
|
|
218
|
-
export {
|
|
182
|
+
export { DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, NPM_SCOPE, WEBSITE_URL, _require, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineSettings, getConfigAdapters, getDocsUrl, getId, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, normalizeSettings };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.174",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@typescript-eslint/utils": "^8.42.0",
|
|
31
31
|
"ts-pattern": "^5.8.0",
|
|
32
32
|
"zod": "^4.1.5",
|
|
33
|
-
"@eslint-react/eff": "2.0.0-next.
|
|
34
|
-
"@eslint-react/kit": "2.0.0-next.
|
|
33
|
+
"@eslint-react/eff": "2.0.0-next.174",
|
|
34
|
+
"@eslint-react/kit": "2.0.0-next.174"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@tsconfig/node22": "^22.0.2",
|