@eslint-react/shared 2.2.2 → 2.2.3-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 CHANGED
@@ -16,89 +16,6 @@ declare const getId: () => string;
16
16
  */
17
17
  declare const _require: NodeJS.Require;
18
18
  //#endregion
19
- //#region src/constants.d.ts
20
- /**
21
- * The NPM scope for this project.
22
- */
23
- declare const NPM_SCOPE = "@eslint-react";
24
- /**
25
- * The GitHub repository for this project.
26
- */
27
- declare const GITHUB_URL = "https://github.com/Rel1cx/eslint-react";
28
- /**
29
- * The URL to the project's website.
30
- */
31
- declare const WEBSITE_URL = "https://eslint-react.xyz";
32
- /**
33
- * Regular expressions for matching a HTML tag name
34
- */
35
- declare const RE_HTML_TAG: RegExp;
36
- /**
37
- * Regular expression for matching a TypeScript file extension.
38
- */
39
- declare const RE_TS_EXT: RegExp;
40
- /**
41
- * Regular expression for matching a JavaScript file extension.
42
- */
43
- declare const RE_JS_EXT: RegExp;
44
- /**
45
- * Regular expression for matching a PascalCase string.
46
- */
47
- declare const RE_PASCAL_CASE: RegExp;
48
- /**
49
- * Regular expression for matching a camelCase string.
50
- */
51
- declare const RE_CAMEL_CASE: RegExp;
52
- /**
53
- * Regular expression for matching a kebab-case string.
54
- */
55
- declare const RE_KEBAB_CASE: RegExp;
56
- /**
57
- * Regular expression for matching a snake_case string.
58
- */
59
- declare const RE_SNAKE_CASE: RegExp;
60
- /**
61
- * Regular expression for matching a CONSTANT_CASE string.
62
- */
63
- declare const RE_CONSTANT_CASE: RegExp;
64
- declare const RE_JAVASCRIPT_PROTOCOL: RegExp;
65
- /**
66
- * Regular expression for matching a valid JavaScript identifier.
67
- */
68
- declare const RE_JS_IDENTIFIER: RegExp;
69
- /**
70
- * Regular expression for matching a RegExp string.
71
- */
72
- declare const RE_REGEXP_STR: RegExp;
73
- /**
74
- * Regular expression for matching a `@jsx` annotation comment.
75
- */
76
- declare const RE_ANNOTATION_JSX: RegExp;
77
- /**
78
- * Regular expression for matching a `@jsxFrag` annotation comment.
79
- */
80
- declare const RE_ANNOTATION_JSX_FRAG: RegExp;
81
- /**
82
- * Regular expression for matching a `@jsxRuntime` annotation comment.
83
- */
84
- declare const RE_ANNOTATION_JSX_RUNTIME: RegExp;
85
- /**
86
- * Regular expression for matching a `@jsxImportSource` annotation comment.
87
- */
88
- declare const RE_ANNOTATION_JSX_IMPORT_SOURCE: RegExp;
89
- /**
90
- * Regular expression for matching a React component name.
91
- */
92
- declare const RE_COMPONENT_NAME: RegExp;
93
- /**
94
- * Regular expression for matching a React component name (loose).
95
- */
96
- declare const RE_COMPONENT_NAME_LOOSE: RegExp;
97
- /**
98
- * Regular expression for matching a React Hook name.
99
- */
100
- declare const RE_HOOK_NAME: RegExp;
101
- //#endregion
102
19
  //#region src/types.d.ts
103
20
  /**
104
21
  * Rule severity.
@@ -162,7 +79,7 @@ interface CompatibleConfig {
162
79
  settings?: SettingsConfig;
163
80
  }
164
81
  //#endregion
165
- //#region src/get-config-adapters.d.ts
82
+ //#region src/config-adapters.d.ts
166
83
  declare function getConfigAdapters(pluginName: string, plugin: CompatiblePlugin): {
167
84
  readonly toFlatConfig: (config: CompatibleConfig) => {
168
85
  plugins: {
@@ -180,16 +97,90 @@ declare function getConfigAdapters(pluginName: string, plugin: CompatiblePlugin)
180
97
  };
181
98
  };
182
99
  //#endregion
183
- //#region src/get-doc-url.d.ts
100
+ //#region src/constants.d.ts
184
101
  /**
185
- * Get the URL for the documentation of a rule in a plugin.
186
- * @internal
187
- * @param pluginName The name of the plugin.
188
- * @returns The URL for the documentation of a rule.
102
+ * The NPM scope for this project.
103
+ */
104
+ declare const NPM_SCOPE = "@eslint-react";
105
+ /**
106
+ * The GitHub repository for this project.
107
+ */
108
+ declare const GITHUB_URL = "https://github.com/Rel1cx/eslint-react";
109
+ /**
110
+ * The URL to the project's website.
111
+ */
112
+ declare const WEBSITE_URL = "https://eslint-react.xyz";
113
+ /**
114
+ * Regular expressions for matching a HTML tag name
115
+ */
116
+ declare const RE_HTML_TAG: RegExp;
117
+ /**
118
+ * Regular expression for matching a TypeScript file extension.
119
+ */
120
+ declare const RE_TS_EXT: RegExp;
121
+ /**
122
+ * Regular expression for matching a JavaScript file extension.
123
+ */
124
+ declare const RE_JS_EXT: RegExp;
125
+ /**
126
+ * Regular expression for matching a PascalCase string.
127
+ */
128
+ declare const RE_PASCAL_CASE: RegExp;
129
+ /**
130
+ * Regular expression for matching a camelCase string.
131
+ */
132
+ declare const RE_CAMEL_CASE: RegExp;
133
+ /**
134
+ * Regular expression for matching a kebab-case string.
135
+ */
136
+ declare const RE_KEBAB_CASE: RegExp;
137
+ /**
138
+ * Regular expression for matching a snake_case string.
139
+ */
140
+ declare const RE_SNAKE_CASE: RegExp;
141
+ /**
142
+ * Regular expression for matching a CONSTANT_CASE string.
189
143
  */
190
- declare const getDocsUrl: (pluginName: string) => (ruleName: string) => string;
144
+ declare const RE_CONSTANT_CASE: RegExp;
145
+ declare const RE_JAVASCRIPT_PROTOCOL: RegExp;
146
+ /**
147
+ * Regular expression for matching a valid JavaScript identifier.
148
+ */
149
+ declare const RE_JS_IDENTIFIER: RegExp;
150
+ /**
151
+ * Regular expression for matching a RegExp string.
152
+ */
153
+ declare const RE_REGEXP_STR: RegExp;
154
+ /**
155
+ * Regular expression for matching a `@jsx` annotation comment.
156
+ */
157
+ declare const RE_ANNOTATION_JSX: RegExp;
158
+ /**
159
+ * Regular expression for matching a `@jsxFrag` annotation comment.
160
+ */
161
+ declare const RE_ANNOTATION_JSX_FRAG: RegExp;
162
+ /**
163
+ * Regular expression for matching a `@jsxRuntime` annotation comment.
164
+ */
165
+ declare const RE_ANNOTATION_JSX_RUNTIME: RegExp;
166
+ /**
167
+ * Regular expression for matching a `@jsxImportSource` annotation comment.
168
+ */
169
+ declare const RE_ANNOTATION_JSX_IMPORT_SOURCE: RegExp;
170
+ /**
171
+ * Regular expression for matching a React component name.
172
+ */
173
+ declare const RE_COMPONENT_NAME: RegExp;
174
+ /**
175
+ * Regular expression for matching a React component name (loose).
176
+ */
177
+ declare const RE_COMPONENT_NAME_LOOSE: RegExp;
178
+ /**
179
+ * Regular expression for matching a React Hook name.
180
+ */
181
+ declare const RE_HOOK_NAME: RegExp;
191
182
  //#endregion
192
- //#region src/get-react-version.d.ts
183
+ //#region src/react-version.d.ts
193
184
  declare function getReactVersion(fallback: string): string;
194
185
  //#endregion
195
186
  //#region src/regexp.d.ts
@@ -320,4 +311,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
320
311
  }
321
312
  }
322
313
  //#endregion
323
- export { CompatibleConfig, CompatiblePlugin, CompatibleRule, DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettings, ESLintReactSettingsNormalized, ESLintReactSettingsSchema, ESLintSettings, ESLintSettingsSchema, GITHUB_URL, 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, RuleConfig, RuleContext, RuleFeature, RulePolicy, RuleSuggest, SettingsConfig, Severity, SeverityLevel, SeverityName, WEBSITE_URL, _require, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineSettings, getConfigAdapters, getDocsUrl, getId, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, isRegExp, normalizeSettings, report, toRegExp };
314
+ export { CompatibleConfig, CompatiblePlugin, CompatibleRule, DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettings, ESLintReactSettingsNormalized, ESLintReactSettingsSchema, ESLintSettings, ESLintSettingsSchema, GITHUB_URL, 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, RuleConfig, RuleContext, RuleFeature, RulePolicy, RuleSuggest, SettingsConfig, Severity, SeverityLevel, SeverityName, WEBSITE_URL, _require, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineSettings, getConfigAdapters, getId, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, isRegExp, normalizeSettings, report, toRegExp };
package/dist/index.js CHANGED
@@ -18,6 +18,27 @@ const getId = () => (id++).toString();
18
18
  */
19
19
  const _require = module.createRequire(process.cwd() + path.sep);
20
20
 
21
+ //#endregion
22
+ //#region src/config-adapters.ts
23
+ function getConfigAdapters(pluginName, plugin) {
24
+ function toFlatConfig(config) {
25
+ return {
26
+ ...config,
27
+ plugins: { [pluginName]: plugin }
28
+ };
29
+ }
30
+ function toLegacyConfig({ rules }) {
31
+ return {
32
+ plugins: [pluginName],
33
+ rules
34
+ };
35
+ }
36
+ return {
37
+ toFlatConfig,
38
+ toLegacyConfig
39
+ };
40
+ }
41
+
21
42
  //#endregion
22
43
  //#region src/constants.ts
23
44
  /**
@@ -103,41 +124,7 @@ const RE_COMPONENT_NAME_LOOSE = /^_?[A-Z]/u;
103
124
  const RE_HOOK_NAME = /^use/u;
104
125
 
105
126
  //#endregion
106
- //#region src/get-config-adapters.ts
107
- function getConfigAdapters(pluginName, plugin) {
108
- function toFlatConfig(config) {
109
- return {
110
- ...config,
111
- plugins: { [pluginName]: plugin }
112
- };
113
- }
114
- function toLegacyConfig({ rules }) {
115
- return {
116
- plugins: [pluginName],
117
- rules
118
- };
119
- }
120
- return {
121
- toFlatConfig,
122
- toLegacyConfig
123
- };
124
- }
125
-
126
- //#endregion
127
- //#region src/get-doc-url.ts
128
- /**
129
- * Get the URL for the documentation of a rule in a plugin.
130
- * @internal
131
- * @param pluginName The name of the plugin.
132
- * @returns The URL for the documentation of a rule.
133
- */
134
- const getDocsUrl = (pluginName) => (ruleName) => {
135
- if (pluginName === "x") return `${WEBSITE_URL}/docs/rules/${ruleName}`;
136
- return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
137
- };
138
-
139
- //#endregion
140
- //#region src/get-react-version.ts
127
+ //#region src/react-version.ts
141
128
  function getReactVersion(fallback) {
142
129
  try {
143
130
  return match(_require("react")).with({ version: P.select(P.string) }, identity).otherwise(() => fallback);
@@ -280,4 +267,4 @@ function getSettingsFromContext(context) {
280
267
  const defineSettings = identity;
281
268
 
282
269
  //#endregion
283
- export { DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, 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, _require, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineSettings, getConfigAdapters, getDocsUrl, getId, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, isRegExp, normalizeSettings, report, toRegExp };
270
+ export { DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, 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, _require, coerceESLintSettings, coerceSettings, decodeESLintSettings, decodeSettings, defineSettings, getConfigAdapters, getId, 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": "2.2.2",
3
+ "version": "2.2.3-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,7 +30,7 @@
30
30
  "@typescript-eslint/utils": "^8.46.1",
31
31
  "ts-pattern": "^5.8.0",
32
32
  "zod": "^4.1.12",
33
- "@eslint-react/eff": "2.2.2"
33
+ "@eslint-react/eff": "2.2.3-next.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@tsconfig/node22": "^22.0.2",