-
-
Notifications
You must be signed in to change notification settings - Fork 721
fix(linter): improve jest/no_export heuristic
#14620
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
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the jest/no_export linter rule by adding a heuristic to only flag exports when the file contains actual test function calls (it, test, etc.), rather than flagging all exports in any file with a test-like filename.
- Enhanced export detection logic to check for presence of test functions before flagging exports
- Added utility imports for Jest function parsing and AST traversal
- Updated test cases to reflect the improved heuristic behavior
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
CodSpeed Performance ReportMerging #14620 will not alter performanceComparing Summary
Footnotes
|
…ode` to avoid allocating+collecting array
camc314
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! i pushed one commit changing collect_possible_jest_call_node to avoid the iter -> vec -> iter chain
jest/no-exportdoesn't do what it says it does #14592typescript-make-units-from-test.tsbecausejest/no_exportchecks if the file name ends withtest.ts, not if it ends with.test.ts.eslint-plugin-jestbehavior.Before
After
The
oxlint-disable-nextdirective was removed for these screenshots.