Skip to content

feat(linter/array-callback-return): use CFG for analysis#20498

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/03-18-feat_linter_array-callback-return_use_cfg_for_analysis
Mar 19, 2026
Merged

feat(linter/array-callback-return): use CFG for analysis#20498
graphite-app[bot] merged 1 commit intomainfrom
c/03-18-feat_linter_array-callback-return_use_cfg_for_analysis

Conversation

@camc314
Copy link
Copy Markdown
Contributor

@camc314 camc314 commented Mar 18, 2026

No description provided.

@camc314 camc314 marked this pull request as ready for review March 18, 2026 11:21
Copilot AI review requested due to automatic review settings March 18, 2026 11:21
Copy link
Copy Markdown
Contributor Author

camc314 commented Mar 18, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of 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.

@github-actions github-actions bot added A-linter Area - Linter C-enhancement Category - New feature or request labels Mar 18, 2026
@camc314 camc314 force-pushed the c/03-18-feat_linter_array-callback-return_use_cfg_for_analysis branch 2 times, most recently from 75d5da2 to 4c18556 Compare March 18, 2026 11:28
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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 allowVoid handling to better match intended diagnostics.
  • Update rule tests/snapshots and add a new failing case covering a while(true) loop with a break path.

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.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 18, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 52 skipped benchmarks1


Comparing c/03-18-feat_linter_array-callback-return_use_cfg_for_analysis (e990b14) with main (65a7c3c)

Open in CodSpeed

Footnotes

  1. 52 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@camc314 camc314 force-pushed the c/03-18-feat_linter_array-callback-return_use_cfg_for_analysis branch from 4c18556 to e990b14 Compare March 18, 2026 11:36
@camc314 camc314 self-assigned this Mar 19, 2026
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Mar 19, 2026
Copy link
Copy Markdown
Contributor Author

camc314 commented Mar 19, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the c/03-18-feat_linter_array-callback-return_use_cfg_for_analysis branch from e990b14 to c5f0ed3 Compare March 19, 2026 22:32
@graphite-app graphite-app bot merged commit c5f0ed3 into main Mar 19, 2026
21 checks passed
@graphite-app graphite-app bot deleted the c/03-18-feat_linter_array-callback-return_use_cfg_for_analysis branch March 19, 2026 22:38
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants