fix(linter): improve jest/no_export heuristic#14620
fix(linter): improve jest/no_export heuristic#14620camc314 merged 2 commits intooxc-project:mainfrom
jest/no_export heuristic#14620Conversation
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.
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.
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.