@eslint-react/shared 2.8.2-beta.5 → 2.8.2-beta.6

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 CHANGED
@@ -55,10 +55,16 @@ type RuleContext<MessageIds extends string = string, Options extends readonly un
55
55
  * @since 1.20.0
56
56
  */
57
57
  type RuleFeature = "CFG" | "DBG" | "FIX" | "MOD" | "TSC" | "EXP";
58
+ /**
59
+ * The numeric policy value for a rule (severity level).
60
+ */
58
61
  type RulePolicy = number;
62
+ /**
63
+ * A suggestion for fixing a reported issue.
64
+ */
59
65
  type RuleSuggest<MessageIds extends string = string> = {
60
- messageId: MessageIds;
61
- data?: Record<string, unknown>;
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. */
62
68
  fix: tseslint.ReportFixFunction;
63
69
  };
64
70
  /**
@@ -67,10 +73,18 @@ type RuleSuggest<MessageIds extends string = string> = {
67
73
  interface SettingsConfig {
68
74
  [key: string]: unknown;
69
75
  }
76
+ /**
77
+ * A rule with a compatible shape for use with `defineConfig()` and `tseslint.config()`.
78
+ * Intentionally wide/inaccurate for compatibility purposes.
79
+ */
70
80
  interface CompatibleRule {
71
81
  meta: Record<string, any>;
72
82
  create: (...args: any[]) => any;
73
83
  }
84
+ /**
85
+ * A plugin with a compatible shape for use with `defineConfig()` and `tseslint.config()`.
86
+ * Intentionally wide/inaccurate for compatibility purposes.
87
+ */
74
88
  interface CompatiblePlugin {
75
89
  meta: {
76
90
  name: string;
@@ -78,13 +92,26 @@ interface CompatiblePlugin {
78
92
  };
79
93
  rules: Record<string, CompatibleRule>;
80
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
+ */
81
99
  interface CompatibleConfig {
100
+ /** Optional configuration name. */
82
101
  name?: string;
102
+ /** Rule configurations. */
83
103
  rules?: Record<string, RuleConfig>;
104
+ /** Shared settings. */
84
105
  settings?: SettingsConfig;
85
106
  }
86
107
  //#endregion
87
108
  //#region src/config-adapters.d.ts
109
+ /**
110
+ * Get configuration adapters for converting between flat and legacy config formats
111
+ * @param pluginName The name of the plugin
112
+ * @param plugin The plugin instance
113
+ * @returns Object with toFlatConfig and toLegacyConfig functions
114
+ */
88
115
  declare function getConfigAdapters(pluginName: string, plugin: CompatiblePlugin): {
89
116
  readonly toFlatConfig: (config: CompatibleConfig) => {
90
117
  plugins: {
@@ -204,6 +231,11 @@ declare const RE_HOOK_NAME: RegExp;
204
231
  declare function defineRuleListener(base: RuleListener, ...rest: RuleListener[]): RuleListener;
205
232
  //#endregion
206
233
  //#region src/react-version.d.ts
234
+ /**
235
+ * Gets the React version from the project's dependencies.
236
+ * @param fallback The fallback version to return if React is not found.
237
+ * @returns The detected React version or the fallback version.
238
+ */
207
239
  declare function getReactVersion(fallback: string): string;
208
240
  //#endregion
209
241
  //#region src/regexp.d.ts
@@ -230,6 +262,11 @@ declare function toRegExp(string: string | unit): RegExpLike;
230
262
  declare function isRegExp(string: string): boolean;
231
263
  //#endregion
232
264
  //#region src/report.d.ts
265
+ /**
266
+ * Creates a report function for the given rule context.
267
+ * @param context The ESLint rule context.
268
+ * @returns A function that can be used to report violations.
269
+ */
233
270
  declare function report(context: RuleContext): (descriptor?: null | ReportDescriptor<string>) => void;
234
271
  //#endregion
235
272
  //#region src/settings.d.ts
@@ -250,7 +287,13 @@ declare const ESLintReactSettingsSchema: z.ZodObject<{
250
287
  declare const ESLintSettingsSchema: z.ZodOptional<z.ZodObject<{
251
288
  "react-x": z.ZodOptional<z.ZodUnknown>;
252
289
  }, z.core.$strip>>;
290
+ /**
291
+ * ESLint settings type inferred from the settings schema.
292
+ */
253
293
  type ESLintSettings = z.infer<typeof ESLintSettingsSchema>;
294
+ /**
295
+ * ESLint React settings type inferred from the React settings schema.
296
+ */
254
297
  type ESLintReactSettings = z.infer<typeof ESLintReactSettingsSchema>;
255
298
  /**
256
299
  * Normalized ESLint React settings with processed values
package/dist/index.js CHANGED
@@ -30,6 +30,12 @@ var IdGenerator = class {
30
30
 
31
31
  //#endregion
32
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
+ */
33
39
  function getConfigAdapters(pluginName, plugin) {
34
40
  function toFlatConfig(config) {
35
41
  return {
@@ -164,6 +170,11 @@ function defineRuleListener(base, ...rest) {
164
170
  //#endregion
165
171
  //#region src/react-version.ts
166
172
  const _require = module.createRequire(process.cwd() + path.sep);
173
+ /**
174
+ * Gets the React version from the project's dependencies.
175
+ * @param fallback The fallback version to return if React is not found.
176
+ * @returns The detected React version or the fallback version.
177
+ */
167
178
  function getReactVersion(fallback) {
168
179
  try {
169
180
  return match(_require("react")).with({ version: P.select(P.string) }, identity).otherwise(() => fallback);
@@ -199,6 +210,11 @@ function isRegExp(string) {
199
210
 
200
211
  //#endregion
201
212
  //#region src/report.ts
213
+ /**
214
+ * Creates a report function for the given rule context.
215
+ * @param context The ESLint rule context.
216
+ * @returns A function that can be used to report violations.
217
+ */
202
218
  function report(context) {
203
219
  return (descriptor) => {
204
220
  if (descriptor == null) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/shared",
3
- "version": "2.8.2-beta.5",
3
+ "version": "2.8.2-beta.6",
4
4
  "description": "ESLint React's Shared constants and functions.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -33,7 +33,7 @@
33
33
  "@typescript-eslint/utils": "^8.54.0",
34
34
  "ts-pattern": "^5.9.0",
35
35
  "zod": "^3.25.0 || ^4.0.0",
36
- "@eslint-react/eff": "2.8.2-beta.5"
36
+ "@eslint-react/eff": "2.8.2-beta.6"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@tsconfig/node22": "^22.0.5",