eslint-plugin-react-hooks-extra 1.5.28-beta.5 → 1.5.28-beta.7
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 +7 -9
- package/dist/index.mjs +7 -9
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var astUtils = require('@typescript-eslint/utils/ast-utils');
|
|
|
9
9
|
|
|
10
10
|
// package.json
|
|
11
11
|
var name = "eslint-plugin-react-hooks-extra";
|
|
12
|
-
var version = "1.5.28-beta.
|
|
12
|
+
var version = "1.5.28-beta.7";
|
|
13
13
|
var createRule = shared.createRuleForPlugin("hooks-extra");
|
|
14
14
|
|
|
15
15
|
// src/rules/ensure-custom-hooks-using-other-hooks.ts
|
|
@@ -483,10 +483,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
483
483
|
}).otherwise(tools.F.constVoid);
|
|
484
484
|
},
|
|
485
485
|
":function:exit"(node) {
|
|
486
|
-
|
|
487
|
-
if (effectFn === node) {
|
|
488
|
-
tools.MutRef.set(effectFunctionRef, null);
|
|
489
|
-
}
|
|
486
|
+
tools.MutRef.update(effectFunctionRef, (current) => current === node ? null : current);
|
|
490
487
|
tools.MutList.pop(functionStack);
|
|
491
488
|
},
|
|
492
489
|
CallExpression(node) {
|
|
@@ -508,6 +505,8 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
508
505
|
}).with("useEffect", () => {
|
|
509
506
|
tools.MutRef.set(useEffectCallRef, node);
|
|
510
507
|
}).with("other", () => {
|
|
508
|
+
const isInEffectFunction = effectFn === parentFn;
|
|
509
|
+
if (!isInEffectFunction) return;
|
|
511
510
|
tools.MutRef.update(indirectFunctionCalls, tools.Chunk.append(node));
|
|
512
511
|
}).otherwise(tools.F.constVoid);
|
|
513
512
|
},
|
|
@@ -638,10 +637,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
|
638
637
|
}).otherwise(tools.F.constVoid);
|
|
639
638
|
},
|
|
640
639
|
":function:exit"(node) {
|
|
641
|
-
|
|
642
|
-
if (effectFn === node) {
|
|
643
|
-
tools.MutRef.set(effectFunctionRef, null);
|
|
644
|
-
}
|
|
640
|
+
tools.MutRef.update(effectFunctionRef, (current) => current === node ? null : current);
|
|
645
641
|
tools.MutList.pop(functionStack);
|
|
646
642
|
},
|
|
647
643
|
CallExpression(node) {
|
|
@@ -663,6 +659,8 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
|
663
659
|
}).with("useLayoutEffect", () => {
|
|
664
660
|
tools.MutRef.set(useLayoutEffectCallRef, node);
|
|
665
661
|
}).with("other", () => {
|
|
662
|
+
const isInEffectFunction = effectFn === parentFn;
|
|
663
|
+
if (!isInEffectFunction) return;
|
|
666
664
|
tools.MutRef.update(indirectFunctionCalls, tools.Chunk.append(node));
|
|
667
665
|
}).otherwise(tools.F.constVoid);
|
|
668
666
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { getStaticValue } from '@typescript-eslint/utils/ast-utils';
|
|
|
7
7
|
|
|
8
8
|
// package.json
|
|
9
9
|
var name = "eslint-plugin-react-hooks-extra";
|
|
10
|
-
var version = "1.5.28-beta.
|
|
10
|
+
var version = "1.5.28-beta.7";
|
|
11
11
|
var createRule = createRuleForPlugin("hooks-extra");
|
|
12
12
|
|
|
13
13
|
// src/rules/ensure-custom-hooks-using-other-hooks.ts
|
|
@@ -481,10 +481,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
481
481
|
}).otherwise(F.constVoid);
|
|
482
482
|
},
|
|
483
483
|
":function:exit"(node) {
|
|
484
|
-
|
|
485
|
-
if (effectFn === node) {
|
|
486
|
-
MutRef.set(effectFunctionRef, null);
|
|
487
|
-
}
|
|
484
|
+
MutRef.update(effectFunctionRef, (current) => current === node ? null : current);
|
|
488
485
|
MutList.pop(functionStack);
|
|
489
486
|
},
|
|
490
487
|
CallExpression(node) {
|
|
@@ -506,6 +503,8 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
506
503
|
}).with("useEffect", () => {
|
|
507
504
|
MutRef.set(useEffectCallRef, node);
|
|
508
505
|
}).with("other", () => {
|
|
506
|
+
const isInEffectFunction = effectFn === parentFn;
|
|
507
|
+
if (!isInEffectFunction) return;
|
|
509
508
|
MutRef.update(indirectFunctionCalls, Chunk.append(node));
|
|
510
509
|
}).otherwise(F.constVoid);
|
|
511
510
|
},
|
|
@@ -636,10 +635,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
|
636
635
|
}).otherwise(F.constVoid);
|
|
637
636
|
},
|
|
638
637
|
":function:exit"(node) {
|
|
639
|
-
|
|
640
|
-
if (effectFn === node) {
|
|
641
|
-
MutRef.set(effectFunctionRef, null);
|
|
642
|
-
}
|
|
638
|
+
MutRef.update(effectFunctionRef, (current) => current === node ? null : current);
|
|
643
639
|
MutList.pop(functionStack);
|
|
644
640
|
},
|
|
645
641
|
CallExpression(node) {
|
|
@@ -661,6 +657,8 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
|
661
657
|
}).with("useLayoutEffect", () => {
|
|
662
658
|
MutRef.set(useLayoutEffectCallRef, node);
|
|
663
659
|
}).with("other", () => {
|
|
660
|
+
const isInEffectFunction = effectFn === parentFn;
|
|
661
|
+
if (!isInEffectFunction) return;
|
|
664
662
|
MutRef.update(indirectFunctionCalls, Chunk.append(node));
|
|
665
663
|
}).otherwise(F.constVoid);
|
|
666
664
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks-extra",
|
|
3
|
-
"version": "1.5.28-beta.
|
|
3
|
+
"version": "1.5.28-beta.7",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
|
|
5
5
|
"homepage": "https://github.com/rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"@typescript-eslint/type-utils": "^7.16.1",
|
|
40
40
|
"@typescript-eslint/types": "^7.16.1",
|
|
41
41
|
"@typescript-eslint/utils": "^7.16.1",
|
|
42
|
-
"@eslint-react/
|
|
43
|
-
"@eslint-react/
|
|
44
|
-
"@eslint-react/
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
42
|
+
"@eslint-react/ast": "1.5.28-beta.7",
|
|
43
|
+
"@eslint-react/core": "1.5.28-beta.7",
|
|
44
|
+
"@eslint-react/jsx": "1.5.28-beta.7",
|
|
45
|
+
"@eslint-react/shared": "1.5.28-beta.7",
|
|
46
|
+
"@eslint-react/tools": "1.5.28-beta.7",
|
|
47
|
+
"@eslint-react/types": "1.5.28-beta.7",
|
|
48
|
+
"@eslint-react/var": "1.5.28-beta.7"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"string-ts": "2.2.0",
|