@eslint-react/shared 3.0.0-next.55 → 3.0.0-next.56
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 +52 -111
- package/dist/index.js +1 -28
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -21,115 +21,6 @@ declare class IdGenerator {
|
|
|
21
21
|
next(): string;
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
|
-
//#region src/types.d.ts
|
|
25
|
-
/**
|
|
26
|
-
* Rule severity.
|
|
27
|
-
* @since 0.0.1
|
|
28
|
-
*/
|
|
29
|
-
type SeverityName = "off" | "warn" | "error";
|
|
30
|
-
/**
|
|
31
|
-
* The numeric severity level for a rule.
|
|
32
|
-
*
|
|
33
|
-
* - `0` means off.
|
|
34
|
-
* - `1` means warn.
|
|
35
|
-
* - `2` means error.
|
|
36
|
-
*/
|
|
37
|
-
type SeverityLevel = 0 | 1 | 2;
|
|
38
|
-
/**
|
|
39
|
-
* The severity of a rule in a configuration.
|
|
40
|
-
*/
|
|
41
|
-
type Severity = SeverityName | SeverityLevel;
|
|
42
|
-
/**
|
|
43
|
-
* Rule declaration.
|
|
44
|
-
* @internal
|
|
45
|
-
* @since 0.0.1
|
|
46
|
-
*/
|
|
47
|
-
type RuleConfig<RuleOptions extends unknown[] = unknown[]> = Severity | [Severity, ...Partial<RuleOptions>];
|
|
48
|
-
/**
|
|
49
|
-
* Rule context.
|
|
50
|
-
* @since 0.0.1
|
|
51
|
-
*/
|
|
52
|
-
type RuleContext<MessageIds extends string = string, Options extends readonly unknown[] = readonly unknown[]> = tseslint.RuleContext<MessageIds, Options>;
|
|
53
|
-
/**
|
|
54
|
-
* Rule feature.
|
|
55
|
-
* @since 1.20.0
|
|
56
|
-
*/
|
|
57
|
-
type RuleFeature = "CFG" | "DBG" | "FIX" | "MOD" | "TSC" | "EXP";
|
|
58
|
-
/**
|
|
59
|
-
* The numeric policy value for a rule (severity level).
|
|
60
|
-
*/
|
|
61
|
-
type RulePolicy = number;
|
|
62
|
-
/**
|
|
63
|
-
* A suggestion for fixing a reported issue.
|
|
64
|
-
*/
|
|
65
|
-
type RuleSuggest<MessageIds extends string = string> = {
|
|
66
|
-
/** The message ID for the suggestion. */messageId: MessageIds; /** Optional data to pass to the message formatter. */
|
|
67
|
-
data?: Record<string, unknown>; /** The fix function to apply the suggestion. */
|
|
68
|
-
fix: tseslint.ReportFixFunction;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* A collection of settings.
|
|
72
|
-
*/
|
|
73
|
-
interface SettingsConfig {
|
|
74
|
-
[key: string]: unknown;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* A rule with a compatible shape for use with `defineConfig()` and `tseslint.config()`.
|
|
78
|
-
* Intentionally wide/inaccurate for compatibility purposes.
|
|
79
|
-
*/
|
|
80
|
-
interface CompatibleRule {
|
|
81
|
-
meta: Record<string, any>;
|
|
82
|
-
create: (...args: any[]) => any;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* A plugin with a compatible shape for use with `defineConfig()` and `tseslint.config()`.
|
|
86
|
-
* Intentionally wide/inaccurate for compatibility purposes.
|
|
87
|
-
*/
|
|
88
|
-
interface CompatiblePlugin {
|
|
89
|
-
meta: {
|
|
90
|
-
name: string;
|
|
91
|
-
version: string;
|
|
92
|
-
};
|
|
93
|
-
rules: Record<string, CompatibleRule>;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* A configuration object with a compatible shape for use with `defineConfig()` and `tseslint.config()`.
|
|
97
|
-
* Intentionally wide/inaccurate for compatibility purposes.
|
|
98
|
-
*/
|
|
99
|
-
interface CompatibleConfig {
|
|
100
|
-
/** Optional configuration name. */
|
|
101
|
-
name?: string;
|
|
102
|
-
/** Rule configurations. */
|
|
103
|
-
rules?: Record<string, RuleConfig>;
|
|
104
|
-
/** Shared settings. */
|
|
105
|
-
settings?: SettingsConfig;
|
|
106
|
-
}
|
|
107
|
-
type CompilationMode = "infer" | "annotation" | "syntax" | "all";
|
|
108
|
-
//#endregion
|
|
109
|
-
//#region src/config-adapters.d.ts
|
|
110
|
-
/**
|
|
111
|
-
* Get configuration adapters for converting between flat and legacy config formats
|
|
112
|
-
* @param pluginName The name of the plugin
|
|
113
|
-
* @param plugin The plugin instance
|
|
114
|
-
* @returns Object with toFlatConfig and toLegacyConfig functions
|
|
115
|
-
*/
|
|
116
|
-
declare function getConfigAdapters(pluginName: string, plugin: CompatiblePlugin): {
|
|
117
|
-
readonly toFlatConfig: (config: CompatibleConfig) => {
|
|
118
|
-
plugins: {
|
|
119
|
-
[pluginName]: CompatiblePlugin;
|
|
120
|
-
};
|
|
121
|
-
name?: string;
|
|
122
|
-
rules?: Record<string, RuleConfig>;
|
|
123
|
-
settings?: SettingsConfig;
|
|
124
|
-
};
|
|
125
|
-
readonly toLegacyConfig: ({
|
|
126
|
-
rules
|
|
127
|
-
}: CompatibleConfig) => {
|
|
128
|
-
plugins: string[];
|
|
129
|
-
rules: Record<string, RuleConfig<unknown[]>> | undefined;
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
//#endregion
|
|
133
24
|
//#region src/constants.d.ts
|
|
134
25
|
/**
|
|
135
26
|
* The NPM scope for this project.
|
|
@@ -270,6 +161,55 @@ declare function toRegExp(string: string | unit): RegExpLike;
|
|
|
270
161
|
*/
|
|
271
162
|
declare function isRegExp(string: string): boolean;
|
|
272
163
|
//#endregion
|
|
164
|
+
//#region src/types.d.ts
|
|
165
|
+
/**
|
|
166
|
+
* Rule severity.
|
|
167
|
+
* @since 0.0.1
|
|
168
|
+
*/
|
|
169
|
+
type SeverityName = "off" | "warn" | "error";
|
|
170
|
+
/**
|
|
171
|
+
* The numeric severity level for a rule.
|
|
172
|
+
*
|
|
173
|
+
* - `0` means off.
|
|
174
|
+
* - `1` means warn.
|
|
175
|
+
* - `2` means error.
|
|
176
|
+
*/
|
|
177
|
+
type SeverityLevel = 0 | 1 | 2;
|
|
178
|
+
/**
|
|
179
|
+
* The severity of a rule in a configuration.
|
|
180
|
+
*/
|
|
181
|
+
type Severity = SeverityName | SeverityLevel;
|
|
182
|
+
/**
|
|
183
|
+
* Rule declaration.
|
|
184
|
+
* @internal
|
|
185
|
+
* @since 0.0.1
|
|
186
|
+
*/
|
|
187
|
+
type RuleConfig<RuleOptions extends unknown[] = unknown[]> = Severity | [Severity, ...Partial<RuleOptions>];
|
|
188
|
+
/**
|
|
189
|
+
* Rule context.
|
|
190
|
+
* @since 0.0.1
|
|
191
|
+
*/
|
|
192
|
+
type RuleContext<MessageIds extends string = string, Options extends readonly unknown[] = readonly unknown[]> = tseslint.RuleContext<MessageIds, Options>;
|
|
193
|
+
/**
|
|
194
|
+
* Rule feature.
|
|
195
|
+
* @since 1.20.0
|
|
196
|
+
*/
|
|
197
|
+
type RuleFeature = "CFG" | "DBG" | "FIX" | "MOD" | "TSC" | "EXP";
|
|
198
|
+
/**
|
|
199
|
+
* A suggestion for fixing a reported issue.
|
|
200
|
+
*/
|
|
201
|
+
type RuleSuggest<MessageIds extends string = string> = {
|
|
202
|
+
/** The message ID for the suggestion. */messageId: MessageIds; /** Optional data to pass to the message formatter. */
|
|
203
|
+
data?: Record<string, unknown>; /** The fix function to apply the suggestion. */
|
|
204
|
+
fix: tseslint.ReportFixFunction;
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* A collection of settings.
|
|
208
|
+
*/
|
|
209
|
+
interface SettingsConfig {
|
|
210
|
+
[key: string]: unknown;
|
|
211
|
+
}
|
|
212
|
+
//#endregion
|
|
273
213
|
//#region src/report.d.ts
|
|
274
214
|
/**
|
|
275
215
|
* Creates a report function for the given rule context.
|
|
@@ -311,6 +251,7 @@ type ESLintSettings = z.infer<typeof ESLintSettingsSchema>;
|
|
|
311
251
|
* ESLint React settings type inferred from the React settings schema.
|
|
312
252
|
*/
|
|
313
253
|
type ESLintReactSettings = z.infer<typeof ESLintReactSettingsSchema>;
|
|
254
|
+
type CompilationMode = "infer" | "annotation" | "syntax" | "all";
|
|
314
255
|
/**
|
|
315
256
|
* Normalized ESLint React settings with processed values
|
|
316
257
|
*/
|
|
@@ -384,7 +325,7 @@ declare const normalizeSettings: ({
|
|
|
384
325
|
...rest
|
|
385
326
|
}: ESLintReactSettings) => {
|
|
386
327
|
readonly importSource: string;
|
|
387
|
-
readonly compilationMode: "
|
|
328
|
+
readonly compilationMode: "infer" | "annotation" | "syntax" | "all" | "off";
|
|
388
329
|
readonly polymorphicPropName: string;
|
|
389
330
|
readonly version: string;
|
|
390
331
|
readonly additionalStateHooks: RegExpLike;
|
|
@@ -407,4 +348,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
|
|
|
407
348
|
}
|
|
408
349
|
}
|
|
409
350
|
//#endregion
|
|
410
|
-
export {
|
|
351
|
+
export { 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, RuleSuggest, SettingsConfig, Severity, SeverityLevel, SeverityName, WEBSITE_URL, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineRuleListener, defineSettings, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, isRegExp, normalizeSettings, report, toRegExp };
|
package/dist/index.js
CHANGED
|
@@ -28,33 +28,6 @@ var IdGenerator = class {
|
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/config-adapters.ts
|
|
33
|
-
/**
|
|
34
|
-
* Get configuration adapters for converting between flat and legacy config formats
|
|
35
|
-
* @param pluginName The name of the plugin
|
|
36
|
-
* @param plugin The plugin instance
|
|
37
|
-
* @returns Object with toFlatConfig and toLegacyConfig functions
|
|
38
|
-
*/
|
|
39
|
-
function getConfigAdapters(pluginName, plugin) {
|
|
40
|
-
function toFlatConfig(config) {
|
|
41
|
-
return {
|
|
42
|
-
...config,
|
|
43
|
-
plugins: { [pluginName]: plugin }
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function toLegacyConfig({ rules }) {
|
|
47
|
-
return {
|
|
48
|
-
plugins: [pluginName],
|
|
49
|
-
rules
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
toFlatConfig,
|
|
54
|
-
toLegacyConfig
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
31
|
//#endregion
|
|
59
32
|
//#region src/constants.ts
|
|
60
33
|
/**
|
|
@@ -601,4 +574,4 @@ function getSettingsFromContext(context) {
|
|
|
601
574
|
const defineSettings = identity;
|
|
602
575
|
|
|
603
576
|
//#endregion
|
|
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,
|
|
577
|
+
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, 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.56",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -33,13 +33,13 @@
|
|
|
33
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.56"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@tsconfig/node24": "^24.0.4",
|
|
40
40
|
"@types/node": "^25.3.1",
|
|
41
41
|
"@types/picomatch": "^4.0.2",
|
|
42
|
-
"tsdown": "^0.21.0-beta.
|
|
42
|
+
"tsdown": "^0.21.0-beta.2",
|
|
43
43
|
"@local/configs": "0.0.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|