@eslint-react/shared 1.24.0-next.11 → 1.24.0-next.13
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 +182 -184
- package/dist/index.d.ts +182 -184
- package/dist/index.js +33 -22
- package/dist/index.mjs +33 -23
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -221,6 +221,10 @@ var getDocsUrl = (pluginName) => (ruleName) => {
|
|
|
221
221
|
return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
|
|
222
222
|
};
|
|
223
223
|
var createRuleForPlugin = (pluginName) => utils.ESLintUtils.RuleCreator(getDocsUrl(pluginName));
|
|
224
|
+
|
|
225
|
+
// src/get-id.ts
|
|
226
|
+
var id = 0n;
|
|
227
|
+
var getId = () => (id++).toString();
|
|
224
228
|
var _require = module__default.default.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
|
|
225
229
|
function getReactVersion(fallback = "19.0.0") {
|
|
226
230
|
try {
|
|
@@ -230,7 +234,7 @@ function getReactVersion(fallback = "19.0.0") {
|
|
|
230
234
|
}
|
|
231
235
|
}
|
|
232
236
|
|
|
233
|
-
// ../../node_modules/.pnpm/valibot@1.0.0-beta.
|
|
237
|
+
// ../../node_modules/.pnpm/valibot@1.0.0-beta.12_typescript@5.7.3/node_modules/valibot/dist/index.js
|
|
234
238
|
var store;
|
|
235
239
|
// @__NO_SIDE_EFFECTS__
|
|
236
240
|
function getGlobalConfig(config2) {
|
|
@@ -524,7 +528,6 @@ function string(message) {
|
|
|
524
528
|
}
|
|
525
529
|
};
|
|
526
530
|
}
|
|
527
|
-
// @__NO_SIDE_EFFECTS__
|
|
528
531
|
function parse(schema, input, config2) {
|
|
529
532
|
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
|
|
530
533
|
if (dataset.issues) {
|
|
@@ -567,13 +570,6 @@ var CustomComponentSchema = object({
|
|
|
567
570
|
* "Link"
|
|
568
571
|
*/
|
|
569
572
|
name: string(),
|
|
570
|
-
/**
|
|
571
|
-
* The ESQuery selector to select the component precisely.
|
|
572
|
-
* @internal
|
|
573
|
-
* @example
|
|
574
|
-
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
575
|
-
*/
|
|
576
|
-
selector: optional(string()),
|
|
577
573
|
/**
|
|
578
574
|
* The name of the built-in component that the user-defined component represents.
|
|
579
575
|
* @example
|
|
@@ -585,7 +581,14 @@ var CustomComponentSchema = object({
|
|
|
585
581
|
* @example
|
|
586
582
|
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
587
583
|
*/
|
|
588
|
-
attributes: optional(array(CustomComponentPropSchema))
|
|
584
|
+
attributes: optional(array(CustomComponentPropSchema)),
|
|
585
|
+
/**
|
|
586
|
+
* The ESQuery selector to select the component precisely.
|
|
587
|
+
* @internal
|
|
588
|
+
* @example
|
|
589
|
+
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
590
|
+
*/
|
|
591
|
+
selector: optional(string())
|
|
589
592
|
});
|
|
590
593
|
var CustomHooksSchema = object({
|
|
591
594
|
use: optional(array(string())),
|
|
@@ -615,26 +618,26 @@ var ESLintReactSettingsSchema = object({
|
|
|
615
618
|
* @default `"react"`
|
|
616
619
|
* @example `"@pika/react"`
|
|
617
620
|
*/
|
|
618
|
-
importSource: optional(string()
|
|
621
|
+
importSource: optional(string()),
|
|
619
622
|
/**
|
|
620
623
|
* The identifier that’s used for JSX Element creation.
|
|
621
624
|
* @default `"createElement"`
|
|
622
625
|
* @deprecated
|
|
623
626
|
*/
|
|
624
|
-
jsxPragma: optional(string()
|
|
627
|
+
jsxPragma: optional(string()),
|
|
625
628
|
/**
|
|
626
629
|
* The identifier that’s used for JSX fragment elements.
|
|
627
630
|
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
628
631
|
* @default `"Fragment"`
|
|
629
632
|
* @deprecated
|
|
630
633
|
*/
|
|
631
|
-
jsxPragmaFrag: optional(string()
|
|
634
|
+
jsxPragmaFrag: optional(string()),
|
|
632
635
|
/**
|
|
633
636
|
* The name of the prop that is used for polymorphic components.
|
|
634
637
|
* @description This is used to determine the type of the component.
|
|
635
638
|
* @example `"as"`
|
|
636
639
|
*/
|
|
637
|
-
polymorphicPropName: optional(string()
|
|
640
|
+
polymorphicPropName: optional(string()),
|
|
638
641
|
/**
|
|
639
642
|
* @internal
|
|
640
643
|
*/
|
|
@@ -649,19 +652,19 @@ var ESLintReactSettingsSchema = object({
|
|
|
649
652
|
* @example `"18.3.1"`
|
|
650
653
|
* @default `"detect"`
|
|
651
654
|
*/
|
|
652
|
-
version: optional(string()
|
|
653
|
-
/**
|
|
654
|
-
* An array of user-defined components
|
|
655
|
-
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
656
|
-
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
657
|
-
*/
|
|
658
|
-
additionalComponents: optional(array(CustomComponentSchema)),
|
|
655
|
+
version: optional(string()),
|
|
659
656
|
/**
|
|
660
657
|
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
661
658
|
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
662
659
|
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
663
660
|
*/
|
|
664
|
-
additionalHooks: optional(CustomHooksSchema)
|
|
661
|
+
additionalHooks: optional(CustomHooksSchema),
|
|
662
|
+
/**
|
|
663
|
+
* An array of user-defined components
|
|
664
|
+
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
665
|
+
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
666
|
+
*/
|
|
667
|
+
additionalComponents: optional(array(CustomComponentSchema))
|
|
665
668
|
});
|
|
666
669
|
var ESLintSettingsSchema = optional(
|
|
667
670
|
object({
|
|
@@ -673,6 +676,13 @@ var ESLintSettingsSchema = optional(
|
|
|
673
676
|
);
|
|
674
677
|
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
675
678
|
...parse(ESLintReactSettingsSchema, {}),
|
|
679
|
+
importSource: "react",
|
|
680
|
+
jsxPragma: "createElement",
|
|
681
|
+
jsxPragmaFrag: "Fragment",
|
|
682
|
+
polymorphicPropName: "as",
|
|
683
|
+
strict: false,
|
|
684
|
+
strictImportCheck: false,
|
|
685
|
+
version: "detect",
|
|
676
686
|
additionalHooks: {
|
|
677
687
|
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
678
688
|
}
|
|
@@ -1437,6 +1447,7 @@ exports.WEBSITE_URL = WEBSITE_URL;
|
|
|
1437
1447
|
exports.createRuleForPlugin = createRuleForPlugin;
|
|
1438
1448
|
exports.decodeSettings = decodeSettings;
|
|
1439
1449
|
exports.defineSettings = defineSettings;
|
|
1450
|
+
exports.getId = getId;
|
|
1440
1451
|
exports.getReactVersion = getReactVersion;
|
|
1441
1452
|
exports.getSettingsFromContext = getSettingsFromContext;
|
|
1442
1453
|
exports.toNormalizedSettings = toNormalizedSettings;
|
package/dist/index.mjs
CHANGED
|
@@ -213,6 +213,10 @@ var getDocsUrl = (pluginName) => (ruleName) => {
|
|
|
213
213
|
return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
|
|
214
214
|
};
|
|
215
215
|
var createRuleForPlugin = (pluginName) => ESLintUtils.RuleCreator(getDocsUrl(pluginName));
|
|
216
|
+
|
|
217
|
+
// src/get-id.ts
|
|
218
|
+
var id = 0n;
|
|
219
|
+
var getId = () => (id++).toString();
|
|
216
220
|
var _require = module.createRequire(import.meta.url);
|
|
217
221
|
function getReactVersion(fallback = "19.0.0") {
|
|
218
222
|
try {
|
|
@@ -222,7 +226,7 @@ function getReactVersion(fallback = "19.0.0") {
|
|
|
222
226
|
}
|
|
223
227
|
}
|
|
224
228
|
|
|
225
|
-
// ../../node_modules/.pnpm/valibot@1.0.0-beta.
|
|
229
|
+
// ../../node_modules/.pnpm/valibot@1.0.0-beta.12_typescript@5.7.3/node_modules/valibot/dist/index.js
|
|
226
230
|
var store;
|
|
227
231
|
// @__NO_SIDE_EFFECTS__
|
|
228
232
|
function getGlobalConfig(config2) {
|
|
@@ -516,7 +520,6 @@ function string(message) {
|
|
|
516
520
|
}
|
|
517
521
|
};
|
|
518
522
|
}
|
|
519
|
-
// @__NO_SIDE_EFFECTS__
|
|
520
523
|
function parse(schema, input, config2) {
|
|
521
524
|
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
|
|
522
525
|
if (dataset.issues) {
|
|
@@ -559,13 +562,6 @@ var CustomComponentSchema = object({
|
|
|
559
562
|
* "Link"
|
|
560
563
|
*/
|
|
561
564
|
name: string(),
|
|
562
|
-
/**
|
|
563
|
-
* The ESQuery selector to select the component precisely.
|
|
564
|
-
* @internal
|
|
565
|
-
* @example
|
|
566
|
-
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
567
|
-
*/
|
|
568
|
-
selector: optional(string()),
|
|
569
565
|
/**
|
|
570
566
|
* The name of the built-in component that the user-defined component represents.
|
|
571
567
|
* @example
|
|
@@ -577,7 +573,14 @@ var CustomComponentSchema = object({
|
|
|
577
573
|
* @example
|
|
578
574
|
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
579
575
|
*/
|
|
580
|
-
attributes: optional(array(CustomComponentPropSchema))
|
|
576
|
+
attributes: optional(array(CustomComponentPropSchema)),
|
|
577
|
+
/**
|
|
578
|
+
* The ESQuery selector to select the component precisely.
|
|
579
|
+
* @internal
|
|
580
|
+
* @example
|
|
581
|
+
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
582
|
+
*/
|
|
583
|
+
selector: optional(string())
|
|
581
584
|
});
|
|
582
585
|
var CustomHooksSchema = object({
|
|
583
586
|
use: optional(array(string())),
|
|
@@ -607,26 +610,26 @@ var ESLintReactSettingsSchema = object({
|
|
|
607
610
|
* @default `"react"`
|
|
608
611
|
* @example `"@pika/react"`
|
|
609
612
|
*/
|
|
610
|
-
importSource: optional(string()
|
|
613
|
+
importSource: optional(string()),
|
|
611
614
|
/**
|
|
612
615
|
* The identifier that’s used for JSX Element creation.
|
|
613
616
|
* @default `"createElement"`
|
|
614
617
|
* @deprecated
|
|
615
618
|
*/
|
|
616
|
-
jsxPragma: optional(string()
|
|
619
|
+
jsxPragma: optional(string()),
|
|
617
620
|
/**
|
|
618
621
|
* The identifier that’s used for JSX fragment elements.
|
|
619
622
|
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
620
623
|
* @default `"Fragment"`
|
|
621
624
|
* @deprecated
|
|
622
625
|
*/
|
|
623
|
-
jsxPragmaFrag: optional(string()
|
|
626
|
+
jsxPragmaFrag: optional(string()),
|
|
624
627
|
/**
|
|
625
628
|
* The name of the prop that is used for polymorphic components.
|
|
626
629
|
* @description This is used to determine the type of the component.
|
|
627
630
|
* @example `"as"`
|
|
628
631
|
*/
|
|
629
|
-
polymorphicPropName: optional(string()
|
|
632
|
+
polymorphicPropName: optional(string()),
|
|
630
633
|
/**
|
|
631
634
|
* @internal
|
|
632
635
|
*/
|
|
@@ -641,19 +644,19 @@ var ESLintReactSettingsSchema = object({
|
|
|
641
644
|
* @example `"18.3.1"`
|
|
642
645
|
* @default `"detect"`
|
|
643
646
|
*/
|
|
644
|
-
version: optional(string()
|
|
645
|
-
/**
|
|
646
|
-
* An array of user-defined components
|
|
647
|
-
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
648
|
-
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
649
|
-
*/
|
|
650
|
-
additionalComponents: optional(array(CustomComponentSchema)),
|
|
647
|
+
version: optional(string()),
|
|
651
648
|
/**
|
|
652
649
|
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
653
650
|
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
654
651
|
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
655
652
|
*/
|
|
656
|
-
additionalHooks: optional(CustomHooksSchema)
|
|
653
|
+
additionalHooks: optional(CustomHooksSchema),
|
|
654
|
+
/**
|
|
655
|
+
* An array of user-defined components
|
|
656
|
+
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
657
|
+
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
658
|
+
*/
|
|
659
|
+
additionalComponents: optional(array(CustomComponentSchema))
|
|
657
660
|
});
|
|
658
661
|
var ESLintSettingsSchema = optional(
|
|
659
662
|
object({
|
|
@@ -665,6 +668,13 @@ var ESLintSettingsSchema = optional(
|
|
|
665
668
|
);
|
|
666
669
|
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
667
670
|
...parse(ESLintReactSettingsSchema, {}),
|
|
671
|
+
importSource: "react",
|
|
672
|
+
jsxPragma: "createElement",
|
|
673
|
+
jsxPragmaFrag: "Fragment",
|
|
674
|
+
polymorphicPropName: "as",
|
|
675
|
+
strict: false,
|
|
676
|
+
strictImportCheck: false,
|
|
677
|
+
version: "detect",
|
|
668
678
|
additionalHooks: {
|
|
669
679
|
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
670
680
|
}
|
|
@@ -1408,4 +1418,4 @@ function getSettingsFromContext(context) {
|
|
|
1408
1418
|
}
|
|
1409
1419
|
var defineSettings = identity;
|
|
1410
1420
|
|
|
1411
|
-
export { CustomComponentPropSchema, CustomComponentSchema, CustomHooksSchema, DEFAULT_ESLINT_REACT_SETTINGS, DOM_HTML_COMPONENT_TYPES, DOM_SVG_COMPONENT_TYPES, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, 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, getSettingsFromContext, toNormalizedSettings, unsafeDecodeSettings };
|
|
1421
|
+
export { CustomComponentPropSchema, CustomComponentSchema, CustomHooksSchema, DEFAULT_ESLINT_REACT_SETTINGS, DOM_HTML_COMPONENT_TYPES, DOM_SVG_COMPONENT_TYPES, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, 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, getId, getReactVersion, getSettingsFromContext, toNormalizedSettings, unsafeDecodeSettings };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "1.24.0-next.
|
|
3
|
+
"version": "1.24.0-next.13",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@typescript-eslint/utils": "^8.20.0",
|
|
37
37
|
"picomatch": "^4.0.2",
|
|
38
38
|
"ts-pattern": "^5.6.0",
|
|
39
|
-
"@eslint-react/eff": "1.24.0-next.
|
|
39
|
+
"@eslint-react/eff": "1.24.0-next.13"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/picomatch": "^3.0.1",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"micro-memoize": "^4.1.3",
|
|
45
45
|
"tsup": "^8.3.5",
|
|
46
46
|
"type-fest": "^4.32.0",
|
|
47
|
-
"valibot": "^1.0.0-beta.
|
|
47
|
+
"valibot": "^1.0.0-beta.12",
|
|
48
48
|
"@workspace/configs": "0.0.0"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|