Skip to content

fix(linter/array-callback-return): fix handling of default case in switch statements for array-callback-return rule#13081

Merged
camc314 merged 1 commit intooxc-project:mainfrom
lambda47:fix/array-callback-return
Aug 14, 2025
Merged

fix(linter/array-callback-return): fix handling of default case in switch statements for array-callback-return rule#13081
camc314 merged 1 commit intooxc-project:mainfrom
lambda47:fix/array-callback-return

Conversation

@lambda47
Copy link
Contributor

fix handling of default case in switch statements for array-callback-return rule

@lambda47 lambda47 requested a review from camc314 as a code owner August 14, 2025 07:01
@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 14, 2025

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 hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added A-linter Area - Linter C-bug Category - Bug labels Aug 14, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Aug 14, 2025

CodSpeed Instrumentation Performance Report

Merging #13081 will not alter performance

Comparing lambda47:fix/array-callback-return (f3e88f5) with main (e190ee5)

Summary

✅ 34 untouched benchmarks

…itch statements for array-callback-return rule

- fixes(oxc-project#13075)
- Consider cases following the default case in switch statements
@lambda47 lambda47 force-pushed the fix/array-callback-return branch from 8a0aac6 to f3e88f5 Compare August 14, 2025 07:08
Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

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

thanks!

@camc314 camc314 merged commit 618ee87 into oxc-project:main Aug 14, 2025
26 checks passed
@camc314 camc314 requested a review from Copilot August 14, 2025 15:59
Copy link
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 fixes a bug in the array-callback-return linter rule where switch statements with default cases followed by other cases were not handled correctly. The fix ensures that when a default case falls through to subsequent cases, those cases are properly considered for return status analysis.

  • Updated switch statement logic to track when default cases fall through to subsequent cases
  • Added test case to verify proper handling of default case followed by labeled case

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
return_checker.rs Fixed switch statement logic to handle default case fallthrough scenarios
mod.rs Added test case for default case followed by labeled case

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants