eslint-plugin-react-hooks-extra 2.6.5-next.0 → 2.7.0-next.0

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -3
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { WEBSITE_URL, getConfigAdapters } from "@eslint-react/shared";
1
+ import { WEBSITE_URL, getConfigAdapters, getSettingsFromContext } from "@eslint-react/shared";
2
2
  import * as AST from "@eslint-react/ast";
3
- import { isReactHookName, isUseCallbackCall, isUseEffectLikeCall, isUseMemoCall, isUseStateCall } from "@eslint-react/core";
3
+ import { isReactHookName, isUseCallbackCall, isUseEffectLikeCall, isUseMemoCall, isUseStateLikeCall } from "@eslint-react/core";
4
4
  import { constVoid, getOrElseUpdate, not } from "@eslint-react/eff";
5
5
  import { findVariable, getVariableDefinitionNode } from "@eslint-react/var";
6
6
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
@@ -36,7 +36,7 @@ const rules = { "react-hooks-extra/no-direct-set-state-in-use-effect": "warn" };
36
36
  //#endregion
37
37
  //#region package.json
38
38
  var name = "eslint-plugin-react-hooks-extra";
39
- var version = "2.6.5-next.0";
39
+ var version = "2.7.0-next.0";
40
40
 
41
41
  //#endregion
42
42
  //#region src/utils/create-rule.ts
@@ -77,6 +77,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
77
77
  });
78
78
  function create(context) {
79
79
  if (!/use\w*Effect/u.test(context.sourceCode.text)) return {};
80
+ const { additionalStateHooks } = getSettingsFromContext(context);
80
81
  const functionEntries = [];
81
82
  const setupFnRef = { current: null };
82
83
  const setupFnIds = [];
@@ -95,6 +96,9 @@ function create(context) {
95
96
  function isThenCall(node) {
96
97
  return node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "then";
97
98
  }
99
+ function isUseStateCall(node) {
100
+ return isUseStateLikeCall(node, additionalStateHooks);
101
+ }
98
102
  function isFunctionOfUseEffectSetup(node) {
99
103
  return node.parent?.type === AST_NODE_TYPES.CallExpression && node.parent.callee !== node && isUseEffectLikeCall(node.parent);
100
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-hooks-extra",
3
- "version": "2.6.5-next.0",
3
+ "version": "2.7.0-next.0",
4
4
  "description": "ESLint React's ESLint plugin for React Hooks related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -45,11 +45,11 @@
45
45
  "@typescript-eslint/utils": "^8.53.0",
46
46
  "string-ts": "^2.3.1",
47
47
  "ts-pattern": "^5.9.0",
48
- "@eslint-react/ast": "2.6.5-next.0",
49
- "@eslint-react/core": "2.6.5-next.0",
50
- "@eslint-react/eff": "2.6.5-next.0",
51
- "@eslint-react/var": "2.6.5-next.0",
52
- "@eslint-react/shared": "2.6.5-next.0"
48
+ "@eslint-react/ast": "2.7.0-next.0",
49
+ "@eslint-react/shared": "2.7.0-next.0",
50
+ "@eslint-react/eff": "2.7.0-next.0",
51
+ "@eslint-react/core": "2.7.0-next.0",
52
+ "@eslint-react/var": "2.7.0-next.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/react": "^19.2.8",