eslint-plugin-react-hooks-extra 1.30.2-next.0 → 1.30.2

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
@@ -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.30.2-next.0";
53
+ var version = "1.30.2";
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] ?? [];
@@ -211,7 +211,8 @@ function useNoDirectSetStateInUseEffect(context, options) {
211
211
  }
212
212
  tsPattern.match(getCallKind(node)).with("setState", () => {
213
213
  switch (true) {
214
- case (pEntry.node === setupFunction || pEntry.kind === "immediate"): {
214
+ case pEntry.node === setupFunction:
215
+ case (pEntry.kind === "immediate" && AST__namespace.findParentNode(pEntry.node, AST__namespace.isFunction) === setupFunction): {
215
216
  onViolation(context, node, {
216
217
  name: context.sourceCode.getText(node.callee)
217
218
  });
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.30.2-next.0";
30
+ var version = "1.30.2";
31
31
  var createRule = createRuleForPlugin("hooks-extra");
32
32
  function isFromHookCall(context, name3, settings, predicate = constTrue) {
33
33
  const hookAlias = settings.additionalHooks[name3] ?? [];
@@ -188,7 +188,8 @@ function useNoDirectSetStateInUseEffect(context, options) {
188
188
  }
189
189
  match(getCallKind(node)).with("setState", () => {
190
190
  switch (true) {
191
- case (pEntry.node === setupFunction || pEntry.kind === "immediate"): {
191
+ case pEntry.node === setupFunction:
192
+ case (pEntry.kind === "immediate" && AST.findParentNode(pEntry.node, AST.isFunction) === setupFunction): {
192
193
  onViolation(context, node, {
193
194
  name: context.sourceCode.getText(node.callee)
194
195
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-hooks-extra",
3
- "version": "1.30.2-next.0",
3
+ "version": "1.30.2",
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.0",
51
51
  "string-ts": "^2.2.1",
52
52
  "ts-pattern": "^5.6.2",
53
- "@eslint-react/ast": "1.30.2-next.0",
54
- "@eslint-react/eff": "1.30.2-next.0",
55
- "@eslint-react/shared": "1.30.2-next.0",
56
- "@eslint-react/core": "1.30.2-next.0",
57
- "@eslint-react/var": "1.30.2-next.0",
58
- "@eslint-react/jsx": "1.30.2-next.0"
53
+ "@eslint-react/ast": "1.30.2",
54
+ "@eslint-react/core": "1.30.2",
55
+ "@eslint-react/jsx": "1.30.2",
56
+ "@eslint-react/eff": "1.30.2",
57
+ "@eslint-react/shared": "1.30.2",
58
+ "@eslint-react/var": "1.30.2"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/react": "^19.0.10",