Skip to content

fix(lint/consistent-return): port the core rule's implicit return check - #1191

Merged
camc314 merged 1 commit into
fix/lint-no-confusing-void-expression-1453from
fix/lint-consistent-return-1445
Dec 1, 2026
Merged

camc314 merged 1 commit into
fix/lint-no-confusing-void-expression-1453from
fix/lint-consistent-return-1445

Conversation

@camc314

@camc314 camc314 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Ports oxc-project/tsgolint#1445 (0a392960), including its baseline update.

This ports ESLint's check for functions that return a value on some paths but can also reach the end of the function. Like the core rule, the check now:

  • reports even after an explicit return; mismatch was already reported;
  • skips class constructors and functions whose names start with an uppercase letter;
  • uses the missingReturn message;
  • reports on the arrow token, method key or function name instead of the whole function.

It also no longer skips functions whose return type allows void: typescript-eslint only applies that exemption to bare return; statements, and ESLint's exit check still reports these functions.

function f(a: boolean, b: boolean) {
  if (a) return 1;
  if (b) return; // missingReturnValue
} // also reported now: missingReturn on `f`

function Factory(b: boolean) {
  if (b) return {};
} // no longer reported

const pick = (flag: boolean) => {
  if (flag) return 1;
}; // reported on `=>`

function g(b: boolean): number | void {
  if (b) return 1;
} // now reported

Copilot AI balanced review requested due to automatic review settings November 30, 2026 14:31
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: βœ… Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
πŸ“ Code Review βœ… Completed 2026-12-01T09:22:42.114409Z 6bf86c6 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with πŸ‘€ while any review is running, comments if it has suggestions, and reacts with πŸ‘ once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@camc314
camc314 added this pull request to stack #1163 November 30, 2026 14:32
@camc314
camc314 force-pushed the fix/lint-consistent-return-1445 branch 2 times, most recently from dc575b4 to a588a80 Compare November 30, 2026 17:04
@codspeed

codspeed Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

Warning

oxc-project has exceeded the Hobby plan limit of 5 active contributors. Upgrade your plan or apply to the open source program by December 8, 2026 to keep using CodSpeed.

1 warning

⚠️ 3 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

βœ… 5 untouched benchmarks
⏩ 11 skipped benchmarks1


Comparing fix/lint-consistent-return-1445 (6bf86c6) with fix/lint-no-confusing-void-expression-1453 (48979e2)

Open in CodSpeed

Footnotes

  1. 11 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. ↩

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Performance change vs main

Workflow run Β· main 48979e29cc3a β†’ PR merge bac9592a56a2 (head 6bf86c6fc827)

Clef gate: Running benchmarks because the decision was unavailable (crates/tsrs_lint/src/rules/consistent_return.rs: patch exceeds the Clef context limit (5837 bytes)).

Release builds in fast mode (TSRS_FAST=1) with Hyperfine 2 hardware counters. After warming each binary, alternating main/PR pairs measure wall time at both the fast preset's default checker count and with --singleThreaded, with ten pairs per configuration by default. Instructions come from the single-threaded runs; peak RSS comes from the default-count runs.
Incremental runs start with fresh build info before every invocation; check runs disable incremental compilation.

