Skip to content

fix(linter/explicit-function-return-type): false negative with HOF detection#20495

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/03-18-fix_linter_explicit-function-return-type_false_negative_with_hof_detection
Mar 18, 2026
Merged

fix(linter/explicit-function-return-type): false negative with HOF detection#20495
graphite-app[bot] merged 1 commit intomainfrom
c/03-18-fix_linter_explicit-function-return-type_false_negative_with_hof_detection

Conversation

@camc314
Copy link
Copy Markdown
Contributor

@camc314 camc314 commented Mar 18, 2026

fixes #20482

@camc314 camc314 self-assigned this Mar 18, 2026
@camc314 camc314 marked this pull request as ready for review March 18, 2026 10:32
Copilot AI review requested due to automatic review settings March 18, 2026 10:32
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-bug Category - Bug labels Mar 18, 2026
@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-fix_linter_explicit-function-return-type_false_negative_with_hof_detection (995ac4a) with main (3bbd0cd)

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.

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

Fixes a false negative in the typescript/explicit-function-return-type rule where return statements inside try/catch were incorrectly treated as “higher-order function” returns, causing missing-return-type diagnostics to be skipped.

Changes:

  • Reworked higher-order function detection to scan actual return statements across nested control-flow (including try/catch) and verify their returned expressions are functions.
  • Added a new failing test case and updated the snapshot to cover the try/catch scenario from #20482.

Reviewed changes

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

File Description
crates/oxc_linter/src/rules/typescript/explicit_function_return_type.rs Updates HOF detection by walking return statements via an AST visitor; adds a regression test case.
crates/oxc_linter/src/snapshots/typescript_explicit_function_return_type.snap Updates expected diagnostic snapshot for the new regression case.

You can also share your feedback on Copilot code review. Take the survey.

@camc314 camc314 force-pushed the c/03-18-fix_linter_explicit-function-return-type_false_negative_with_hof_detection branch from c4ffb72 to 995ac4a Compare March 18, 2026 10:42
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Mar 18, 2026
Copy link
Copy Markdown
Contributor Author

camc314 commented Mar 18, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the c/03-18-fix_linter_explicit-function-return-type_false_negative_with_hof_detection branch from 995ac4a to 50d59e9 Compare March 18, 2026 10:49
@graphite-app graphite-app bot merged commit 50d59e9 into main Mar 18, 2026
21 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 18, 2026
@graphite-app graphite-app bot deleted the c/03-18-fix_linter_explicit-function-return-type_false_negative_with_hof_detection branch March 18, 2026 10:54
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.

linter: explicit-function-return-type with try/catch

2 participants