eslint-plugin-react-hooks-extra 1.8.3-beta.3 → 1.8.3-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
@@ -30,7 +30,7 @@ var R__namespace = /*#__PURE__*/_interopNamespace(R);
30
30
 
31
31
  // package.json
32
32
  var name = "eslint-plugin-react-hooks-extra";
33
- var version = "1.8.3-beta.3";
33
+ var version = "1.8.3-beta.6";
34
34
  var createRule = shared.createRuleForPlugin("hooks-extra");
35
35
  function isFromHookCall(name2, context, settings, predicate = tools.F.constTrue) {
36
36
  const hookAlias = settings.additionalHooks?.[name2] ?? [];
@@ -284,7 +284,7 @@ function isVariableDeclaratorFromHookCall(node) {
284
284
  case ast.NodeType.Identifier:
285
285
  return core.isReactHookName(node.init.callee.name);
286
286
  case ast.NodeType.MemberExpression:
287
- return node.init.callee.property?.type === ast.NodeType.Identifier && core.isReactHookName(node.init.callee.property.name);
287
+ return node.init.callee.property.type === ast.NodeType.Identifier && core.isReactHookName(node.init.callee.property.name);
288
288
  default:
289
289
  return false;
290
290
  }
@@ -339,7 +339,7 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
339
339
  },
340
340
  name: RULE_NAME2,
