eslint-plugin-react-hooks-extra 1.8.0-beta.2 → 1.8.0-beta.3
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 +60 -25
- package/dist/index.mjs +62 -27
- package/package.json +9 -9
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.0-beta.
|
|
33
|
+
var version = "1.8.0-beta.3";
|
|
34
34
|
var createRule = shared.createRuleForPlugin("hooks-extra");
|
|
35
35
|
function isFromUseStateCall(context, useStateAlias) {
|
|
36
36
|
return (topLevelId) => {
|
|
@@ -271,6 +271,19 @@ function isSetStateCall(context, useStateAlias) {
|
|
|
271
271
|
function isThenCall(node) {
|
|
272
272
|
return node.callee.type === ast.NodeType.MemberExpression && node.callee.property.type === ast.NodeType.Identifier && node.callee.property.name === "then";
|
|
273
273
|
}
|
|
274
|
+
function isVariableDeclaratorFromHookCall(node) {
|
|
275
|
+
if (node.type !== ast.NodeType.VariableDeclarator) return false;
|
|
276
|
+
if (node.id.type !== ast.NodeType.Identifier) return false;
|
|
277
|
+
if (node.init?.type !== ast.NodeType.CallExpression) return false;
|
|
278
|
+
switch (node.init.callee.type) {
|
|
279
|
+
case ast.NodeType.Identifier:
|
|
280
|
+
return core.isReactHookName(node.init.callee.name);
|
|
281
|
+
case ast.NodeType.MemberExpression:
|
|
282
|
+
return node.init.callee.property?.type === ast.NodeType.Identifier && core.isReactHookName(node.init.callee.property.name);
|
|
283
|
+
default:
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
274
287
|
|
|
275
288
|
// src/rules/ensure-custom-hooks-using-other-hooks.ts
|
|
276
289
|
var RULE_NAME = "ensure-custom-hooks-using-other-hooks";
|
|
@@ -467,8 +480,9 @@ var RULE_NAME4 = "no-direct-set-state-in-use-effect";
|
|
|
467
480
|
function isEffectFunction(context, useSomeEffectAlias) {
|
|
468
481
|
return (node) => node.parent?.type === ast.NodeType.CallExpression && node.parent.callee !== node && core.isReactHookCallWithNameAlias("useEffect", context, useSomeEffectAlias)(node.parent);
|
|
469
482
|
}
|
|
470
|
-
function getCallKind(node, context,
|
|
471
|
-
|
|
483
|
+
function getCallKind(node, context, alias) {
|
|
484
|
+
const [useStateAlias, useEffectAlias] = alias;
|
|
485
|
+
return $(node).when(core.isReactHookCallWithNameAlias("useState", context, useStateAlias), () => "useState").when(core.isReactHookCallWithNameAlias("useEffect", context, useEffectAlias), () => "useEffect").when(isSetStateCall(context, useStateAlias), () => "setState").when(isThenCall, () => "then").otherwise(() => "other");
|
|
472
486
|
}
|
|
473
487
|
function getFunctionKind(node, context, useEffectAlias) {
|
|
474
488
|
return $(node).when(isEffectFunction(context, useEffectAlias), () => "effect").when(ast.isIIFE, () => "immediate").otherwise(() => "other");
|
|
@@ -493,6 +507,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
493
507
|
const effectFunctionIdentifiers = [];
|
|
494
508
|
const indirectFunctionCalls = [];
|
|
495
509
|
const indirectSetStateCalls = /* @__PURE__ */ new WeakMap();
|
|
510
|
+
const indirectSetStateCallsInHooks = /* @__PURE__ */ new WeakMap();
|
|
496
511
|
const onEffectFunctionEnter = (node) => {
|
|
497
512
|
tools.MutRef.set(effectFunctionRef, node);
|
|
498
513
|
};
|
|
@@ -515,10 +530,16 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
515
530
|
const effectFn = tools.MutRef.get(effectFunctionRef);
|
|
516
531
|
const [parentFn, parentFnKind] = R__namespace.last(functionStack) ?? [];
|
|
517
532
|
if (parentFn?.async) return;
|
|
518
|
-
|
|
519
|
-
$(callKind).with("setState", () => {
|
|
533
|
+
$(getCallKind(node, context, [useStateAlias, useEffectAlias])).with("setState", () => {
|
|
520
534
|
if (!parentFn) return;
|
|
521
535
|
if (parentFn !== effectFn && parentFnKind !== "immediate") {
|
|
536
|
+
const variableDeclaratorFromHookCall = ast.traverseUpGuard(node, isVariableDeclaratorFromHookCall);
|
|
537
|
+
if (tools.O.isSome(variableDeclaratorFromHookCall)) {
|
|
538
|
+
const vd = variableDeclaratorFromHookCall.value;
|
|
539
|
+
const calls2 = indirectSetStateCallsInHooks.get(vd.init) ?? [];
|
|
540
|
+
indirectSetStateCallsInHooks.set(vd.init, [...calls2, node]);
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
522
543
|
const calls = indirectSetStateCalls.get(parentFn) ?? [];
|
|
523
544
|
indirectSetStateCalls.set(parentFn, [...calls, node]);
|
|
524
545
|
return;
|
|
@@ -539,13 +560,16 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
539
560
|
},
|
|
540
561
|
"Program:exit"() {
|
|
541
562
|
const getSetStateCalls = (id, initialScope) => {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
563
|
+
const node = tools.O.flatMap(_var.findVariable(id, initialScope), _var.getVariableNode(0)).pipe(tools.O.getOrNull);
|
|
564
|
+
switch (node?.type) {
|
|
565
|
+
case ast.NodeType.FunctionDeclaration:
|
|
566
|
+
case ast.NodeType.FunctionExpression:
|
|
567
|
+
case ast.NodeType.ArrowFunctionExpression:
|
|
568
|
+
return indirectSetStateCalls.get(node) ?? [];
|
|
569
|
+
case ast.NodeType.CallExpression:
|
|
570
|
+
return indirectSetStateCallsInHooks.get(node) ?? [];
|
|
571
|
+
}
|
|
572
|
+
return [];
|
|
549
573
|
};
|
|
550
574
|
for (const { callee } of indirectFunctionCalls) {
|
|
551
575
|
if (!("name" in callee)) continue;
|
|
@@ -575,14 +599,15 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
575
599
|
defaultOptions: []
|
|
576
600
|
});
|
|
577
601
|
var RULE_NAME5 = "no-direct-set-state-in-use-layout-effect";
|
|
578
|
-
function
|
|
602
|
+
function isEffectFunction2(context, useSomeEffectAlias) {
|
|
579
603
|
return (node) => node.parent?.type === ast.NodeType.CallExpression && node.parent.callee !== node && core.isReactHookCallWithNameAlias("useLayoutEffect", context, useSomeEffectAlias)(node.parent);
|
|
580
604
|
}
|
|
581
|
-
function getCallKind2(node, context,
|
|
582
|
-
|
|
605
|
+
function getCallKind2(node, context, alias) {
|
|
606
|
+
const [useStateAlias, useLayoutEffectAlias] = alias;
|
|
607
|
+
return $(node).when(core.isReactHookCallWithNameAlias("useState", context, useStateAlias), () => "useState").when(core.isReactHookCallWithNameAlias("useLayoutEffect", context, useLayoutEffectAlias), () => "useLayoutEffect").when(isSetStateCall(context, useStateAlias), () => "setState").when(isThenCall, () => "then").otherwise(() => "other");
|
|
583
608
|
}
|
|
584
609
|
function getFunctionKind2(node, context, useLayoutEffectAlias) {
|
|
585
|
-
return $(node).when(
|
|
610
|
+
return $(node).when(isEffectFunction2(context, useLayoutEffectAlias), () => "effect").when(ast.isIIFE, () => "immediate").otherwise(() => "other");
|
|
586
611
|
}
|
|
587
612
|
var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
588
613
|
meta: {
|
|
@@ -604,6 +629,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
|
604
629
|
const effectFunctionIdentifiers = [];
|
|
605
630
|
const indirectFunctionCalls = [];
|
|
606
631
|
const indirectSetStateCalls = /* @__PURE__ */ new WeakMap();
|
|
632
|
+
const indirectSetStateCallsInHooks = /* @__PURE__ */ new WeakMap();
|
|
607
633
|
const onEffectFunctionEnter = (node) => {
|
|
608
634
|
tools.MutRef.set(effectFunctionRef, node);
|
|
609
635
|
};
|
|
@@ -626,10 +652,16 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
|
626
652
|
const effectFn = tools.MutRef.get(effectFunctionRef);
|
|
627
653
|
const [parentFn, parentFnKind] = R__namespace.last(functionStack) ?? [];
|
|
628
654
|
if (parentFn?.async) return;
|
|
629
|
-
|
|
630
|
-
$(callKind).with("setState", () => {
|
|
655
|
+
$(getCallKind2(node, context, [useStateAlias, useLayoutEffectAlias])).with("setState", () => {
|
|
631
656
|
if (!parentFn) return;
|
|
632
657
|
if (parentFn !== effectFn && parentFnKind !== "immediate") {
|
|
658
|
+
const variableDeclaratorFromHookCall = ast.traverseUpGuard(node, isVariableDeclaratorFromHookCall);
|
|
659
|
+
if (tools.O.isSome(variableDeclaratorFromHookCall)) {
|
|
660
|
+
const vd = variableDeclaratorFromHookCall.value;
|
|
661
|
+
const calls2 = indirectSetStateCallsInHooks.get(vd.init) ?? [];
|
|
662
|
+
indirectSetStateCallsInHooks.set(vd.init, [...calls2, node]);
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
633
665
|
const calls = indirectSetStateCalls.get(parentFn) ?? [];
|
|
634
666
|
indirectSetStateCalls.set(parentFn, [...calls, node]);
|
|
635
667
|
return;
|
|
@@ -650,13 +682,16 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
|
650
682
|
},
|
|
651
683
|
"Program:exit"() {
|
|
652
684
|
const getSetStateCalls = (id, initialScope) => {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
685
|
+
const node = tools.O.flatMap(_var.findVariable(id, initialScope), _var.getVariableNode(0)).pipe(tools.O.getOrNull);
|
|
686
|
+
switch (node?.type) {
|
|
687
|
+
case ast.NodeType.FunctionDeclaration:
|
|
688
|
+
case ast.NodeType.FunctionExpression:
|
|
689
|
+
case ast.NodeType.ArrowFunctionExpression:
|
|
690
|
+
return indirectSetStateCalls.get(node) ?? [];
|
|
691
|
+
case ast.NodeType.CallExpression:
|
|
692
|
+
return indirectSetStateCallsInHooks.get(node) ?? [];
|
|
693
|
+
}
|
|
694
|
+
return [];
|
|
660
695
|
};
|
|
661
696
|
for (const { callee } of indirectFunctionCalls) {
|
|
662
697
|
if (!("name" in callee)) continue;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useHookCollector, isReactHookCall, isUseCallbackCall, isReactHookCallWithNameLoose, isUseMemoCall, isUseStateCall, isReactHookCallWithNameAlias } from '@eslint-react/core';
|
|
1
|
+
import { useHookCollector, isReactHookCall, isUseCallbackCall, isReactHookCallWithNameLoose, isUseMemoCall, isUseStateCall, isReactHookName, isReactHookCallWithNameAlias } from '@eslint-react/core';
|
|
2
2
|
import { createRuleForPlugin, decodeSettings } from '@eslint-react/shared';
|
|
3
|
-
import { isFunction, NodeType, is, getNestedIdentifiers, getNestedCallExpressions, isIIFE } from '@eslint-react/ast';
|
|
3
|
+
import { isFunction, NodeType, is, traverseUpGuard, getNestedIdentifiers, getNestedCallExpressions, isIIFE } from '@eslint-react/ast';
|
|
4
4
|
import { F, O, MutRef } from '@eslint-react/tools';
|
|
5
5
|
import { findVariable, getVariableNode } from '@eslint-react/var';
|
|
6
6
|
import { getStaticValue } from '@typescript-eslint/utils/ast-utils';
|
|
@@ -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.0-beta.
|
|
11
|
+
var version = "1.8.0-beta.3";
|
|
12
12
|
var createRule = createRuleForPlugin("hooks-extra");
|
|
13
13
|
function isFromUseStateCall(context, useStateAlias) {
|
|
14
14
|
return (topLevelId) => {
|
|
@@ -249,6 +249,19 @@ function isSetStateCall(context, useStateAlias) {
|
|
|
249
249
|
function isThenCall(node) {
|
|
250
250
|
return node.callee.type === NodeType.MemberExpression && node.callee.property.type === NodeType.Identifier && node.callee.property.name === "then";
|
|
251
251
|
}
|
|
252
|
+
function isVariableDeclaratorFromHookCall(node) {
|
|
253
|
+
if (node.type !== NodeType.VariableDeclarator) return false;
|
|
254
|
+
if (node.id.type !== NodeType.Identifier) return false;
|
|
255
|
+
if (node.init?.type !== NodeType.CallExpression) return false;
|
|
256
|
+
switch (node.init.callee.type) {
|
|
257
|
+
case NodeType.Identifier:
|
|
258
|
+
return isReactHookName(node.init.callee.name);
|
|
259
|
+
case NodeType.MemberExpression:
|
|
260
|
+
return node.init.callee.property?.type === NodeType.Identifier && isReactHookName(node.init.callee.property.name);
|
|
261
|
+
default:
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
252
265
|
|
|
253
266
|
// src/rules/ensure-custom-hooks-using-other-hooks.ts
|
|
254
267
|
var RULE_NAME = "ensure-custom-hooks-using-other-hooks";
|
|
@@ -445,8 +458,9 @@ var RULE_NAME4 = "no-direct-set-state-in-use-effect";
|
|
|
445
458
|
function isEffectFunction(context, useSomeEffectAlias) {
|
|
446
459
|
return (node) => node.parent?.type === NodeType.CallExpression && node.parent.callee !== node && isReactHookCallWithNameAlias("useEffect", context, useSomeEffectAlias)(node.parent);
|
|
447
460
|
}
|
|
448
|
-
function getCallKind(node, context,
|
|
449
|
-
|
|
461
|
+
function getCallKind(node, context, alias) {
|
|
462
|
+
const [useStateAlias, useEffectAlias] = alias;
|
|
463
|
+
return $(node).when(isReactHookCallWithNameAlias("useState", context, useStateAlias), () => "useState").when(isReactHookCallWithNameAlias("useEffect", context, useEffectAlias), () => "useEffect").when(isSetStateCall(context, useStateAlias), () => "setState").when(isThenCall, () => "then").otherwise(() => "other");
|
|
450
464
|
}
|
|
451
465
|
function getFunctionKind(node, context, useEffectAlias) {
|
|
452
466
|
return $(node).when(isEffectFunction(context, useEffectAlias), () => "effect").when(isIIFE, () => "immediate").otherwise(() => "other");
|
|
@@ -471,6 +485,7 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
471
485
|
const effectFunctionIdentifiers = [];
|
|
472
486
|
const indirectFunctionCalls = [];
|
|
473
487
|
const indirectSetStateCalls = /* @__PURE__ */ new WeakMap();
|
|
488
|
+
const indirectSetStateCallsInHooks = /* @__PURE__ */ new WeakMap();
|
|
474
489
|
const onEffectFunctionEnter = (node) => {
|
|
475
490
|
MutRef.set(effectFunctionRef, node);
|
|
476
491
|
};
|
|
@@ -493,10 +508,16 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
493
508
|
const effectFn = MutRef.get(effectFunctionRef);
|
|
494
509
|
const [parentFn, parentFnKind] = R.last(functionStack) ?? [];
|
|
495
510
|
if (parentFn?.async) return;
|
|
496
|
-
|
|
497
|
-
$(callKind).with("setState", () => {
|
|
511
|
+
$(getCallKind(node, context, [useStateAlias, useEffectAlias])).with("setState", () => {
|
|
498
512
|
if (!parentFn) return;
|
|
499
513
|
if (parentFn !== effectFn && parentFnKind !== "immediate") {
|
|
514
|
+
const variableDeclaratorFromHookCall = traverseUpGuard(node, isVariableDeclaratorFromHookCall);
|
|
515
|
+
if (O.isSome(variableDeclaratorFromHookCall)) {
|
|
516
|
+
const vd = variableDeclaratorFromHookCall.value;
|
|
517
|
+
const calls2 = indirectSetStateCallsInHooks.get(vd.init) ?? [];
|
|
518
|
+
indirectSetStateCallsInHooks.set(vd.init, [...calls2, node]);
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
500
521
|
const calls = indirectSetStateCalls.get(parentFn) ?? [];
|
|
501
522
|
indirectSetStateCalls.set(parentFn, [...calls, node]);
|
|
502
523
|
return;
|
|
@@ -517,13 +538,16 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
517
538
|
},
|
|
518
539
|
"Program:exit"() {
|
|
519
540
|
const getSetStateCalls = (id, initialScope) => {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
541
|
+
const node = O.flatMap(findVariable(id, initialScope), getVariableNode(0)).pipe(O.getOrNull);
|
|
542
|
+
switch (node?.type) {
|
|
543
|
+
case NodeType.FunctionDeclaration:
|
|
544
|
+
case NodeType.FunctionExpression:
|
|
545
|
+
case NodeType.ArrowFunctionExpression:
|
|
546
|
+
return indirectSetStateCalls.get(node) ?? [];
|
|
547
|
+
case NodeType.CallExpression:
|
|
548
|
+
return indirectSetStateCallsInHooks.get(node) ?? [];
|
|
549
|
+
}
|
|
550
|
+
return [];
|
|
527
551
|
};
|
|
528
552
|
for (const { callee } of indirectFunctionCalls) {
|
|
529
553
|
if (!("name" in callee)) continue;
|
|
@@ -553,14 +577,15 @@ var no_direct_set_state_in_use_effect_default = createRule({
|
|
|
553
577
|
defaultOptions: []
|
|
554
578
|
});
|
|
555
579
|
var RULE_NAME5 = "no-direct-set-state-in-use-layout-effect";
|
|
556
|
-
function
|
|
580
|
+
function isEffectFunction2(context, useSomeEffectAlias) {
|
|
557
581
|
return (node) => node.parent?.type === NodeType.CallExpression && node.parent.callee !== node && isReactHookCallWithNameAlias("useLayoutEffect", context, useSomeEffectAlias)(node.parent);
|
|
558
582
|
}
|
|
559
|
-
function getCallKind2(node, context,
|
|
560
|
-
|
|
583
|
+
function getCallKind2(node, context, alias) {
|
|
584
|
+
const [useStateAlias, useLayoutEffectAlias] = alias;
|
|
585
|
+
return $(node).when(isReactHookCallWithNameAlias("useState", context, useStateAlias), () => "useState").when(isReactHookCallWithNameAlias("useLayoutEffect", context, useLayoutEffectAlias), () => "useLayoutEffect").when(isSetStateCall(context, useStateAlias), () => "setState").when(isThenCall, () => "then").otherwise(() => "other");
|
|
561
586
|
}
|
|
562
587
|
function getFunctionKind2(node, context, useLayoutEffectAlias) {
|
|
563
|
-
return $(node).when(
|
|
588
|
+
return $(node).when(isEffectFunction2(context, useLayoutEffectAlias), () => "effect").when(isIIFE, () => "immediate").otherwise(() => "other");
|
|
564
589
|
}
|
|
565
590
|
var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
566
591
|
meta: {
|
|
@@ -582,6 +607,7 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
|
582
607
|
const effectFunctionIdentifiers = [];
|
|
583
608
|
const indirectFunctionCalls = [];
|
|
584
609
|
const indirectSetStateCalls = /* @__PURE__ */ new WeakMap();
|
|
610
|
+
const indirectSetStateCallsInHooks = /* @__PURE__ */ new WeakMap();
|
|
585
611
|
const onEffectFunctionEnter = (node) => {
|
|
586
612
|
MutRef.set(effectFunctionRef, node);
|
|
587
613
|
};
|
|
@@ -604,10 +630,16 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
|
604
630
|
const effectFn = MutRef.get(effectFunctionRef);
|
|
605
631
|
const [parentFn, parentFnKind] = R.last(functionStack) ?? [];
|
|
606
632
|
if (parentFn?.async) return;
|
|
607
|
-
|
|
608
|
-
$(callKind).with("setState", () => {
|
|
633
|
+
$(getCallKind2(node, context, [useStateAlias, useLayoutEffectAlias])).with("setState", () => {
|
|
609
634
|
if (!parentFn) return;
|
|
610
635
|
if (parentFn !== effectFn && parentFnKind !== "immediate") {
|
|
636
|
+
const variableDeclaratorFromHookCall = traverseUpGuard(node, isVariableDeclaratorFromHookCall);
|
|
637
|
+
if (O.isSome(variableDeclaratorFromHookCall)) {
|
|
638
|
+
const vd = variableDeclaratorFromHookCall.value;
|
|
639
|
+
const calls2 = indirectSetStateCallsInHooks.get(vd.init) ?? [];
|
|
640
|
+
indirectSetStateCallsInHooks.set(vd.init, [...calls2, node]);
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
611
643
|
const calls = indirectSetStateCalls.get(parentFn) ?? [];
|
|
612
644
|
indirectSetStateCalls.set(parentFn, [...calls, node]);
|
|
613
645
|
return;
|
|
@@ -628,13 +660,16 @@ var no_direct_set_state_in_use_layout_effect_default = createRule({
|
|
|
628
660
|
},
|
|
629
661
|
"Program:exit"() {
|
|
630
662
|
const getSetStateCalls = (id, initialScope) => {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
663
|
+
const node = O.flatMap(findVariable(id, initialScope), getVariableNode(0)).pipe(O.getOrNull);
|
|
664
|
+
switch (node?.type) {
|
|
665
|
+
case NodeType.FunctionDeclaration:
|
|
666
|
+
case NodeType.FunctionExpression:
|
|
667
|
+
case NodeType.ArrowFunctionExpression:
|
|
668
|
+
return indirectSetStateCalls.get(node) ?? [];
|
|
669
|
+
case NodeType.CallExpression:
|
|
670
|
+
return indirectSetStateCallsInHooks.get(node) ?? [];
|
|
671
|
+
}
|
|
672
|
+
return [];
|
|
638
673
|
};
|
|
639
674
|
for (const { callee } of indirectFunctionCalls) {
|
|
640
675
|
if (!("name" in callee)) continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks-extra",
|
|
3
|
-
"version": "1.8.0-beta.
|
|
3
|
+
"version": "1.8.0-beta.3",
|
|
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.6.0",
|
|
49
|
-
"@eslint-react/ast": "1.8.0-beta.
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/shared": "1.8.0-beta.
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/var": "1.8.0-beta.
|
|
49
|
+
"@eslint-react/ast": "1.8.0-beta.3",
|
|
50
|
+
"@eslint-react/core": "1.8.0-beta.3",
|
|
51
|
+
"@eslint-react/jsx": "1.8.0-beta.3",
|
|
52
|
+
"@eslint-react/shared": "1.8.0-beta.3",
|
|
53
|
+
"@eslint-react/tools": "1.8.0-beta.3",
|
|
54
|
+
"@eslint-react/types": "1.8.0-beta.3",
|
|
55
|
+
"@eslint-react/var": "1.8.0-beta.3"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/react": "^18.3.3",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"access": "public"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
83
|
-
"build": "tsup",
|
|
83
|
+
"build": "tsup --dts-resolve",
|
|
84
84
|
"lint:publish": "publint",
|
|
85
85
|
"lint:type": "tsc --noEmit"
|
|
86
86
|
}
|