Project Mode Single-thread wall time Ξ” Single-thread instructions Ξ” Default wall time Ξ” Default peak RSS Ξ”
vscode check 0.0% 0.000% 0.0% -0.1%
vscode incremental +0.7% +0.001% +2.2% 0.0%
xstate-main check +0.7% -0.001% +1.1% -0.4%
xstate-main incremental -0.4% -0.001% +1.5% +0.1%
webpack check -0.6% +0.002% -0.9% 0.0%
webpack incremental -0.2% 0.000% +0.9% +0.3%
mui-docs check -0.5% -0.006% +0.1% +0.3%
mui-docs incremental +0.5% +0.004% -4.4% 0.0%
Compiler check -0.4% 0.000% -1.7% -1.0%
Compiler incremental -0.2% 0.000% +2.2% -2.2%
Compiler-Unions check +0.1% 0.000% +2.2% -0.6%
Compiler-Unions incremental +0.6% 0.000% +0.7% -0.4%
cal-diy check -3.5% -0.001% +1.7% 0.0%
cal-diy incremental -0.5% -0.003% +1.2% +0.1%
formbricks-web check +1.9% 0.000% -1.9% -0.1%
formbricks-web incremental 0.0% -0.002% +1.1% -0.1%
supabase-studio check +0.1% 0.000% +0.3% 0.0%
supabase-studio incremental -0.3% -0.001% -0.6% +0.2%
t3code-server check +1.4% -0.001% -0.7% -0.1%
t3code-server incremental -0.1% -0.005% +1.1% +0.1%
mikro-orm check +0.3% -0.001% +0.9% +0.2%
mikro-orm incremental +0.8% +0.001% -0.3% -0.1%
next-packages-next check +1.2% +0.001% +1.4% +0.3%
next-packages-next incremental -0.5% -0.001% +2.2% +0.1%
next-root check -0.2% +0.001% -0.8% -0.2%
next-root incremental -0.2% +0.004% -0.4% +0.1%
storybook check -0.3% +0.001% +2.4% +0.3%
storybook incremental +0.4% -0.002% +2.3% -0.4%
nuxt check +0.7% -0.001% -0.9% -0.1%
nuxt incremental +1.9% -0.003% +0.7% -0.3%
playwright check +6.5% 0.000% +3.5% -0.9%
playwright incremental -0.2% -0.001% +0.4% +0.2%
drizzle-orm check -2.6% +0.001% +3.5% +1.2%
drizzle-orm incremental +0.7% 0.000% +0.9% +0.1%
typeorm check +1.4% 0.000% -2.5% +0.1%
typeorm incremental +0.4% -0.005% -1.8% +0.4%
date-fns check -2.3% -0.009% +12.8% -0.2%
date-fns incremental -1.2% -0.005% -0.3% -0.6%
opencode-core check -1.7% -0.011% -7.4% -1.9%
opencode-core incremental +0.1% 0.000% -1.3% 0.0%
lobehub check +16.8% -0.012% +3.8% +0.1%
lobehub incremental +2.9% +0.008% +2.3% 0.0%
sentry check +0.8% 0.000% +0.2% +0.2%
sentry incremental 0.0% +0.001% -0.5% 0.0%

Negative means the PR used less; positive means it used more. Deltas are medians of paired PR/main ratios for wall time and instructions. Single-threaded runs reduce scheduling noise; shared CI machines can still add noise to wall time.

