@eslint-react/shared 1.20.1-next.0 → 1.20.1-next.2
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.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +23 -3
- package/dist/index.mjs +22 -5
- package/package.json +2 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
import { E } from '@eslint-react/tools';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* The NPM scope for this project.
|
|
@@ -51,6 +52,8 @@ declare const REACT_BUILD_IN_HOOKS: readonly ["use", "useActionState", "useCallb
|
|
|
51
52
|
*/
|
|
52
53
|
declare const createRuleForPlugin: (pluginName: string) => <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
53
54
|
|
|
55
|
+
declare function getReactVersion(at?: string): E.Either<string, unknown>;
|
|
56
|
+
|
|
54
57
|
/**
|
|
55
58
|
* Schema with pipe type.
|
|
56
59
|
*/
|
|
@@ -2195,4 +2198,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
|
|
|
2195
2198
|
}
|
|
2196
2199
|
}
|
|
2197
2200
|
|
|
2198
|
-
export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, type CustomComponentNormalized, CustomComponentNormalizedSchema, CustomComponentSchema, type CustomHook, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, type ESLintReactSettings, type ESLintReactSettingsNormalized, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, normalizeSettings, unsafeReadSettings };
|
|
2201
|
+
export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, type CustomComponentNormalized, CustomComponentNormalizedSchema, CustomComponentSchema, type CustomHook, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, type ESLintReactSettings, type ESLintReactSettingsNormalized, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, getReactVersion, normalizeSettings, unsafeReadSettings };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
import { E } from '@eslint-react/tools';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* The NPM scope for this project.
|
|
@@ -51,6 +52,8 @@ declare const REACT_BUILD_IN_HOOKS: readonly ["use", "useActionState", "useCallb
|
|
|
51
52
|
*/
|
|
52
53
|
declare const createRuleForPlugin: (pluginName: string) => <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
53
54
|
|
|
55
|
+
declare function getReactVersion(at?: string): E.Either<string, unknown>;
|
|
56
|
+
|
|
54
57
|
/**
|
|
55
58
|
* Schema with pipe type.
|
|
56
59
|
*/
|
|
@@ -2195,4 +2198,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
|
|
|
2195
2198
|
}
|
|
2196
2199
|
}
|
|
2197
2200
|
|
|
2198
|
-
export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, type CustomComponentNormalized, CustomComponentNormalizedSchema, CustomComponentSchema, type CustomHook, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, type ESLintReactSettings, type ESLintReactSettingsNormalized, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, normalizeSettings, unsafeReadSettings };
|
|
2201
|
+
export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, type CustomComponentNormalized, CustomComponentNormalizedSchema, CustomComponentSchema, type CustomHook, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, type ESLintReactSettings, type ESLintReactSettingsNormalized, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, getReactVersion, normalizeSettings, unsafeReadSettings };
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var utils = require('@typescript-eslint/utils');
|
|
4
4
|
var tools = require('@eslint-react/tools');
|
|
5
|
-
var localPkg = require('local-pkg');
|
|
6
|
-
var pm = require('picomatch');
|
|
7
5
|
var tsPattern = require('ts-pattern');
|
|
6
|
+
var module$1 = require('module');
|
|
7
|
+
var pm = require('picomatch');
|
|
8
8
|
|
|
9
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
9
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
11
|
|
|
12
|
+
var module__default = /*#__PURE__*/_interopDefault(module$1);
|
|
11
13
|
var pm__default = /*#__PURE__*/_interopDefault(pm);
|
|
12
14
|
|
|
13
15
|
// src/constants.ts
|
|
@@ -217,6 +219,23 @@ var getDocsUrl = (pluginName) => (ruleName) => {
|
|
|
217
219
|
return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
|
|
218
220
|
};
|
|
219
221
|
var createRuleForPlugin = (pluginName) => utils.ESLintUtils.RuleCreator(getDocsUrl(pluginName));
|
|
222
|
+
function tryRequire(id, at = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))) {
|
|
223
|
+
const _require = module__default.default.createRequire(at);
|
|
224
|
+
try {
|
|
225
|
+
return tools.E.right(_require(id));
|
|
226
|
+
} catch {
|
|
227
|
+
return tools.E.left(new Error(`Module '${id}' not found`));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// src/get-react-version.ts
|
|
232
|
+
function getReactVersion(at = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))) {
|
|
233
|
+
return tools.F.pipe(
|
|
234
|
+
tryRequire("react", at),
|
|
235
|
+
tools.E.filterOrLeft(tsPattern.isMatching({ version: tsPattern.P.string }), tools.F.identity),
|
|
236
|
+
tools.E.map((mod) => mod.version)
|
|
237
|
+
);
|
|
238
|
+
}
|
|
220
239
|
|
|
221
240
|
// ../../node_modules/.pnpm/valibot@1.0.0-beta.9_typescript@5.7.2/node_modules/valibot/dist/index.js
|
|
222
241
|
var store;
|
|
@@ -1361,7 +1380,7 @@ var normalizeSettings = createMemoizedFunction((settings) => {
|
|
|
1361
1380
|
if (!/^[\w-]+$/u.test(name)) return acc;
|
|
1362
1381
|
return acc.set(name, as);
|
|
1363
1382
|
}, /* @__PURE__ */ new Map()),
|
|
1364
|
-
version: tsPattern.match(settings.version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () =>
|
|
1383
|
+
version: tsPattern.match(settings.version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () => tools.E.getOrElse(getReactVersion(), tools.F.constant("19.0.0"))).otherwise(tools.F.identity)
|
|
1365
1384
|
};
|
|
1366
1385
|
}, { isEqual: shallowEqual });
|
|
1367
1386
|
var defineSettings = tools.F.identity;
|
|
@@ -1388,5 +1407,6 @@ exports.WEBSITE_URL = WEBSITE_URL;
|
|
|
1388
1407
|
exports.createRuleForPlugin = createRuleForPlugin;
|
|
1389
1408
|
exports.decodeSettings = decodeSettings;
|
|
1390
1409
|
exports.defineSettings = defineSettings;
|
|
1410
|
+
exports.getReactVersion = getReactVersion;
|
|
1391
1411
|
exports.normalizeSettings = normalizeSettings;
|
|
1392
1412
|
exports.unsafeReadSettings = unsafeReadSettings;
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
import { F } from '@eslint-react/tools';
|
|
3
|
-
import {
|
|
2
|
+
import { F, E } from '@eslint-react/tools';
|
|
3
|
+
import { isMatching, P, match } from 'ts-pattern';
|
|
4
|
+
import module from 'node:module';
|
|
4
5
|
import pm from 'picomatch';
|
|
5
|
-
import { match, P } from 'ts-pattern';
|
|
6
6
|
|
|
7
7
|
// src/constants.ts
|
|
8
8
|
var NPM_SCOPE = "@eslint-react";
|
|
@@ -211,6 +211,23 @@ var getDocsUrl = (pluginName) => (ruleName) => {
|
|
|
211
211
|
return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
|
|
212
212
|
};
|
|
213
213
|
var createRuleForPlugin = (pluginName) => ESLintUtils.RuleCreator(getDocsUrl(pluginName));
|
|
214
|
+
function tryRequire(id, at = import.meta.url) {
|
|
215
|
+
const _require = module.createRequire(at);
|
|
216
|
+
try {
|
|
217
|
+
return E.right(_require(id));
|
|
218
|
+
} catch {
|
|
219
|
+
return E.left(new Error(`Module '${id}' not found`));
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// src/get-react-version.ts
|
|
224
|
+
function getReactVersion(at = import.meta.url) {
|
|
225
|
+
return F.pipe(
|
|
226
|
+
tryRequire("react", at),
|
|
227
|
+
E.filterOrLeft(isMatching({ version: P.string }), F.identity),
|
|
228
|
+
E.map((mod) => mod.version)
|
|
229
|
+
);
|
|
230
|
+
}
|
|
214
231
|
|
|
215
232
|
// ../../node_modules/.pnpm/valibot@1.0.0-beta.9_typescript@5.7.2/node_modules/valibot/dist/index.js
|
|
216
233
|
var store;
|
|
@@ -1355,9 +1372,9 @@ var normalizeSettings = createMemoizedFunction((settings) => {
|
|
|
1355
1372
|
if (!/^[\w-]+$/u.test(name)) return acc;
|
|
1356
1373
|
return acc.set(name, as);
|
|
1357
1374
|
}, /* @__PURE__ */ new Map()),
|
|
1358
|
-
version: match(settings.version).with(P.union(P.nullish, "", "detect"), () =>
|
|
1375
|
+
version: match(settings.version).with(P.union(P.nullish, "", "detect"), () => E.getOrElse(getReactVersion(), F.constant("19.0.0"))).otherwise(F.identity)
|
|
1359
1376
|
};
|
|
1360
1377
|
}, { isEqual: shallowEqual });
|
|
1361
1378
|
var defineSettings = F.identity;
|
|
1362
1379
|
|
|
1363
|
-
export { CustomAttributeSchema, CustomComponentNormalizedSchema, CustomComponentSchema, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, normalizeSettings, unsafeReadSettings };
|
|
1380
|
+
export { CustomAttributeSchema, CustomComponentNormalizedSchema, CustomComponentSchema, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, getReactVersion, normalizeSettings, unsafeReadSettings };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "1.20.1-next.
|
|
3
|
+
"version": "1.20.1-next.2",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -36,10 +36,9 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@typescript-eslint/utils": "^8.18.1",
|
|
39
|
-
"local-pkg": "^0.5.1",
|
|
40
39
|
"picomatch": "^4.0.2",
|
|
41
40
|
"ts-pattern": "^5.6.0",
|
|
42
|
-
"@eslint-react/tools": "1.20.1-next.
|
|
41
|
+
"@eslint-react/tools": "1.20.1-next.2"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
44
|
"@types/picomatch": "^3.0.1",
|