@@ -923,7 +923,7 @@ const rule$2 = {
923923 }
924924 let callback = node.arguments[callbackIndex];
925925 const reactiveHook = node.callee;
926- const nodeWithoutNamespace = getNodeWithoutReactNamespace(reactiveHook);
926+ const nodeWithoutNamespace = getNodeWithoutReactNamespace$1 (reactiveHook);
927927 const reactiveHookName = 'name' in nodeWithoutNamespace ? nodeWithoutNamespace.name : '';
928928 const maybeNode = node.arguments[callbackIndex + 1];
929929 const declaredDependenciesNode = maybeNode &&
@@ -1330,7 +1330,7 @@ function analyzePropertyChain(node, optionalChains) {
13301330 throw new Error(`Unsupported node type: ${node.type}`);
13311331 }
13321332}
1333- function getNodeWithoutReactNamespace(node) {
1333+ function getNodeWithoutReactNamespace$1 (node) {
13341334 if (node.type === 'MemberExpression' &&
13351335 node.object.type === 'Identifier' &&
13361336 node.object.name === 'React' &&
@@ -1341,7 +1341,7 @@ function getNodeWithoutReactNamespace(node) {
13411341 return node;
13421342}
13431343function getReactiveHookCallbackIndex(calleeNode, options) {
1344- const node = getNodeWithoutReactNamespace(calleeNode);
1344+ const node = getNodeWithoutReactNamespace$1 (calleeNode);
13451345 if (node.type !== 'Identifier') {
13461346 return -1;
13471347 }
@@ -54868,6 +54868,19 @@ function isInsideTryCatch(node) {
5486854868 }
5486954869 return false;
5487054870}
54871+ function getNodeWithoutReactNamespace(node) {
54872+ if (node.type === 'MemberExpression' &&
54873+ node.object.type === 'Identifier' &&
54874+ node.object.name === 'React' &&
54875+ node.property.type === 'Identifier' &&
54876+ !node.computed) {
54877+ return node.property;
54878+ }
54879+ return node;
54880+ }
54881+ function isUseEffectIdentifier(node) {
54882+ return node.type === 'Identifier' && node.name === 'useEffect';
54883+ }
5487154884function isUseEffectEventIdentifier(node) {
5487254885 {
5487354886 return node.type === 'Identifier' && node.name === 'useEffectEvent';
@@ -55165,9 +55178,9 @@ const rule = {
5516555178 }
5516655179 reactHooks.push(node.callee);
5516755180 }
55168- if (node.callee.type === 'Identifier' &&
55169- (node.callee.name === 'useEffect' ||
55170- isUseEffectEventIdentifier(node.callee )) &&
55181+ const nodeWithoutNamespace = getNodeWithoutReactNamespace (node.callee);
55182+ if ((isUseEffectIdentifier(nodeWithoutNamespace) ||
55183+ isUseEffectEventIdentifier(nodeWithoutNamespace )) &&
5517155184 node.arguments.length > 0) {
5517255185 lastEffect = node;
5517355186 }
0 commit comments