Measured medians (main β†’ PR)
Project Mode Single-thread wall time (s) Single-thread instructions Default wall time (s) Default peak RSS (MiB)
vscode check 8.391 β†’ 8.407 81,815,997,746 β†’ 81,816,359,080 1.427 β†’ 1.431 1802.3 β†’ 1799.9
vscode incremental 11.179 β†’ 11.360 84,216,692,726 β†’ 84,217,862,358 2.401 β†’ 2.351 2126.4 β†’ 2126.0
xstate-main check 0.516 β†’ 0.519 5,520,564,161 β†’ 5,520,507,847.5 0.134 β†’ 0.134 239.5 β†’ 238.5
xstate-main incremental 0.536 β†’ 0.535 5,679,479,894.5 β†’ 5,679,471,316 0.162 β†’ 0.162 241.4 β†’ 241.6
webpack check 1.008 β†’ 0.944 10,759,956,078.5 β†’ 10,760,029,216.5 0.199 β†’ 0.196 401.0 β†’ 400.8
webpack incremental 0.966 β†’ 0.957 10,980,375,590 β†’ 10,980,291,678.5 0.236 β†’ 0.239 399.1 β†’ 400.3
mui-docs check 2.886 β†’ 2.811 32,891,860,198.5 β†’ 32,889,551,392 1.001 β†’ 1.027 1184.2 β†’ 1187.5
mui-docs incremental 3.170 β†’ 3.184 34,220,678,344.5 β†’ 34,220,866,068 1.337 β†’ 1.285 1138.8 β†’ 1138.9
Compiler check 0.138 β†’ 0.138 1,745,218,658 β†’ 1,745,211,096 0.063 β†’ 0.063 76.8 β†’ 76.0
Compiler incremental 0.143 β†’ 0.143 1,759,512,717.5 β†’ 1,759,519,061 0.064 β†’ 0.066 80.1 β†’ 78.4
Compiler-Unions check 0.191 β†’ 0.192 3,014,345,102 β†’ 3,014,357,340.5 0.091 β†’ 0.092 79.9 β†’ 79.4
Compiler-Unions incremental 0.193 β†’ 0.195 3,026,957,085 β†’ 3,026,954,012 0.090 β†’ 0.091 83.7 β†’ 83.4
cal-diy check 3.562 β†’ 3.459 28,707,842,164 β†’ 28,707,010,015.5 0.963 β†’ 0.994 1341.1 β†’ 1341.0
cal-diy incremental 3.022 β†’ 3.028 30,308,100,522.5 β†’ 30,307,152,089 1.098 β†’ 1.120 1246.5 β†’ 1247.6
formbricks-web check 4.450 β†’ 4.443 36,891,872,507.5 β†’ 36,892,071,893 1.509 β†’ 1.464 1561.5 β†’ 1559.2
formbricks-web incremental 4.127 β†’ 4.159 39,475,843,074 β†’ 39,475,020,351.5 1.416 β†’ 1.408 1600.1 β†’ 1599.2
supabase-studio check 3.615 β†’ 3.604 40,539,528,491.5 β†’ 40,540,080,188.5 0.901 β†’ 0.902 1286.0 β†’ 1286.2
supabase-studio incremental 3.915 β†’ 3.900 43,470,745,228 β†’ 43,470,407,527 1.034 β†’ 1.028 1342.0 β†’ 1344.1
t3code-server check 4.094 β†’ 4.285 40,782,111,524.5 β†’ 40,781,952,869 1.154 β†’ 1.147 1301.4 β†’ 1300.2
t3code-server incremental 3.669 β†’ 3.660 41,290,065,095 β†’ 41,289,887,743 1.425 β†’ 1.441 1292.4 β†’ 1293.7
mikro-orm check 4.216 β†’ 4.124 44,047,757,609 β†’ 44,047,060,340 0.830 β†’ 0.835 1253.8 β†’ 1256.4
mikro-orm incremental 5.558 β†’ 5.629 44,356,261,534 β†’ 44,356,692,122 1.586 β†’ 1.666 1237.7 β†’ 1236.4
next-packages-next check 1.804 β†’ 1.769 17,277,853,379 β†’ 17,278,049,918 0.425 β†’ 0.434 550.8 β†’ 552.6
next-packages-next incremental 1.874 β†’ 1.876 17,589,438,085 β†’ 17,589,123,723.5 0.509 β†’ 0.518 554.9 β†’ 555.2
next-root check 1.168 β†’ 1.164 13,893,509,516 β†’ 13,893,669,510 0.259 β†’ 0.258 426.2 β†’ 425.5
next-root incremental 1.216 β†’ 1.213 14,349,951,156 β†’ 14,350,625,198 0.313 β†’ 0.311 467.6 β†’ 468.0
storybook check 0.768 β†’ 0.761 8,812,894,406 β†’ 8,812,994,599 0.195 β†’ 0.200 389.9 β†’ 391.0
storybook incremental 0.848 β†’ 0.858 9,132,176,459.5 β†’ 9,131,932,379.5 0.248 β†’ 0.258 368.4 β†’ 367.1
nuxt check 0.827 β†’ 0.844 8,428,939,431 β†’ 8,428,832,540.5 0.214 β†’ 0.210 385.5 β†’ 385.3
nuxt incremental 1.011 β†’ 1.035 8,824,975,481 β†’ 8,824,624,556 0.267 β†’ 0.268 384.7 β†’ 383.6
playwright check 0.730 β†’ 0.771 7,363,133,195.5 β†’ 7,363,173,435.5 0.193 β†’ 0.199 361.3 β†’ 358.1
playwright incremental 0.710 β†’ 0.709 7,539,421,663 β†’ 7,539,425,362.5 0.195 β†’ 0.194 337.1 β†’ 337.8
drizzle-orm check 0.573 β†’ 0.573 5,907,185,392.5 β†’ 5,907,256,695.5 0.200 β†’ 0.199 374.7 β†’ 379.0
drizzle-orm incremental 0.527 β†’ 0.529 6,075,909,593 β†’ 6,075,850,793 0.175 β†’ 0.175 339.3 β†’ 339.6
typeorm check 0.578 β†’ 0.584 6,344,329,813.5 β†’ 6,344,319,376 0.134 β†’ 0.133 224.0 β†’ 224.2
typeorm incremental 0.663 β†’ 0.653 6,728,792,716 β†’ 6,728,573,967.5 0.196 β†’ 0.193 229.3 β†’ 230.2
date-fns check 0.410 β†’ 0.412 3,297,442,020.5 β†’ 3,297,357,582.5 0.114 β†’ 0.125 150.3 β†’ 150.1
date-fns incremental 0.323 β†’ 0.322 3,530,850,516.5 β†’ 3,530,156,264.5 0.118 β†’ 0.111 162.0 β†’ 161.0
opencode-core check 3.861 β†’ 3.612 25,110,179,060 β†’ 25,107,201,487 1.277 β†’ 1.136 1203.7 β†’ 1180.4
opencode-core incremental 2.121 β†’ 2.121 25,468,423,692 β†’ 25,467,809,754 1.106 β†’ 1.091 1088.7 β†’ 1088.7
lobehub check 31.808 β†’ 36.926 185,354,851,343.5 β†’ 185,328,368,443 5.898 β†’ 6.160 4382.6 β†’ 4385.9
lobehub incremental 22.158 β†’ 21.909 188,890,365,293 β†’ 188,905,093,740 8.063 β†’ 8.352 4430.7 β†’ 4428.5
sentry check 8.918 β†’ 8.882 91,310,280,087.5 β†’ 91,309,856,617.5 1.687 β†’ 1.700 1751.5 β†’ 1755.5
sentry incremental 7.938 β†’ 7.960 93,269,457,880.5 β†’ 93,271,631,621 2.059 β†’ 2.049 1896.0 β†’ 1896.1

