Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rules-of-hooks not detecting hooks in hooks #1387

Merged
merged 2 commits into from
Jan 24, 2025

Conversation

marvinhagemeister
Copy link
Contributor

This fixes an error in the rules-of-hooks linting rule that didn't detect when a hook is inside another hook as part of a variable declaration.

// Valid, but would print a lint error
function useFoo() {
  const foo = useState(0);
}

Upon looking at the code further it turns out that the variable declaration handling is less involved.

src/rules/rules_of_hooks.rs Outdated Show resolved Hide resolved
@marvinhagemeister marvinhagemeister merged commit 4978ab5 into main Jan 24, 2025
7 checks passed
@marvinhagemeister marvinhagemeister deleted the fix-hooks-in-hooks branch January 24, 2025 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants