eslint-plugin-react-hooks-extra 1.36.2 → 1.36.3-beta.1
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.js +11 -4
- package/dist/index.mjs +11 -4
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -50,7 +50,7 @@ var rules = {
|
|
|
50
50
|
|
|
51
51
|
// package.json
|
|
52
52
|
var name2 = "eslint-plugin-react-hooks-extra";
|
|
53
|
-
var version = "1.36.
|
|
53
|
+
var version = "1.36.3-beta.1";
|
|
54
54
|
var createRule = shared.createRuleForPlugin("hooks-extra");
|
|
55
55
|
function isFromHookCall(context, name3, settings, predicate = eff.constTrue) {
|
|
56
56
|
const hookAlias = settings.additionalHooks[name3] ?? [];
|
|
@@ -576,7 +576,14 @@ function create5(context) {
|
|
|
576
576
|
}
|
|
577
577
|
var RULE_NAME6 = "prefer-use-state-lazy-initialization";
|
|
578
578
|
var RULE_FEATURES6 = [];
|
|
579
|
-
var ALLOW_LIST = [
|
|
579
|
+
var ALLOW_LIST = [
|
|
580
|
+
"Boolean",
|
|
581
|
+
"String",
|
|
582
|
+
"Number"
|
|
583
|
+
];
|
|
584
|
+
function isAllowedName(name3) {
|
|
585
|
+
return ALLOW_LIST.includes(name3) || core.isReactHookName(name3);
|
|
586
|
+
}
|
|
580
587
|
var prefer_use_state_lazy_initialization_default = createRule({
|
|
581
588
|
meta: {
|
|
582
589
|
type: "problem",
|
|
@@ -610,10 +617,10 @@ function create6(context) {
|
|
|
610
617
|
}
|
|
611
618
|
const nestedCallExpressions = AST__namespace.getNestedCallExpressions(useStateInput);
|
|
612
619
|
const hasFunctionCall = nestedCallExpressions.some((n) => {
|
|
613
|
-
return "name" in n.callee && !
|
|
620
|
+
return "name" in n.callee && !isAllowedName(n.callee.name);
|
|
614
621
|
});
|
|
615
622
|
const hasNewCall = AST__namespace.getNestedNewExpressions(useStateInput).some((n) => {
|
|
616
|
-
return "name" in n.callee && !
|
|
623
|
+
return "name" in n.callee && !isAllowedName(n.callee.name);
|
|
617
624
|
});
|
|
618
625
|
if (!hasFunctionCall && !hasNewCall) {
|
|
619
626
|
return;
|
package/dist/index.mjs
CHANGED
|
@@ -27,7 +27,7 @@ var rules = {
|
|
|
27
27
|
|
|
28
28
|
// package.json
|
|
29
29
|
var name2 = "eslint-plugin-react-hooks-extra";
|
|
30
|
-
var version = "1.36.
|
|
30
|
+
var version = "1.36.3-beta.1";
|
|
31
31
|
var createRule = createRuleForPlugin("hooks-extra");
|
|
32
32
|
function isFromHookCall(context, name3, settings, predicate = constTrue) {
|
|
33
33
|
const hookAlias = settings.additionalHooks[name3] ?? [];
|
|
@@ -553,7 +553,14 @@ function create5(context) {
|
|
|
553
553
|
}
|
|
554
554
|
var RULE_NAME6 = "prefer-use-state-lazy-initialization";
|
|
555
555
|
var RULE_FEATURES6 = [];
|
|
556
|
-
var ALLOW_LIST = [
|
|
556
|
+
var ALLOW_LIST = [
|
|
557
|
+
"Boolean",
|
|
558
|
+
"String",
|
|
559
|
+
"Number"
|
|
560
|
+
];
|
|
561
|
+
function isAllowedName(name3) {
|
|
562
|
+
return ALLOW_LIST.includes(name3) || isReactHookName(name3);
|
|
563
|
+
}
|
|
557
564
|
var prefer_use_state_lazy_initialization_default = createRule({
|
|
558
565
|
meta: {
|
|
559
566
|
type: "problem",
|
|
@@ -587,10 +594,10 @@ function create6(context) {
|
|
|
587
594
|
}
|
|
588
595
|
const nestedCallExpressions = AST.getNestedCallExpressions(useStateInput);
|
|
589
596
|
const hasFunctionCall = nestedCallExpressions.some((n) => {
|
|
590
|
-
return "name" in n.callee && !
|
|
597
|
+
return "name" in n.callee && !isAllowedName(n.callee.name);
|
|
591
598
|
});
|
|
592
599
|
const hasNewCall = AST.getNestedNewExpressions(useStateInput).some((n) => {
|
|
593
|
-
return "name" in n.callee && !
|
|
600
|
+
return "name" in n.callee && !isAllowedName(n.callee.name);
|
|
594
601
|
});
|
|
595
602
|
if (!hasFunctionCall && !hasNewCall) {
|
|
596
603
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks-extra",
|
|
3
|
-
"version": "1.36.
|
|
3
|
+
"version": "1.36.3-beta.1",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"@typescript-eslint/utils": "^8.26.1",
|
|
51
51
|
"string-ts": "^2.2.1",
|
|
52
52
|
"ts-pattern": "^5.6.2",
|
|
53
|
-
"@eslint-react/ast": "1.36.
|
|
54
|
-
"@eslint-react/core": "1.36.
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
58
|
-
"@eslint-react/
|
|
53
|
+
"@eslint-react/ast": "1.36.3-beta.1",
|
|
54
|
+
"@eslint-react/core": "1.36.3-beta.1",
|
|
55
|
+
"@eslint-react/eff": "1.36.3-beta.1",
|
|
56
|
+
"@eslint-react/jsx": "1.36.3-beta.1",
|
|
57
|
+
"@eslint-react/shared": "1.36.3-beta.1",
|
|
58
|
+
"@eslint-react/var": "1.36.3-beta.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/react": "^19.0.12",
|