tsrs-lint

Release tsrs-lint linting each project's source files with all 61 rules. After a warmup run of each binary, alternating main/PR pairs (10 per mode) measure wall time, CPU time and peak RSS with TSRS_FAST unset and with TSRS_FAST=1.

Project Mode Wall time Ξ” CPU time Ξ” Peak RSS Ξ” Diagnostics (main β†’ PR)
webpack default -1.0% -0.1% +0.3% 35405 β†’ 35802, 136 only on main, 533 only on PR
webpack TSRS_FAST=1 +0.3% -0.1% +0.4% 35405 β†’ 35802, 136 only on main, 533 only on PR
drizzle-orm default +0.9% +1.1% -0.1% 7087 β†’ 7087, 2 only on main, 2 only on PR
drizzle-orm TSRS_FAST=1 -1.1% -0.3% 0.0% 7087 β†’ 7087, 2 only on main, 2 only on PR
xstate-main default -1.2% -0.8% -0.6% 6489 β†’ 6495, 6 only on main, 12 only on PR
xstate-main TSRS_FAST=1 +0.8% -1.3% +0.9% 6489 β†’ 6495, 6 only on main, 12 only on PR

Negative means the PR used less. Wall and CPU time deltas are medians of paired PR/main ratios; peak RSS compares medians.

Diagnostics differed (first few of each):

