feat(linter/array-callback-return): use CFG for analysis#20498
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. This stack of pull requests is managed by Graphite. Learn more about stacking. |
75d5da2 to
4c18556
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the eslint(array-callback-return) rule to determine whether callbacks return on all paths using the repository’s Control Flow Graph (CFG) rather than the prior AST-local return analysis.
Changes:
- Switch
array-callback-return’s return-path detection to a CFG-based analysis (check_function_body(node.id(), ctx.semantic())). - Adjust return-span collection for
allowVoidhandling to better match intended diagnostics. - Update rule tests/snapshots and add a new failing case covering a
while(true)loop with abreakpath.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/oxc_linter/src/rules/eslint/array_callback_return/return_checker.rs | Replaces function-body return checking with CFG traversal logic; refactors return span handling; removes AST-analysis unit tests. |
| crates/oxc_linter/src/rules/eslint/array_callback_return/mod.rs | Wires the rule to the new CFG-based checker and adds a regression test case. |
| crates/oxc_linter/src/snapshots/eslint_array_callback_return.snap | Updates snapshot output to include the newly-detected missing-return scenario. |
You can also share your feedback on Copilot code review. Take the survey.
crates/oxc_linter/src/rules/eslint/array_callback_return/return_checker.rs
Show resolved
Hide resolved
crates/oxc_linter/src/rules/eslint/array_callback_return/return_checker.rs
Show resolved
Hide resolved
Merging this PR will not alter performance
Comparing Footnotes
|
4c18556 to
e990b14
Compare
Merge activity
|
e990b14 to
c5f0ed3
Compare

No description provided.