Skip to content

fix(lint/prefer-optional-chain): apply type options to every truthiness guard - #1174

Merged
camc314 merged 1 commit into
mainfrom
fix/lint-prefer-optional-chain-1418
Nov 30, 2026
Merged

camc314 merged 1 commit into
mainfrom
fix/lint-prefer-optional-chain-1418

Conversation

@camc314

@camc314 camc314 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Ports oxc-project/tsgolint#1418 (6ca1125d), including its baseline update.

The type options (checkString, checkNumber and so on) were only applied to the first truthiness guard in a chain, so later guards ignored them and x && x.s && x.s.length was still fixed to x?.s?.length with checkString off. Like typescript-eslint, any truthiness guard whose type is disabled now splits the chain, for every operand except the last.

// { "checkString": false }
function f(x?: { s: string }) {
  return x && x.s && x.s.length; // no longer reported
}

Copilot AI balanced review requested due to automatic review settings November 30, 2026 14:06

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.

@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-11-30T18:13:55.181388Z 4bc5aa8 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.

@camc314
camc314 added this pull request to stack #1163 November 30, 2026 14:06
@camc314
camc314 force-pushed the fix/lint-prefer-optional-chain-1418 branch from 034385b to 23a80a8 Compare November 30, 2026 14:55
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Performance change vs main

Workflow run Β· main c958da721db2 β†’ PR merge 9ee59d9da19b (head 4bc5aa8a1318)