webpack (default):

  • main only: consistent-return lib/Compilation.js:28525 missingReturnValue
  • main only: consistent-return lib/Compilation.js:30430 missingReturnValue
  • main only: consistent-return lib/Compilation.js:26345 missingReturnValue
  • main only: consistent-return lib/bun/BunTargetPlugin.js:874 missingReturnValue
  • main only: consistent-return lib/cache/CacheFacade.js:962 missingReturnValue
  • PR only: consistent-return lib/Compilation.js:27915 missingReturn
  • PR only: consistent-return lib/Compilation.js:28544 missingReturn
  • PR only: consistent-return lib/Compilation.js:29312 missingReturn
  • PR only: consistent-return lib/Compilation.js:30433 missingReturn
  • PR only: consistent-return lib/Compilation.js:26351 missingReturn
    webpack (TSRS_FAST=1):
  • main only: consistent-return lib/Compilation.js:28525 missingReturnValue
  • main only: consistent-return lib/Compilation.js:30430 missingReturnValue
  • main only: consistent-return lib/Compilation.js:26345 missingReturnValue
  • main only: consistent-return lib/bun/BunTargetPlugin.js:874 missingReturnValue
  • main only: consistent-return lib/cache/CacheFacade.js:962 missingReturnValue
  • PR only: consistent-return lib/Compilation.js:27915 missingReturn
  • PR only: consistent-return lib/Compilation.js:28544 missingReturn
  • PR only: consistent-return lib/Compilation.js:29312 missingReturn
  • PR only: consistent-return lib/Compilation.js:30433 missingReturn
  • PR only: consistent-return lib/Compilation.js:26351 missingReturn
    drizzle-orm (default):
  • main only: consistent-return drizzle-orm/src/mysql-core/columns/enum.ts:3930 missingReturnValue
  • main only: consistent-return drizzle-orm/src/sqlite-core/session.ts:5698 missingReturnValue
  • PR only: consistent-return drizzle-orm/src/mysql-core/columns/enum.ts:3946 missingReturn
  • PR only: consistent-return drizzle-orm/src/sqlite-core/session.ts:5698 missingReturn
    drizzle-orm (TSRS_FAST=1):
  • main only: consistent-return drizzle-orm/src/mysql-core/columns/enum.ts:3930 missingReturnValue
  • main only: consistent-return drizzle-orm/src/sqlite-core/session.ts:5698 missingReturnValue
  • PR only: consistent-return drizzle-orm/src/mysql-core/columns/enum.ts:3946 missingReturn
  • PR only: consistent-return drizzle-orm/src/sqlite-core/session.ts:5698 missingReturn
    xstate-main (default):
  • main only: consistent-return packages/core/src/StateMachine.ts:14358 missingReturnValue
  • main only: consistent-return packages/core/src/dev/index.ts:627 missingReturnValue
  • main only: consistent-return packages/core/src/stateUtils.ts:23676 missingReturnValue
  • main only: consistent-return packages/core/test/inspect.test.ts:417 missingReturnValue
  • main only: consistent-return packages/xstate-store/src/validate.ts:1622 missingReturnValue
  • PR only: consistent-return packages/core/src/StateMachine.ts:14367 missingReturn
  • PR only: consistent-return packages/core/src/dev/index.ts:643 missingReturn
  • PR only: consistent-return packages/core/src/stateUtils.ts:23685 missingReturn
  • PR only: consistent-return packages/core/test/inspect.test.ts:435 missingReturn
  • PR only: consistent-return packages/xstate-store/src/alien.ts:14389 missingReturn
    xstate-main (TSRS_FAST=1):
  • main only: consistent-return packages/core/src/StateMachine.ts:14358 missingReturnValue
  • main only: consistent-return packages/core/src/dev/index.ts:627 missingReturnValue
  • main only: consistent-return packages/core/src/stateUtils.ts:23676 missingReturnValue
  • main only: consistent-return packages/core/test/inspect.test.ts:417 missingReturnValue
  • main only: consistent-return packages/xstate-store/src/validate.ts:1622 missingReturnValue
  • PR only: consistent-return packages/core/src/StateMachine.ts:14367 missingReturn
  • PR only: consistent-return packages/core/src/dev/index.ts:643 missingReturn
  • PR only: consistent-return packages/core/src/stateUtils.ts:23685 missingReturn
  • PR only: consistent-return packages/core/test/inspect.test.ts:435 missingReturn
  • PR only: consistent-return packages/xstate-store/src/alien.ts:14389 missingReturn
Measured lint medians (main β†’ PR)
Project Mode Wall time (s) CPU time (s) Peak RSS (MiB)
webpack default 0.361 β†’ 0.358 1.878 β†’ 1.880 454.6 β†’ 455.9
webpack TSRS_FAST=1 0.358 β†’ 0.359 1.868 β†’ 1.863 455.0 β†’ 456.7
drizzle-orm default 0.217 β†’ 0.221 1.178 β†’ 1.191 392.9 β†’ 392.6
drizzle-orm TSRS_FAST=1 0.219 β†’ 0.217 1.182 β†’ 1.173 393.0 β†’ 393.0
xstate-main default 0.314 β†’ 0.312 1.389 β†’ 1.383 338.4 β†’ 336.3
xstate-main TSRS_FAST=1 0.313 β†’ 0.314 1.391 β†’ 1.375 335.4 β†’ 338.3

@camc314
camc314 force-pushed the fix/lint-consistent-return-1445 branch 3 times, most recently from a510e0d to f749756 Compare November 30, 2026 23:18
@camc314
camc314 force-pushed the fix/lint-consistent-return-1445 branch from f749756 to 6bf86c6 Compare December 1, 2026 09:20
@camc314
camc314 enabled stacked auto-merge December 1, 2026 09:35
@camc314
camc314 added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 09e6df4 Dec 1, 2026
72 of 75 checks passed
@camc314
camc314 deleted the fix/lint-consistent-return-1445 branch December 1, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants