@eslint-react/shared 2.14.0-next.0 → 3.0.0-next.0
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 +18 -3
- package/dist/index.js +11 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -104,6 +104,7 @@ interface CompatibleConfig {
|
|
|
104
104
|
/** Shared settings. */
|
|
105
105
|
settings?: SettingsConfig;
|
|
106
106
|
}
|
|
107
|
+
type CompilationMode = "off" | "infer" | "annotation" | "syntax" | "all";
|
|
107
108
|
//#endregion
|
|
108
109
|
//#region src/config-adapters.d.ts
|
|
109
110
|
/**
|
|
@@ -276,6 +277,13 @@ declare function report(context: RuleContext): (descriptor?: null | ReportDescri
|
|
|
276
277
|
*/
|
|
277
278
|
declare const ESLintReactSettingsSchema: z.ZodObject<{
|
|
278
279
|
importSource: z.ZodOptional<z.ZodString>;
|
|
280
|
+
compilationMode: z.ZodOptional<z.ZodEnum<{
|
|
281
|
+
off: "off";
|
|
282
|
+
infer: "infer";
|
|
283
|
+
annotation: "annotation";
|
|
284
|
+
syntax: "syntax";
|
|
285
|
+
all: "all";
|
|
286
|
+
}>>;
|
|
279
287
|
polymorphicPropName: z.ZodOptional<z.ZodString>;
|
|
280
288
|
version: z.ZodOptional<z.ZodString>;
|
|
281
289
|
additionalStateHooks: z.ZodOptional<z.ZodString>;
|
|
@@ -299,10 +307,12 @@ type ESLintReactSettings = z.infer<typeof ESLintReactSettingsSchema>;
|
|
|
299
307
|
* Normalized ESLint React settings with processed values
|
|
300
308
|
*/
|
|
301
309
|
interface ESLintReactSettingsNormalized {
|
|
302
|
-
|
|
310
|
+
version: string;
|
|
303
311
|
importSource: string;
|
|
312
|
+
compilationMode: CompilationMode;
|
|
313
|
+
isCompilerEnabled: boolean;
|
|
304
314
|
polymorphicPropName: string | unit;
|
|
305
|
-
|
|
315
|
+
additionalStateHooks: RegExpLike;
|
|
306
316
|
}
|
|
307
317
|
/**
|
|
308
318
|
* Default ESLint React settings
|
|
@@ -310,6 +320,7 @@ interface ESLintReactSettingsNormalized {
|
|
|
310
320
|
declare const DEFAULT_ESLINT_REACT_SETTINGS: {
|
|
311
321
|
readonly version: "detect";
|
|
312
322
|
readonly importSource: "react";
|
|
323
|
+
readonly compilationMode: "annotation";
|
|
313
324
|
readonly polymorphicPropName: "as";
|
|
314
325
|
};
|
|
315
326
|
/**
|
|
@@ -319,6 +330,7 @@ declare const DEFAULT_ESLINT_SETTINGS: {
|
|
|
319
330
|
readonly "react-x": {
|
|
320
331
|
readonly version: "detect";
|
|
321
332
|
readonly importSource: "react";
|
|
333
|
+
readonly compilationMode: "annotation";
|
|
322
334
|
readonly polymorphicPropName: "as";
|
|
323
335
|
};
|
|
324
336
|
};
|
|
@@ -358,12 +370,15 @@ declare const decodeSettings: (settings: unknown) => ESLintReactSettings;
|
|
|
358
370
|
*/
|
|
359
371
|
declare const normalizeSettings: ({
|
|
360
372
|
importSource,
|
|
373
|
+
compilationMode,
|
|
361
374
|
polymorphicPropName,
|
|
362
375
|
version,
|
|
363
376
|
additionalStateHooks,
|
|
364
377
|
...rest
|
|
365
378
|
}: ESLintReactSettings) => {
|
|
366
379
|
readonly importSource: string;
|
|
380
|
+
readonly compilationMode: "off" | "infer" | "annotation" | "syntax" | "all";
|
|
381
|
+
readonly isCompilerEnabled: boolean;
|
|
367
382
|
readonly polymorphicPropName: string;
|
|
368
383
|
readonly version: string;
|
|
369
384
|
readonly additionalStateHooks: RegExpLike;
|
|
@@ -385,4 +400,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
|
|
|
385
400
|
}
|
|
386
401
|
}
|
|
387
402
|
//#endregion
|
|
388
|
-
export { CompatibleConfig, CompatiblePlugin, CompatibleRule, DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettings, ESLintReactSettingsNormalized, ESLintReactSettingsSchema, ESLintSettings, ESLintSettingsSchema, GITHUB_URL, IdGenerator, NPM_SCOPE, RE_ANNOTATION_JSX, RE_ANNOTATION_JSX_FRAG, RE_ANNOTATION_JSX_IMPORT_SOURCE, RE_ANNOTATION_JSX_RUNTIME, RE_CAMEL_CASE, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE, RE_CONSTANT_CASE, RE_HOOK_NAME, RE_HTML_TAG, RE_JAVASCRIPT_PROTOCOL, RE_JS_EXT, RE_JS_IDENTIFIER, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_REGEXP_STR, RE_SNAKE_CASE, RE_TS_EXT, RegExpLike, RuleConfig, RuleContext, RuleFeature, RulePolicy, RuleSuggest, SettingsConfig, Severity, SeverityLevel, SeverityName, WEBSITE_URL, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineRuleListener, defineSettings, getConfigAdapters, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, isRegExp, normalizeSettings, report, toRegExp };
|
|
403
|
+
export { CompatibleConfig, CompatiblePlugin, CompatibleRule, CompilationMode, DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettings, ESLintReactSettingsNormalized, ESLintReactSettingsSchema, ESLintSettings, ESLintSettingsSchema, GITHUB_URL, IdGenerator, NPM_SCOPE, RE_ANNOTATION_JSX, RE_ANNOTATION_JSX_FRAG, RE_ANNOTATION_JSX_IMPORT_SOURCE, RE_ANNOTATION_JSX_RUNTIME, RE_CAMEL_CASE, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE, RE_CONSTANT_CASE, RE_HOOK_NAME, RE_HTML_TAG, RE_JAVASCRIPT_PROTOCOL, RE_JS_EXT, RE_JS_IDENTIFIER, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_REGEXP_STR, RE_SNAKE_CASE, RE_TS_EXT, RegExpLike, RuleConfig, RuleContext, RuleFeature, RulePolicy, RuleSuggest, SettingsConfig, Severity, SeverityLevel, SeverityName, WEBSITE_URL, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineRuleListener, defineSettings, getConfigAdapters, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, isRegExp, normalizeSettings, report, toRegExp };
|
package/dist/index.js
CHANGED
|
@@ -230,6 +230,13 @@ function report(context) {
|
|
|
230
230
|
*/
|
|
231
231
|
const ESLintReactSettingsSchema = z.object({
|
|
232
232
|
importSource: z.optional(z.string()),
|
|
233
|
+
compilationMode: z.optional(z.enum([
|
|
234
|
+
"off",
|
|
235
|
+
"infer",
|
|
236
|
+
"annotation",
|
|
237
|
+
"syntax",
|
|
238
|
+
"all"
|
|
239
|
+
])),
|
|
233
240
|
polymorphicPropName: z.optional(z.string()),
|
|
234
241
|
version: z.optional(z.string()),
|
|
235
242
|
additionalStateHooks: z.optional(z.string())
|
|
@@ -245,6 +252,7 @@ const ESLintSettingsSchema = z.optional(z.object({ "react-x": z.optional(z.unkno
|
|
|
245
252
|
const DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
246
253
|
version: "detect",
|
|
247
254
|
importSource: "react",
|
|
255
|
+
compilationMode: "annotation",
|
|
248
256
|
polymorphicPropName: "as"
|
|
249
257
|
};
|
|
250
258
|
/**
|
|
@@ -299,10 +307,12 @@ const decodeSettings = (settings) => {
|
|
|
299
307
|
* Normalizes ESLint React settings to a consistent internal format
|
|
300
308
|
* Transforms component definitions and resolves version information
|
|
301
309
|
*/
|
|
302
|
-
const normalizeSettings = ({ importSource = "react", polymorphicPropName = "as", version, additionalStateHooks, ...rest }) => {
|
|
310
|
+
const normalizeSettings = ({ importSource = "react", compilationMode = "annotation", polymorphicPropName = "as", version, additionalStateHooks, ...rest }) => {
|
|
303
311
|
return {
|
|
304
312
|
...rest,
|
|
305
313
|
importSource,
|
|
314
|
+
compilationMode,
|
|
315
|
+
isCompilerEnabled: compilationMode !== "off",
|
|
306
316
|
polymorphicPropName,
|
|
307
317
|
version: match(version).with(P.union(P.nullish, "", "detect"), () => getReactVersion("19.2.0")).otherwise(identity),
|
|
308
318
|
additionalStateHooks: toRegExp(additionalStateHooks)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-next.0",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"./package.json"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@typescript-eslint/utils": "^8.
|
|
33
|
+
"@typescript-eslint/utils": "^8.56.0",
|
|
34
34
|
"ts-pattern": "^5.9.0",
|
|
35
35
|
"zod": "^3.25.0 || ^4.0.0",
|
|
36
|
-
"@eslint-react/eff": "
|
|
36
|
+
"@eslint-react/eff": "3.0.0-next.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@tsconfig/node24": "^24.0.4",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"typescript": ">=4.8.4 <6.0.0"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
|
-
"node": ">=
|
|
49
|
+
"node": ">=22.0.0"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsdown --dts-resolve",
|