Clef gate: Clef estimated 19.4% default and single-threaded wall time, 11.6% peak RSS, 13.9% single-threaded instruction count impact probability.

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 -3.7% 0.000% -1.0% -0.2%
vscode incremental -0.2% -0.001% +0.6% -0.2%
xstate-main check +3.9% -0.001% +2.8% -0.6%
xstate-main incremental +1.2% -0.002% +7.7% +0.6%
webpack check +1.6% -0.001% +4.8% -0.2%
webpack incremental 0.0% 0.000% +2.2% -0.1%
mui-docs check +0.3% +0.004% -0.3% -2.2%
mui-docs incremental +1.3% +0.001% -1.0% 0.0%
Compiler check -6.4% 0.000% -1.3% -1.3%
Compiler incremental -0.7% 0.000% +3.6% +0.2%
Compiler-Unions check +4.2% +0.001% +2.9% -0.1%
Compiler-Unions incremental +1.6% 0.000% -3.9% +0.4%
cal-diy check -0.5% +0.001% -0.8% +0.4%
cal-diy incremental -4.5% +0.003% -1.3% -0.2%
formbricks-web check +7.3% +0.001% -4.7% -0.1%
formbricks-web incremental +0.9% -0.002% -4.7% +0.1%
supabase-studio check +0.7% +0.004% -1.5% 0.0%
supabase-studio incremental +0.4% -0.003% +0.1% +0.2%
t3code-server check +1.3% +0.003% -2.5% +0.9%
t3code-server incremental +0.6% +0.001% -3.4% 0.0%
mikro-orm check +0.2% 0.000% -3.5% +0.2%
mikro-orm incremental +1.6% 0.000% +3.0% +0.1%
next-packages-next check +0.8% -0.002% +3.7% -0.3%
next-packages-next incremental -1.0% 0.000% -0.4% -0.2%
next-root check -0.8% 0.000% +0.8% -0.3%
next-root incremental +1.2% +0.001% -1.5% +0.1%
storybook check -2.2% 0.000% -6.3% +0.8%
storybook incremental -0.2% -0.008% +1.4% +0.2%
nuxt check +2.9% +0.002% +1.0% -0.2%
nuxt incremental +1.4% 0.000% +1.1% +0.3%
playwright check -0.3% +0.001% +0.4% +0.2%
playwright incremental -1.1% 0.000% -3.3% -0.2%
drizzle-orm check +0.6% +0.001% -2.9% -3.9%
drizzle-orm incremental +2.6% -0.001% +0.1% -0.8%
typeorm check -0.2% +0.001% 0.0% 0.0%
typeorm incremental -0.6% +0.001% +5.9% +0.1%
date-fns check -4.7% +0.002% -5.0% +0.4%
date-fns incremental -1.0% 0.000% -3.3% -0.1%
opencode-core check +9.4% -0.007% +1.9% -0.3%
opencode-core incremental +2.9% +0.001% -2.5% -0.1%
lobehub check -2.5% +0.004% +3.9% 0.0%
lobehub incremental -2.7% -0.003% +3.7% 0.0%
sentry check -2.2% -0.002% -0.4% -0.1%
sentry incremental -0.6% 0.000% -1.1% -0.1%

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 11.688 β†’ 10.690 81,815,630,232 β†’ 81,815,176,063.5 2.198 β†’ 2.211 1805.7 β†’ 1802.4
vscode incremental 10.206 β†’ 10.085 84,217,467,891.5 β†’ 84,216,913,828 1.766 β†’ 1.773 2130.9 β†’ 2126.1
xstate-main check 0.735 β†’ 0.753 5,520,539,880.5 β†’ 5,520,534,578.5 0.178 β†’ 0.183 240.9 β†’ 239.5
xstate-main incremental 0.749 β†’ 0.756 5,679,474,350.5 β†’ 5,679,359,164.5 0.196 β†’ 0.224 240.0 β†’ 241.4
webpack check 1.219 β†’ 1.243 10,759,992,731.5 β†’ 10,759,976,663 0.249 β†’ 0.261 400.5 β†’ 399.8
webpack incremental 3.761 β†’ 3.698 10,980,104,120 β†’ 10,980,132,816 1.147 β†’ 1.229 399.3 β†’ 399.0
mui-docs check 3.406 β†’ 3.214 32,889,397,223.5 β†’ 32,890,705,228 1.894 β†’ 1.957 1205.6 β†’ 1179.2
mui-docs incremental 4.124 β†’ 4.212 34,220,623,508.5 β†’ 34,221,417,481.5 1.701 β†’ 1.697 1140.7 β†’ 1140.4
Compiler check 0.214 β†’ 0.203 1,745,217,737 β†’ 1,745,210,577 0.079 β†’ 0.080 76.4 β†’ 75.4
Compiler incremental 0.189 β†’ 0.193 1,759,533,214.5 β†’ 1,759,525,527.5 0.082 β†’ 0.082 78.4 β†’ 78.5
Compiler-Unions check 0.301 β†’ 0.311 3,014,333,456 β†’ 3,014,353,710 0.127 β†’ 0.131 80.2 β†’ 80.1
Compiler-Unions incremental 0.263 β†’ 0.269 3,026,957,527.5 β†’ 3,026,965,753.5 0.116 β†’ 0.114 83.4 β†’ 83.7
cal-diy check 3.305 β†’ 3.317 28,707,124,886.5 β†’ 28,707,185,103 0.895 β†’ 0.902 1332.6 β†’ 1338.1
cal-diy incremental 3.867 β†’ 3.588 30,307,825,659 β†’ 30,308,845,690 1.503 β†’ 1.485 1248.5 β†’ 1246.3
formbricks-web check 5.566 β†’ 6.048 36,891,948,002.5 β†’ 36,892,412,701.5 1.264 β†’ 1.209 1559.8 β†’ 1558.0
formbricks-web incremental 5.212 β†’ 5.196 39,474,907,787.5 β†’ 39,474,096,848.5 1.529 β†’ 1.478 1598.9 β†’ 1600.6
supabase-studio check 4.826 β†’ 4.880 40,539,008,560.5 β†’ 40,540,230,592.5 1.027 β†’ 1.005 1285.4 β†’ 1285.9
supabase-studio incremental 5.266 β†’ 5.243 43,472,548,267 β†’ 43,470,023,031.5 1.297 β†’ 1.293 1341.4 β†’ 1343.9
t3code-server check 6.468 β†’ 6.331 40,781,782,774 β†’ 40,781,413,712 1.669 β†’ 1.627 1289.8 β†’ 1301.0
t3code-server incremental 4.399 β†’ 4.577 41,290,325,221.5 β†’ 41,290,819,148.5 1.562 β†’ 1.554 1292.7 β†’ 1292.5
mikro-orm check 5.971 β†’ 5.971 44,047,153,072.5 β†’ 44,046,941,336.5 1.103 β†’ 0.967 1253.9 β†’ 1256.3
mikro-orm incremental 6.817 β†’ 6.774 44,356,327,297.5 β†’ 44,356,272,783.5 1.510 β†’ 1.565 1235.5 β†’ 1236.8
next-packages-next check 2.074 β†’ 2.067 17,278,115,178.5 β†’ 17,277,985,182.5 0.468 β†’ 0.473 552.4 β†’ 551.0
next-packages-next incremental 2.019 β†’ 2.001 17,589,222,890.5 β†’ 17,589,213,473.5 0.569 β†’ 0.565 557.2 β†’ 556.0
next-root check 2.030 β†’ 2.007 13,893,398,252.5 β†’ 13,893,385,341.5 0.534 β†’ 0.524 429.1 β†’ 427.7
next-root incremental 1.953 β†’ 1.937 14,350,044,313 β†’ 14,350,317,141 0.481 β†’ 0.488 467.7 β†’ 468.3
storybook check 1.103 β†’ 1.072 8,813,037,741 β†’ 8,813,032,256.5 0.274 β†’ 0.254 388.3 β†’ 391.2
storybook incremental 1.253 β†’ 1.240 9,134,857,585 β†’ 9,133,383,929.5 0.424 β†’ 0.385 368.3 β†’ 369.0
nuxt check 1.583 β†’ 1.636 8,428,721,854 β†’ 8,428,913,426 0.432 β†’ 0.422 384.7 β†’ 383.8
nuxt incremental 1.369 β†’ 1.371 8,824,864,678.5 β†’ 8,824,943,815.5 0.427 β†’ 0.427 384.0 β†’ 385.2
playwright check 0.844 β†’ 0.822 7,363,145,383.5 β†’ 7,363,185,925 0.211 β†’ 0.215 356.7 β†’ 357.4
playwright incremental 1.086 β†’ 1.113 7,539,528,097.5 β†’ 7,539,410,472 0.306 β†’ 0.311 337.6 β†’ 336.9
drizzle-orm check 0.593 β†’ 0.597 5,907,133,101 β†’ 5,907,233,953.5 0.208 β†’ 0.202 388.8 β†’ 373.5
drizzle-orm incremental 0.695 β†’ 0.702 6,076,114,602.5 β†’ 6,075,978,648.5 0.235 β†’ 0.254 341.8 β†’ 339.1
typeorm check 0.733 β†’ 0.746 6,344,366,934.5 β†’ 6,344,339,018 0.150 β†’ 0.159 224.5 β†’ 224.5
typeorm incremental 1.547 β†’ 1.573 6,728,683,834 β†’ 6,728,659,390 0.422 β†’ 0.440 231.3 β†’ 231.6
date-fns check 0.332 β†’ 0.325 3,297,276,604.5 β†’ 3,297,400,727 0.097 β†’ 0.092 150.8 β†’ 151.3
date-fns incremental 0.463 β†’ 0.458 3,530,913,523.5 β†’ 3,530,550,886.5 0.194 β†’ 0.197 161.6 β†’ 161.5
opencode-core check 4.129 β†’ 4.478 25,109,512,544.5 β†’ 25,107,348,121.5 1.635 β†’ 1.255 1183.4 β†’ 1179.7
opencode-core incremental 2.966 β†’ 3.004 25,467,785,318 β†’ 25,468,601,854 1.650 β†’ 1.545 1089.5 β†’ 1088.4
lobehub check 22.423 β†’ 22.076 185,329,685,458.5 β†’ 185,343,612,379 6.992 β†’ 7.187 4380.3 β†’ 4380.8
lobehub incremental 27.584 β†’ 26.120 188,896,130,954 β†’ 188,899,277,103 9.367 β†’ 10.303 4426.1 β†’ 4427.9
sentry check 11.132 β†’ 10.626 91,311,200,806.5 β†’ 91,309,730,122.5 2.011 β†’ 2.161 1755.4 β†’ 1753.9
sentry incremental 11.869 β†’ 12.336 93,270,575,107 β†’ 93,270,586,098.5 2.735 β†’ 2.712 1895.7 β†’ 1894.4

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 +5.4% +1.0% 0.0% 35405, identical
webpack TSRS_FAST=1 -5.9% -2.0% +0.1% 35405, identical
drizzle-orm default +3.8% +3.2% +0.1% 7055, identical
drizzle-orm TSRS_FAST=1 -5.7% -5.3% 0.0% 7055, identical
xstate-main default +2.4% +3.9% -0.4% 6489, identical
xstate-main TSRS_FAST=1 -6.4% -3.3% -0.6% 6489, identical

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

