eslint-plugin-react-hooks-extra 1.6.0-next.5 → 1.6.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.
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.6.0-next.5";
12
+ var version = "1.6.0";
13
13
  var createRule = shared.createRuleForPlugin("hooks-extra");
14
14
 
15
15
  // src/rules/ensure-custom-hooks-using-other-hooks.ts
@@ -424,7 +424,8 @@ var no_direct_set_state_in_use_effect_default = createRule({
424
424
  );
425
425
  if (tools.O.isNone(useStateCall)) return false;
426
426
  const { parent } = useStateCall.value;
427
- return !a({ id: { elements: [{ name: topLevelId.name }] } }, parent);
427
+ if (!a({ id: { type: ast.NodeType.ArrayPattern }, type: ast.NodeType.VariableDeclarator }, parent)) return true;
428
+ return parent.id.elements.findIndex((e2) => e2?.type === ast.NodeType.Identifier && e2.name === topLevelId.name) === 1;
428
429
  }
429
430
  function isSetStateCall(node) {
430
431
  const topLevelId = $(node.callee).with({ type: ast.NodeType.Identifier }, tools.O.some).with({ type: ast.NodeType.MemberExpression }, (n2) => {
@@ -587,7 +588,8 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
587
588
  );
588
589
  if (tools.O.isNone(useStateCall)) return false;
589
590
  const { parent } = useStateCall.value;
590
- return !a({ id: { elements: [{ name: topLevelId.name }] } }, parent);
591
+ if (!a({ id: { type: ast.NodeType.ArrayPattern }, type: ast.NodeType.VariableDeclarator }, parent)) return true;
592
+ return parent.id.elements.findIndex((e2) => e2?.type === ast.NodeType.Identifier && e2.name === topLevelId.name) === 1;
591
593
  }
592
594
  function isSetStateCall(node) {
593
595
  const topLevelId = $(node.callee).with({ type: ast.NodeType.Identifier }, tools.O.some).with({ type: ast.NodeType.MemberExpression }, (n2) => {
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.6.0-next.5";
10
+ var version = "1.6.0";
11
11
  var createRule = createRuleForPlugin("hooks-extra");
12
12
 
13
13
  // src/rules/ensure-custom-hooks-using-other-hooks.ts
@@ -422,7 +422,8 @@ var no_direct_set_state_in_use_effect_default = createRule({
422
422
  );
423
423
  if (O.isNone(useStateCall)) return false;
424
424
  const { parent } = useStateCall.value;
425
- return !a({ id: { elements: [{ name: topLevelId.name }] } }, parent);
425
+ if (!a({ id: { type: NodeType.ArrayPattern }, type: NodeType.VariableDeclarator }, parent)) return true;
426
+ return parent.id.elements.findIndex((e2) => e2?.type === NodeType.Identifier && e2.name === topLevelId.name) === 1;
426
427
  }
427
428
  function isSetStateCall(node) {
428
429
  const topLevelId = $(node.callee).with({ type: NodeType.Identifier }, O.some).with({ type: NodeType.MemberExpression }, (n2) => {
@@ -585,7 +586,8 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
585
586
  );
586
587
  if (O.isNone(useStateCall)) return false;
587
588
  const { parent } = useStateCall.value;
588
- return !a({ id: { elements: [{ name: topLevelId.name }] } }, parent);
589
+ if (!a({ id: { type: NodeType.ArrayPattern }, type: NodeType.VariableDeclarator }, parent)) return true;
590
+ return parent.id.elements.findIndex((e2) => e2?.type === NodeType.Identifier && e2.name === topLevelId.name) === 1;
589
591
  }
590
592
  function isSetStateCall(node) {
591
593
  const topLevelId = $(node.callee).with({ type: NodeType.Identifier }, O.some).with({ type: NodeType.MemberExpression }, (n2) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-hooks-extra",
3
- "version": "1.6.0-next.5",
3
+ "version": "1.6.0",
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.17.0",
40
40
  "@typescript-eslint/types": "^7.17.0",
41
41
  "@typescript-eslint/utils": "^7.17.0",
42
- "@eslint-react/ast": "1.6.0-next.5",
43
- "@eslint-react/jsx": "1.6.0-next.5",
44
- "@eslint-react/core": "1.6.0-next.5",
45
- "@eslint-react/shared": "1.6.0-next.5",
46
- "@eslint-react/tools": "1.6.0-next.5",
47
- "@eslint-react/types": "1.6.0-next.5",
48
- "@eslint-react/var": "1.6.0-next.5"
42
+ "@eslint-react/core": "1.6.0",
43
+ "@eslint-react/jsx": "1.6.0",
44
+ "@eslint-react/ast": "1.6.0",
45
+ "@eslint-react/shared": "1.6.0",
46
+ "@eslint-react/types": "1.6.0",
47
+ "@eslint-react/var": "1.6.0",
48
+ "@eslint-react/tools": "1.6.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/react": "^18.3.3",