@eslint-react/shared 1.23.2-next.1 → 1.23.2-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 +6 -11
- package/dist/index.d.ts +6 -11
- package/dist/index.js +17 -10
- package/dist/index.mjs +19 -11
- package/package.json +2 -4
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { ESLintUtils } from '@typescript-eslint/utils';
|
|
|
2
2
|
import { E } from '@eslint-react/eff';
|
|
3
3
|
import * as valibot from 'valibot';
|
|
4
4
|
import { InferOutput } from 'valibot';
|
|
5
|
-
import * as micro_memoize from 'micro-memoize';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* The NPM scope for this project.
|
|
@@ -736,20 +735,16 @@ declare const DEFAULT_ESLINT_REACT_SETTINGS: {
|
|
|
736
735
|
* @returns settings The settings.
|
|
737
736
|
*/
|
|
738
737
|
declare function unsafeReadSettings(data: unknown): PartialDeep<ESLintReactSettings>;
|
|
739
|
-
/**
|
|
740
|
-
* Decodes settings from a data object from `context.settings`.
|
|
741
|
-
* @internal
|
|
742
|
-
* @param data The data object.
|
|
743
|
-
* @returns settings The settings.
|
|
744
|
-
*/
|
|
745
|
-
declare const decodeSettings: micro_memoize.Memoized<(data: unknown) => ESLintReactSettings>;
|
|
746
738
|
/**
|
|
747
739
|
* Normalizes the settings by converting all shorthand properties to their full form.
|
|
748
|
-
* @param
|
|
740
|
+
* @param data The raw settings.
|
|
749
741
|
* @returns The normalized settings.
|
|
750
742
|
* @internal
|
|
751
743
|
*/
|
|
752
|
-
declare
|
|
744
|
+
declare function normalizeSettings(data: unknown): ESLintReactSettingsNormalized;
|
|
745
|
+
declare function getSettingsFromContext(context: {
|
|
746
|
+
settings: unknown;
|
|
747
|
+
}): ESLintReactSettingsNormalized;
|
|
753
748
|
/**
|
|
754
749
|
* A helper function to define settings for "react-x" with type checking in JavaScript files.
|
|
755
750
|
* @param settings The settings.
|
|
@@ -762,4 +757,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
|
|
|
762
757
|
}
|
|
763
758
|
}
|
|
764
759
|
|
|
765
|
-
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,
|
|
760
|
+
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, defineSettings, getReactVersion, getSettingsFromContext, normalizeSettings, unsafeReadSettings };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { ESLintUtils } from '@typescript-eslint/utils';
|
|
|
2
2
|
import { E } from '@eslint-react/eff';
|
|
3
3
|
import * as valibot from 'valibot';
|
|
4
4
|
import { InferOutput } from 'valibot';
|
|
5
|
-
import * as micro_memoize from 'micro-memoize';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* The NPM scope for this project.
|
|
@@ -736,20 +735,16 @@ declare const DEFAULT_ESLINT_REACT_SETTINGS: {
|
|
|
736
735
|
* @returns settings The settings.
|
|
737
736
|
*/
|
|
738
737
|
declare function unsafeReadSettings(data: unknown): PartialDeep<ESLintReactSettings>;
|
|
739
|
-
/**
|
|
740
|
-
* Decodes settings from a data object from `context.settings`.
|
|
741
|
-
* @internal
|
|
742
|
-
* @param data The data object.
|
|
743
|
-
* @returns settings The settings.
|
|
744
|
-
*/
|
|
745
|
-
declare const decodeSettings: micro_memoize.Memoized<(data: unknown) => ESLintReactSettings>;
|
|
746
738
|
/**
|
|
747
739
|
* Normalizes the settings by converting all shorthand properties to their full form.
|
|
748
|
-
* @param
|
|
740
|
+
* @param data The raw settings.
|
|
749
741
|
* @returns The normalized settings.
|
|
750
742
|
* @internal
|
|
751
743
|
*/
|
|
752
|
-
declare
|
|
744
|
+
declare function normalizeSettings(data: unknown): ESLintReactSettingsNormalized;
|
|
745
|
+
declare function getSettingsFromContext(context: {
|
|
746
|
+
settings: unknown;
|
|
747
|
+
}): ESLintReactSettingsNormalized;
|
|
753
748
|
/**
|
|
754
749
|
* A helper function to define settings for "react-x" with type checking in JavaScript files.
|
|
755
750
|
* @param settings The settings.
|
|
@@ -762,4 +757,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
|
|
|
762
757
|
}
|
|
763
758
|
}
|
|
764
759
|
|
|
765
|
-
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,
|
|
760
|
+
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, defineSettings, getReactVersion, getSettingsFromContext, normalizeSettings, unsafeReadSettings };
|
package/dist/index.js
CHANGED
|
@@ -5,15 +5,12 @@ var eff = require('@eslint-react/eff');
|
|
|
5
5
|
var tsPattern = require('ts-pattern');
|
|
6
6
|
var module$1 = require('module');
|
|
7
7
|
var valibot = require('valibot');
|
|
8
|
-
var fastEquals = require('fast-equals');
|
|
9
|
-
var memoize = require('micro-memoize');
|
|
10
8
|
var pm = require('picomatch');
|
|
11
9
|
|
|
12
10
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
13
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
12
|
|
|
15
13
|
var module__default = /*#__PURE__*/_interopDefault(module$1);
|
|
16
|
-
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
|
17
14
|
var pm__default = /*#__PURE__*/_interopDefault(pm);
|
|
18
15
|
|
|
19
16
|
// src/constants.ts
|
|
@@ -385,6 +382,11 @@ var ESLintSettingsSchema = valibot.optional(
|
|
|
385
382
|
}),
|
|
386
383
|
{}
|
|
387
384
|
);
|
|
385
|
+
|
|
386
|
+
// src/cache.ts
|
|
387
|
+
var normalizedSettingsCache = /* @__PURE__ */ new Map();
|
|
388
|
+
|
|
389
|
+
// src/settings.ts
|
|
388
390
|
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
389
391
|
additionalHooks: {
|
|
390
392
|
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
@@ -396,15 +398,15 @@ var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
|
396
398
|
function unsafeReadSettings(data) {
|
|
397
399
|
return data?.["react-x"] ?? {};
|
|
398
400
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
+
function normalizeSettings(data) {
|
|
402
|
+
const memoized = normalizedSettingsCache.get(data);
|
|
403
|
+
if (memoized) return memoized;
|
|
404
|
+
const settings = {
|
|
401
405
|
...DEFAULT_ESLINT_REACT_SETTINGS,
|
|
402
406
|
...valibot.parse(ESLintSettingsSchema, data)["react-x"] ?? {}
|
|
403
407
|
};
|
|
404
|
-
}, { isEqual: (a, b) => a === b });
|
|
405
|
-
var normalizeSettings = memoize__default.default((settings) => {
|
|
406
408
|
const additionalComponents = settings.additionalComponents ?? [];
|
|
407
|
-
|
|
409
|
+
const normalized = {
|
|
408
410
|
...settings,
|
|
409
411
|
additionalComponents: additionalComponents.map((component) => ({
|
|
410
412
|
...component,
|
|
@@ -422,7 +424,12 @@ var normalizeSettings = memoize__default.default((settings) => {
|
|
|
422
424
|
}, /* @__PURE__ */ new Map()),
|
|
423
425
|
version: tsPattern.match(settings.version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () => eff.E.getOrElse(getReactVersion(), eff.F.constant("19.0.0"))).otherwise(eff.F.identity)
|
|
424
426
|
};
|
|
425
|
-
|
|
427
|
+
normalizedSettingsCache.set(data, normalized);
|
|
428
|
+
return normalized;
|
|
429
|
+
}
|
|
430
|
+
function getSettingsFromContext(context) {
|
|
431
|
+
return normalizeSettings(context.settings);
|
|
432
|
+
}
|
|
426
433
|
var defineSettings = eff.F.identity;
|
|
427
434
|
|
|
428
435
|
exports.CustomAttributeSchema = CustomAttributeSchema;
|
|
@@ -445,8 +452,8 @@ exports.RE_PASCAL_CASE = RE_PASCAL_CASE;
|
|
|
445
452
|
exports.RE_SNAKE_CASE = RE_SNAKE_CASE;
|
|
446
453
|
exports.WEBSITE_URL = WEBSITE_URL;
|
|
447
454
|
exports.createRuleForPlugin = createRuleForPlugin;
|
|
448
|
-
exports.decodeSettings = decodeSettings;
|
|
449
455
|
exports.defineSettings = defineSettings;
|
|
450
456
|
exports.getReactVersion = getReactVersion;
|
|
457
|
+
exports.getSettingsFromContext = getSettingsFromContext;
|
|
451
458
|
exports.normalizeSettings = normalizeSettings;
|
|
452
459
|
exports.unsafeReadSettings = unsafeReadSettings;
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { F, E } from '@eslint-react/eff';
|
|
3
|
+
import { isMatching, P, match } from 'ts-pattern';
|
|
4
4
|
import module from 'node:module';
|
|
5
5
|
import { object, string, optional, boolean, array, instance, parse } from 'valibot';
|
|
6
|
-
import { shallowEqual } from 'fast-equals';
|
|
7
|
-
import memoize from 'micro-memoize';
|
|
8
6
|
import pm from 'picomatch';
|
|
9
7
|
|
|
10
8
|
// src/constants.ts
|
|
@@ -376,6 +374,11 @@ var ESLintSettingsSchema = optional(
|
|
|
376
374
|
}),
|
|
377
375
|
{}
|
|
378
376
|
);
|
|
377
|
+
|
|
378
|
+
// src/cache.ts
|
|
379
|
+
var normalizedSettingsCache = /* @__PURE__ */ new Map();
|
|
380
|
+
|
|
381
|
+
// src/settings.ts
|
|
379
382
|
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
380
383
|
additionalHooks: {
|
|
381
384
|
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
@@ -387,15 +390,15 @@ var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
|
387
390
|
function unsafeReadSettings(data) {
|
|
388
391
|
return data?.["react-x"] ?? {};
|
|
389
392
|
}
|
|
390
|
-
|
|
391
|
-
|
|
393
|
+
function normalizeSettings(data) {
|
|
394
|
+
const memoized = normalizedSettingsCache.get(data);
|
|
395
|
+
if (memoized) return memoized;
|
|
396
|
+
const settings = {
|
|
392
397
|
...DEFAULT_ESLINT_REACT_SETTINGS,
|
|
393
398
|
...parse(ESLintSettingsSchema, data)["react-x"] ?? {}
|
|
394
399
|
};
|
|
395
|
-
}, { isEqual: (a, b) => a === b });
|
|
396
|
-
var normalizeSettings = memoize((settings) => {
|
|
397
400
|
const additionalComponents = settings.additionalComponents ?? [];
|
|
398
|
-
|
|
401
|
+
const normalized = {
|
|
399
402
|
...settings,
|
|
400
403
|
additionalComponents: additionalComponents.map((component) => ({
|
|
401
404
|
...component,
|
|
@@ -413,7 +416,12 @@ var normalizeSettings = memoize((settings) => {
|
|
|
413
416
|
}, /* @__PURE__ */ new Map()),
|
|
414
417
|
version: match(settings.version).with(P.union(P.nullish, "", "detect"), () => E.getOrElse(getReactVersion(), F.constant("19.0.0"))).otherwise(F.identity)
|
|
415
418
|
};
|
|
416
|
-
|
|
419
|
+
normalizedSettingsCache.set(data, normalized);
|
|
420
|
+
return normalized;
|
|
421
|
+
}
|
|
422
|
+
function getSettingsFromContext(context) {
|
|
423
|
+
return normalizeSettings(context.settings);
|
|
424
|
+
}
|
|
417
425
|
var defineSettings = F.identity;
|
|
418
426
|
|
|
419
|
-
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,
|
|
427
|
+
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, defineSettings, getReactVersion, getSettingsFromContext, normalizeSettings, unsafeReadSettings };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "1.23.2-next.
|
|
3
|
+
"version": "1.23.2-next.2",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/rEl1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -34,12 +34,10 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@typescript-eslint/utils": "^8.19.0",
|
|
37
|
-
"fast-equals": "^5.0.1",
|
|
38
|
-
"micro-memoize": "^4.1.2",
|
|
39
37
|
"picomatch": "^4.0.2",
|
|
40
38
|
"ts-pattern": "^5.6.0",
|
|
41
39
|
"valibot": "^1.0.0-beta.9",
|
|
42
|
-
"@eslint-react/eff": "1.23.2-next.
|
|
40
|
+
"@eslint-react/eff": "1.23.2-next.2"
|
|
43
41
|
},
|
|
44
42
|
"devDependencies": {
|
|
45
43
|
"@types/picomatch": "^3.0.1",
|