Measured lint medians (main β†’ PR)
Project Mode Wall time (s) CPU time (s) Peak RSS (MiB)
webpack default 0.709 β†’ 0.704 3.467 β†’ 3.471 454.3 β†’ 454.2
webpack TSRS_FAST=1 0.736 β†’ 0.696 3.530 β†’ 3.417 454.2 β†’ 454.8
drizzle-orm default 0.324 β†’ 0.338 1.685 β†’ 1.648 393.0 β†’ 393.2
drizzle-orm TSRS_FAST=1 0.301 β†’ 0.278 1.558 β†’ 1.450 392.8 β†’ 392.6
xstate-main default 0.609 β†’ 0.607 2.504 β†’ 2.542 336.1 β†’ 334.7
xstate-main TSRS_FAST=1 0.628 β†’ 0.557 2.563 β†’ 2.436 336.4 β†’ 334.2

@camc314
camc314 force-pushed the fix/lint-prefer-optional-chain-1418 branch from 23a80a8 to e784171 Compare November 30, 2026 17:04
Base automatically changed from fix/lint-prefer-optional-chain-1417 to main November 30, 2026 18:12
@camc314
camc314 force-pushed the fix/lint-prefer-optional-chain-1418 branch from e784171 to 4bc5aa8 Compare November 30, 2026 18:12
@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

⚠️ 4 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

βœ… 8 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing fix/lint-prefer-optional-chain-1418 (4bc5aa8) with main (c958da7)

Open in CodSpeed

Footnotes

  1. 8 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 added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit a1ddc21 Nov 30, 2026
77 checks passed
@camc314
camc314 deleted the fix/lint-prefer-optional-chain-1418 branch November 30, 2026 22:22
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