Skip to content

Commit

Permalink
fix: Don't consider Hooks as Components
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Oct 1, 2022
1 parent 7cd66c3 commit e002fc7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,17 @@ const tests = {
}))
`,
},
{
code: normalizeIndent`
function useCustomHook() {
const useNestedHook = () => {
React.useRef();
}
useNestedHook();
useNestedHook();
}
`,
},
],
invalid: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function isInsideComponentOrHook(node) {
function isComponent(node) {
const functionName = getFunctionName(node);
if (functionName) {
if (isComponentName(functionName) || isHook(functionName)) {
if (isComponentName(functionName)) {
return true;
}
}
Expand Down

0 comments on commit e002fc7

Please sign in to comment.