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(lint/useHookAtTopLevel): don't flag jest function calls that look like hooks #3415

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

dyc3
Copy link
Contributor

@dyc3 dyc3 commented Jul 11, 2024

Summary

Jest has some functions that our heuristics flag as a react hook. This PR makes it so biome doesn't flag jest.useFakeTimers and jest.useRealTimers as react hooks.

fixes #3337

Test Plan

Honestly, I don't exactly have a clean reproduction for the linked issue.

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Jul 11, 2024
Copy link

codspeed-hq bot commented Jul 11, 2024

CodSpeed Performance Report

Merging #3415 will not alter performance

Comparing dyc3:fix-3346 (37d1157) with main (ba8aabc)

Summary

✅ 104 untouched benchmarks

@dyc3 dyc3 marked this pull request as ready for review July 12, 2024 21:30
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the tests, you could create a new file that contains the code of the reproduction. That code should not emit any diagnostics

crates/biome_js_analyze/src/react/hooks.rs Outdated Show resolved Hide resolved
@arendjr arendjr merged commit c42cef5 into biomejs:main Jul 17, 2024
12 checks passed
@dyc3 dyc3 deleted the fix-3346 branch July 17, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

💅 useHookAtTopLevel - false-positives for jest.useFakeTimers/jest.useRealTimers
3 participants