@eslint-react/shared 3.0.0-next.4 → 3.0.0-next.41
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 +10 -11
- package/dist/index.js +9 -10
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { unit } from "@eslint-react/eff";
|
|
2
2
|
import { z } from "zod/v4";
|
|
3
3
|
import * as tseslint from "@typescript-eslint/utils/ts-eslint";
|
|
4
|
-
import { ReportDescriptor, RuleListener } from "@typescript-eslint/utils/ts-eslint";
|
|
4
|
+
import { ReportDescriptor, ReportFixFunction, RuleFix, RuleFixer, RuleListener } from "@typescript-eslint/utils/ts-eslint";
|
|
5
5
|
|
|
6
6
|
//#region src/_id.d.ts
|
|
7
7
|
/**
|
|
@@ -104,7 +104,7 @@ interface CompatibleConfig {
|
|
|
104
104
|
/** Shared settings. */
|
|
105
105
|
settings?: SettingsConfig;
|
|
106
106
|
}
|
|
107
|
-
type CompilationMode = "
|
|
107
|
+
type CompilationMode = "infer" | "annotation" | "syntax" | "all";
|
|
108
108
|
//#endregion
|
|
109
109
|
//#region src/config-adapters.d.ts
|
|
110
110
|
/**
|
|
@@ -215,11 +215,11 @@ declare const RE_HOOK_NAME: RegExp;
|
|
|
215
215
|
/**
|
|
216
216
|
* Known impure functions
|
|
217
217
|
*/
|
|
218
|
-
declare const
|
|
218
|
+
declare const IMPURE_FUNCS: ReadonlyMap<string, ReadonlySet<string>>;
|
|
219
219
|
/**
|
|
220
220
|
* Known impure global constructors used with `new`
|
|
221
221
|
*/
|
|
222
|
-
declare const
|
|
222
|
+
declare const IMPURE_CTORS: ReadonlySet<string>;
|
|
223
223
|
//#endregion
|
|
224
224
|
//#region src/define-rule-listener.d.ts
|
|
225
225
|
/**
|
|
@@ -286,7 +286,6 @@ declare function report(context: RuleContext): (descriptor?: null | ReportDescri
|
|
|
286
286
|
declare const ESLintReactSettingsSchema: z.ZodObject<{
|
|
287
287
|
importSource: z.ZodOptional<z.ZodString>;
|
|
288
288
|
compilationMode: z.ZodOptional<z.ZodEnum<{
|
|
289
|
-
off: "off";
|
|
290
289
|
infer: "infer";
|
|
291
290
|
annotation: "annotation";
|
|
292
291
|
syntax: "syntax";
|
|
@@ -295,6 +294,7 @@ declare const ESLintReactSettingsSchema: z.ZodObject<{
|
|
|
295
294
|
polymorphicPropName: z.ZodOptional<z.ZodString>;
|
|
296
295
|
version: z.ZodOptional<z.ZodString>;
|
|
297
296
|
additionalStateHooks: z.ZodOptional<z.ZodString>;
|
|
297
|
+
additionalEffectHooks: z.ZodOptional<z.ZodString>;
|
|
298
298
|
}, z.core.$strip>;
|
|
299
299
|
/**
|
|
300
300
|
* Schema for ESLint settings
|
|
@@ -317,10 +317,10 @@ type ESLintReactSettings = z.infer<typeof ESLintReactSettingsSchema>;
|
|
|
317
317
|
interface ESLintReactSettingsNormalized {
|
|
318
318
|
version: string;
|
|
319
319
|
importSource: string;
|
|
320
|
-
compilationMode: CompilationMode;
|
|
321
|
-
isCompilerEnabled: boolean;
|
|
320
|
+
compilationMode: CompilationMode | "off";
|
|
322
321
|
polymorphicPropName: string | unit;
|
|
323
322
|
additionalStateHooks: RegExpLike;
|
|
323
|
+
additionalEffectHooks: RegExpLike;
|
|
324
324
|
}
|
|
325
325
|
/**
|
|
326
326
|
* Default ESLint React settings
|
|
@@ -328,7 +328,6 @@ interface ESLintReactSettingsNormalized {
|
|
|
328
328
|
declare const DEFAULT_ESLINT_REACT_SETTINGS: {
|
|
329
329
|
readonly version: "detect";
|
|
330
330
|
readonly importSource: "react";
|
|
331
|
-
readonly compilationMode: "annotation";
|
|
332
331
|
readonly polymorphicPropName: "as";
|
|
333
332
|
};
|
|
334
333
|
/**
|
|
@@ -338,7 +337,6 @@ declare const DEFAULT_ESLINT_SETTINGS: {
|
|
|
338
337
|
readonly "react-x": {
|
|
339
338
|
readonly version: "detect";
|
|
340
339
|
readonly importSource: "react";
|
|
341
|
-
readonly compilationMode: "annotation";
|
|
342
340
|
readonly polymorphicPropName: "as";
|
|
343
341
|
};
|
|
344
342
|
};
|
|
@@ -382,14 +380,15 @@ declare const normalizeSettings: ({
|
|
|
382
380
|
polymorphicPropName,
|
|
383
381
|
version,
|
|
384
382
|
additionalStateHooks,
|
|
383
|
+
additionalEffectHooks,
|
|
385
384
|
...rest
|
|
386
385
|
}: ESLintReactSettings) => {
|
|
387
386
|
readonly importSource: string;
|
|
388
387
|
readonly compilationMode: "off" | "infer" | "annotation" | "syntax" | "all";
|
|
389
|
-
readonly isCompilerEnabled: boolean;
|
|
390
388
|
readonly polymorphicPropName: string;
|
|
391
389
|
readonly version: string;
|
|
392
390
|
readonly additionalStateHooks: RegExpLike;
|
|
391
|
+
readonly additionalEffectHooks: RegExpLike;
|
|
393
392
|
};
|
|
394
393
|
/**
|
|
395
394
|
* Retrieves normalized ESLint React settings from the rule context
|
|
@@ -408,4 +407,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
|
|
|
408
407
|
}
|
|
409
408
|
}
|
|
410
409
|
//#endregion
|
|
411
|
-
export { CompatibleConfig, CompatiblePlugin, CompatibleRule, CompilationMode, DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettings, ESLintReactSettingsNormalized, ESLintReactSettingsSchema, ESLintSettings, ESLintSettingsSchema, GITHUB_URL,
|
|
410
|
+
export { CompatibleConfig, CompatiblePlugin, CompatibleRule, CompilationMode, DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettings, ESLintReactSettingsNormalized, ESLintReactSettingsSchema, ESLintSettings, ESLintSettingsSchema, GITHUB_URL, IMPURE_CTORS, IMPURE_FUNCS, 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, type ReportFixFunction, RuleConfig, RuleContext, RuleFeature, type RuleFix, type RuleFixer, 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
|
@@ -141,7 +141,7 @@ const RE_HOOK_NAME = /^use/u;
|
|
|
141
141
|
/**
|
|
142
142
|
* Known impure functions
|
|
143
143
|
*/
|
|
144
|
-
const
|
|
144
|
+
const IMPURE_FUNCS = new Map([
|
|
145
145
|
["Atomics", new Set([
|
|
146
146
|
"add",
|
|
147
147
|
"and",
|
|
@@ -379,7 +379,7 @@ const IMPURE_FUNCTIONS = new Map([
|
|
|
379
379
|
/**
|
|
380
380
|
* Known impure global constructors used with `new`
|
|
381
381
|
*/
|
|
382
|
-
const
|
|
382
|
+
const IMPURE_CTORS = new Set([
|
|
383
383
|
"AbortController",
|
|
384
384
|
"Audio",
|
|
385
385
|
"AudioContext",
|
|
@@ -498,7 +498,6 @@ function report(context) {
|
|
|
498
498
|
const ESLintReactSettingsSchema = z.object({
|
|
499
499
|
importSource: z.optional(z.string()),
|
|
500
500
|
compilationMode: z.optional(z.enum([
|
|
501
|
-
"off",
|
|
502
501
|
"infer",
|
|
503
502
|
"annotation",
|
|
504
503
|
"syntax",
|
|
@@ -506,7 +505,8 @@ const ESLintReactSettingsSchema = z.object({
|
|
|
506
505
|
])),
|
|
507
506
|
polymorphicPropName: z.optional(z.string()),
|
|
508
507
|
version: z.optional(z.string()),
|
|
509
|
-
additionalStateHooks: z.optional(z.string())
|
|
508
|
+
additionalStateHooks: z.optional(z.string()),
|
|
509
|
+
additionalEffectHooks: z.optional(z.string())
|
|
510
510
|
});
|
|
511
511
|
/**
|
|
512
512
|
* Schema for ESLint settings
|
|
@@ -519,7 +519,6 @@ const ESLintSettingsSchema = z.optional(z.object({ "react-x": z.optional(z.unkno
|
|
|
519
519
|
const DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
520
520
|
version: "detect",
|
|
521
521
|
importSource: "react",
|
|
522
|
-
compilationMode: "annotation",
|
|
523
522
|
polymorphicPropName: "as"
|
|
524
523
|
};
|
|
525
524
|
/**
|
|
@@ -574,15 +573,15 @@ const decodeSettings = (settings) => {
|
|
|
574
573
|
* Normalizes ESLint React settings to a consistent internal format
|
|
575
574
|
* Transforms component definitions and resolves version information
|
|
576
575
|
*/
|
|
577
|
-
const normalizeSettings = ({ importSource = "react", compilationMode
|
|
576
|
+
const normalizeSettings = ({ importSource = "react", compilationMode, polymorphicPropName = "as", version, additionalStateHooks, additionalEffectHooks, ...rest }) => {
|
|
578
577
|
return {
|
|
579
578
|
...rest,
|
|
580
579
|
importSource,
|
|
581
|
-
compilationMode,
|
|
582
|
-
isCompilerEnabled: compilationMode !== "off",
|
|
580
|
+
compilationMode: compilationMode ?? "off",
|
|
583
581
|
polymorphicPropName,
|
|
584
582
|
version: match(version).with(P.union(P.nullish, "", "detect"), () => getReactVersion("19.2.4")).otherwise(identity),
|
|
585
|
-
additionalStateHooks: toRegExp(additionalStateHooks)
|
|
583
|
+
additionalStateHooks: toRegExp(additionalStateHooks),
|
|
584
|
+
additionalEffectHooks: toRegExp(additionalEffectHooks)
|
|
586
585
|
};
|
|
587
586
|
};
|
|
588
587
|
const cache = /* @__PURE__ */ new Map();
|
|
@@ -602,4 +601,4 @@ function getSettingsFromContext(context) {
|
|
|
602
601
|
const defineSettings = identity;
|
|
603
602
|
|
|
604
603
|
//#endregion
|
|
605
|
-
export { DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL,
|
|
604
|
+
export { DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, IMPURE_CTORS, IMPURE_FUNCS, 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, WEBSITE_URL, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineRuleListener, defineSettings, getConfigAdapters, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, isRegExp, normalizeSettings, report, toRegExp };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.41",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -30,13 +30,14 @@
|
|
|
30
30
|
"./package.json"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@typescript-eslint/utils": "
|
|
33
|
+
"@typescript-eslint/utils": "canary",
|
|
34
34
|
"ts-pattern": "^5.9.0",
|
|
35
35
|
"zod": "^3.25.0 || ^4.0.0",
|
|
36
|
-
"@eslint-react/eff": "3.0.0-next.
|
|
36
|
+
"@eslint-react/eff": "3.0.0-next.41"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@tsconfig/node24": "^24.0.4",
|
|
40
|
+
"@types/node": "^25.3.0",
|
|
40
41
|
"@types/picomatch": "^4.0.2",
|
|
41
42
|
"tsdown": "^0.20.3",
|
|
42
43
|
"@local/configs": "0.0.0"
|
|
@@ -52,6 +53,6 @@
|
|
|
52
53
|
"build": "tsdown --dts-resolve",
|
|
53
54
|
"build:docs": "typedoc",
|
|
54
55
|
"lint:publish": "publint",
|
|
55
|
-
"lint:ts": "
|
|
56
|
+
"lint:ts": "tsl"
|
|
56
57
|
}
|
|
57
58
|
}
|