eslint-plugin-react-hooks-extra 1.5.28-beta.5 → 1.5.28-beta.6

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 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.5";
12
+ var version = "1.5.28-beta.6";
13
13
  var createRule = shared.createRuleForPlugin("hooks-extra");
14
14
 
15
15
  // src/rules/ensure-custom-hooks-using-other-hooks.ts
@@ -508,6 +508,8 @@ var no_direct_set_state_in_use_effect_default = createRule({
508
508
  }).with("useEffect", () => {
509
509
  tools.MutRef.set(useEffectCallRef, node);
510
510
  }).with("other", () => {
511
+ const isInEffectFunction = effectFn === parentFn;
512
+ if (!isInEffectFunction) return;
511
513
  tools.MutRef.update(indirectFunctionCalls, tools.Chunk.append(node));
512
514
  }).otherwise(tools.F.constVoid);
513
515
  },
@@ -663,6 +665,8 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
663
665
  }).with("useLayoutEffect", () => {
664
666
  tools.MutRef.set(useLayoutEffectCallRef, node);
665
667
  }).with("other", () => {
668
+ const isInEffectFunction = effectFn === parentFn;
669
+ if (!isInEffectFunction) return;
666
670
  tools.MutRef.update(indirectFunctionCalls, tools.Chunk.append(node));
667
671
  }).otherwise(tools.F.constVoid);
668
672
  },
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.5";
10
+ var version = "1.5.28-beta.6";
11
11
  var createRule = createRuleForPlugin("hooks-extra");
12
12
 
13
13
  // src/rules/ensure-custom-hooks-using-other-hooks.ts
@@ -506,6 +506,8 @@ var no_direct_set_state_in_use_effect_default = createRule({
506
506
  }).with("useEffect", () => {
507
507
  MutRef.set(useEffectCallRef, node);
508
508
  }).with("other", () => {
509
+ const isInEffectFunction = effectFn === parentFn;
510
+ if (!isInEffectFunction) return;
509
511
  MutRef.update(indirectFunctionCalls, Chunk.append(node));
510
512
  }).otherwise(F.constVoid);
511
513
  },
@@ -661,6 +663,8 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
661
663
  }).with("useLayoutEffect", () => {
662
664
  MutRef.set(useLayoutEffectCallRef, node);
663
665
  }).with("other", () => {
666
+ const isInEffectFunction = effectFn === parentFn;
667
+ if (!isInEffectFunction) return;
664
668
  MutRef.update(indirectFunctionCalls, Chunk.append(node));
665
669
  }).otherwise(F.constVoid);
666
670
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-hooks-extra",
3
- "version": "1.5.28-beta.5",
3
+ "version": "1.5.28-beta.6",
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/core": "1.5.28-beta.5",
43
- "@eslint-react/ast": "1.5.28-beta.5",
44
- "@eslint-react/shared": "1.5.28-beta.5",
45
- "@eslint-react/jsx": "1.5.28-beta.5",
46
- "@eslint-react/types": "1.5.28-beta.5",
47
- "@eslint-react/var": "1.5.28-beta.5",
48
- "@eslint-react/tools": "1.5.28-beta.5"
42
+ "@eslint-react/ast": "1.5.28-beta.6",
43
+ "@eslint-react/jsx": "1.5.28-beta.6",
44
+ "@eslint-react/shared": "1.5.28-beta.6",
45
+ "@eslint-react/tools": "1.5.28-beta.6",
46
+ "@eslint-react/types": "1.5.28-beta.6",
47
+ "@eslint-react/core": "1.5.28-beta.6",
48
+ "@eslint-react/var": "1.5.28-beta.6"
49
49
  },
50
50
  "devDependencies": {
51
51
  "string-ts": "2.2.0",