341
341
  create(context) {
342
- const alias = shared.decodeSettings(context.settings)?.additionalHooks?.useCallback ?? [];
342
+ const alias = shared.decodeSettings(context.settings).additionalHooks?.useCallback ?? [];
343
343
  return {
344
344
  CallExpression(node) {
345
345
  if (!core.isReactHookCall(node)) return;
@@ -417,7 +417,7 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
417
417
  },
418
418
  name: RULE_NAME3,
419
419
  create(context) {
420
- const alias = shared.decodeSettings(context.settings)?.additionalHooks?.useMemo ?? [];
420
+ const alias = shared.decodeSettings(context.settings).additionalHooks?.useMemo ?? [];
421
421
  return {
422
422
  CallExpression(node) {
423
423
  if (!core.isReactHookCall(node)) return;
@@ -571,7 +571,6 @@ var no_direct_set_state_in_use_effect_default = createRule({
571
571
  }).otherwise(tools.F.constVoid);
572
572
  },
573
573
  Identifier(node) {
574
- if (!node.parent) return;
575
574
  if (node.parent.type === ast.NodeType.CallExpression && node.parent.callee === node) return;
576
575
  if (!isIdFromUseStateCall(node)) return;
577
576
  switch (node.parent.type) {
@@ -593,7 +592,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
593
592
  }
594
593
  case ast.NodeType.ArrowFunctionExpression: {
595
594
  const parent = node.parent.parent;
596
- if (parent?.type !== ast.NodeType.CallExpression) break;
595
+ if (parent.type !== ast.NodeType.CallExpression) break;
597
596
  if (!isUseMemoCall2(parent)) break;
598
597
  const maybeVd = ast.traverseUpGuard(parent, isVariableDeclaratorFromHookCall);
599
598
  if (tools.O.isNone(maybeVd)) break;
@@ -746,7 +745,6 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
746
745
  }).otherwise(tools.F.constVoid);
747
746
  },
748
747
  Identifier(node) {
749
- if (!node.parent) return;
750
748
  if (node.parent.type === ast.NodeType.CallExpression && node.parent.callee === node) return;
751
749
  if (!isIdFromUseStateCall(node)) return;
752
750
  switch (node.parent.type) {
@@ -768,7 +766,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
768
766
  }
769
767
  case ast.NodeType.ArrowFunctionExpression: {
770
768
  const parent = node.parent.parent;
771
- if (parent?.type !== ast.NodeType.CallExpression) break;
769
+ if (parent.type !== ast.NodeType.CallExpression) break;
772
770
  if (!isUseMemoCall2(parent)) break;
773
771
  const maybeVd = ast.traverseUpGuard(parent, isVariableDeclaratorFromHookCall);
774
772
  if (tools.O.isNone(maybeVd)) break;
@@ -842,7 +840,7 @@ var prefer_use_state_lazy_initialization_default = createRule({
842
840
  },
843
841
  name: RULE_NAME6,
844
842
  create(context) {
845
- const alias = shared.decodeSettings(context.settings)?.additionalHooks?.useState ?? [];
843
+ const alias = shared.decodeSettings(context.settings).additionalHooks?.useState ?? [];
846
844
  return {
847
845
  CallExpression(node) {
848
846
  if (!core.isReactHookCall(node)) return;
package/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ import * as R from 'remeda';
8
8
 
9
9
  // package.json
10
10
  var name = "eslint-plugin-react-hooks-extra";
11
- var version = "1.8.3-beta.3";
11
+ var version = "1.8.3-beta.6";
12
12
  var createRule = createRuleForPlugin("hooks-extra");
13
13
  function isFromHookCall(name2, context, settings, predicate = F.constTrue) {
14
14
  const hookAlias = settings.additionalHooks?.[name2] ?? [];
@@ -262,7 +262,7 @@ function isVariableDeclaratorFromHookCall(node) {
262
262
  case NodeType.Identifier:
263
263
  return isReactHookName(node.init.callee.name);
264
264
  case NodeType.MemberExpression:
265
- return node.init.callee.property?.type === NodeType.Identifier && isReactHookName(node.init.callee.property.name);
265
+ return node.init.callee.property.type === NodeType.Identifier && isReactHookName(node.init.callee.property.name);
266
266
  default:
267
267
  return false;
268
268
  }
@@ -317,7 +317,7 @@ var ensure_use_callback_has_non_empty_deps_default = createRule({
317
317
  },
318
318
  name: RULE_NAME2,
319
319
  create(context) {
320
- const alias = decodeSettings(context.settings)?.additionalHooks?.useCallback ?? [];
320
+ const alias = decodeSettings(context.settings).additionalHooks?.useCallback ?? [];
321
321
  return {
322
322
  CallExpression(node) {
323
323
  if (!isReactHookCall(node)) return;
@@ -395,7 +395,7 @@ var ensure_use_memo_has_non_empty_deps_default = createRule({
395
395
  },
396
396
  name: RULE_NAME3,
397
397
  create(context) {
398
- const alias = decodeSettings(context.settings)?.additionalHooks?.useMemo ?? [];
398
+ const alias = decodeSettings(context.settings).additionalHooks?.useMemo ?? [];
399
399
  return {
400
400
  CallExpression(node) {
401
401
  if (!isReactHookCall(node)) return;
@@ -549,7 +549,6 @@ var no_direct_set_state_in_use_effect_default = createRule({
549
549
  }).otherwise(F.constVoid);
550
550
  },
551
551
  Identifier(node) {
552
- if (!node.parent) return;
553
552
  if (node.parent.type === NodeType.CallExpression && node.parent.callee === node) return;
554
553
  if (!isIdFromUseStateCall(node)) return;
555
554
  switch (node.parent.type) {
@@ -571,7 +570,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
571
570
  }
572
571
  case NodeType.ArrowFunctionExpression: {
573
572
  const parent = node.parent.parent;
574
- if (parent?.type !== NodeType.CallExpression) break;
573
+ if (parent.type !== NodeType.CallExpression) break;
575
574
  if (!isUseMemoCall2(parent)) break;
576
575
  const maybeVd = traverseUpGuard(parent, isVariableDeclaratorFromHookCall);
577
576
  if (O.isNone(maybeVd)) break;
@@ -724,7 +723,6 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
724
723
  }).otherwise(F.constVoid);
725
724
  },
726
725
  Identifier(node) {
727
- if (!node.parent) return;
728
726
  if (node.parent.type === NodeType.CallExpression && node.parent.callee === node) return;
729
727
  if (!isIdFromUseStateCall(node)) return;
730
728
  switch (node.parent.type) {
@@ -746,7 +744,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
746
744
  }
747
745
  case NodeType.ArrowFunctionExpression: {
748
746
  const parent = node.parent.parent;
749
- if (parent?.type !== NodeType.CallExpression) break;
747
+ if (parent.type !== NodeType.CallExpression) break;
750
748
  if (!isUseMemoCall2(parent)) break;
751
749
  const maybeVd = traverseUpGuard(parent, isVariableDeclaratorFromHookCall);
752
750
  if (O.isNone(maybeVd)) break;
@@ -820,7 +818,7 @@ var prefer_use_state_lazy_initialization_default = createRule({
820
818
  },
821
819
  name: RULE_NAME6,
822
820
  create(context) {
823
- const alias = decodeSettings(context.settings)?.additionalHooks?.useState ?? [];
821
+ const alias = decodeSettings(context.settings).additionalHooks?.useState ?? [];
824
822
  return {
825
823
  CallExpression(node) {
826
824
  if (!isReactHookCall(node)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-hooks-extra",
3
- "version": "1.8.3-beta.3",
3
+ "version": "1.8.3-beta.6",
4
4
  "description": "ESLint React's ESLint plugin for React Hooks related rules.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -46,13 +46,13 @@
46
46
  "@typescript-eslint/types": "^8.0.0",
47
47
  "@typescript-eslint/utils": "^8.0.0",
48
48
  "remeda": "^2.7.0",
49
- "@eslint-react/ast": "1.8.3-beta.3",
50
- "@eslint-react/core": "1.8.3-beta.3",
51
- "@eslint-react/shared": "1.8.3-beta.3",
52
- "@eslint-react/jsx": "1.8.3-beta.3",
53
- "@eslint-react/tools": "1.8.3-beta.3",
54
- "@eslint-react/types": "1.8.3-beta.3",
55
- "@eslint-react/var": "1.8.3-beta.3"
49
+ "@eslint-react/ast": "1.8.3-beta.6",
50
+ "@eslint-react/core": "1.8.3-beta.6",
51
+ "@eslint-react/shared": "1.8.3-beta.6",
52
+ "@eslint-react/jsx": "1.8.3-beta.6",
53
+ "@eslint-react/tools": "1.8.3-beta.6",
54
+ "@eslint-react/types": "1.8.3-beta.6",
55
+ "@eslint-react/var": "1.8.3-beta.6"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/react": "^18.3.3",