Skip to content

fix(lint/prefer-optional-chain): stop treating void expressions as undefined in guards - #1166

Merged
camc314 merged 1 commit into
fix/lint-prefer-optional-chain-1414from
fix/lint-prefer-optional-chain-1415
Nov 30, 2026
Merged

camc314 merged 1 commit into
fix/lint-prefer-optional-chain-1414from
fix/lint-prefer-optional-chain-1415

Conversation

@camc314

@camc314 camc314 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Ports oxc-project/tsgolint#1415 (ad6e9cf3), including its baseline update.

Guard classification treated every void expression as undefined, so a comparison against void tick() could start an optional chain and the fix dropped the call. typescript-eslint only recognizes null and the undefined identifier in these comparisons, and void expressions no longer count as nullish here.

function f(x: { n: number } | undefined, tick: () => void) {
  return x != void tick() && x.n != null; // was fixed to `x?.n != null`
}

Copilot AI balanced review requested due to automatic review settings November 30, 2026 12:21

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-30T14:57:07.281682Z 58a6ca0 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 12:22
@camc314
camc314 force-pushed the fix/lint-prefer-optional-chain-1415 branch from 9b717f1 to 840bf5c Compare November 30, 2026 12:59
@codspeed

codspeed Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 3.41%

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.

2 warnings

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

⚠️ 1 benchmark with a significant change ran on different hardware

Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

❌ 1 regressed benchmark
âś… 7 untouched benchmarks
⏩ 8 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Memory drizzle-orm 97.9 MB 101.3 MB -3.41%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing fix/lint-prefer-optional-chain-1415 (840bf5c) with fix/lint-prefer-optional-chain-1414 (0cf869e)

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

@github-actions

Copy link
Copy Markdown
Contributor

Performance change vs main

Workflow run · main 0cf869e342f2 → PR merge b7e5b257eabc (head 840bf5c9ee12)

Clef gate: Clef estimated 12.9% default and single-threaded wall time, 6.9% peak RSS, 9.0% 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 -1.9% +0.002% +3.5% +0.2%
vscode incremental +0.4% -0.001% -2.4% -0.2%
xstate-main check -0.4% 0.000% +0.2% +0.2%
xstate-main incremental +2.5% -0.001% -1.6% +0.2%
webpack check +0.1% -0.001% -1.4% -0.3%
webpack incremental +0.3% -0.001% +5.7% -0.1%
mui-docs check failed — — —
mui-docs incremental +0.9% +0.005% +6.0% -0.1%
Compiler check -1.1% 0.000% +1.1% +0.2%
Compiler incremental +0.6% 0.000% -0.7% -0.1%
Compiler-Unions check +1.0% +0.001% -1.7% 0.0%
Compiler-Unions incremental -0.2% 0.000% -6.5% -0.1%
cal-diy check 0.0% +0.001% +2.3% +0.1%
cal-diy incremental -0.4% -0.007% -0.5% +0.1%
formbricks-web check -0.3% 0.000% -0.2% +0.1%
formbricks-web incremental failed — — —
supabase-studio check +0.2% +0.002% +0.4% +0.3%
supabase-studio incremental -0.2% 0.000% -1.6% -0.1%
t3code-server check +0.2% -0.002% 0.0% +0.2%
t3code-server incremental +0.5% +0.007% +4.0% 0.0%
mikro-orm check -3.0% -0.001% +2.3% 0.0%
mikro-orm incremental -0.5% +0.001% -0.3% +0.2%
next-packages-next check +4.6% +0.001% -0.4% +0.1%
next-packages-next incremental +0.4% +0.002% -0.7% +0.1%
next-root check -1.0% 0.000% -0.9% -0.1%
next-root incremental 0.0% 0.000% +1.1% +0.1%
storybook check +0.5% 0.000% -2.7% +0.7%
storybook incremental +0.4% +0.002% 0.0% -0.2%
nuxt check +0.2% +0.002% +0.5% -0.1%
nuxt incremental +0.2% -0.002% -1.2% +0.4%
playwright check +0.2% -0.001% -0.2% -1.7%
playwright incremental -0.3% +0.002% +0.6% +0.2%
drizzle-orm check -1.1% +0.002% -1.8% +1.2%
drizzle-orm incremental -0.5% -0.004% +0.4% -0.1%
typeorm check -0.2% +0.001% +0.9% -0.2%
typeorm incremental +1.0% -0.002% -1.2% 0.0%
date-fns check failed — — —
date-fns incremental failed — — —
opencode-core check -4.9% +0.002% -3.3% +0.3%
opencode-core incremental failed — — —
lobehub check -1.5% +0.002% -0.5% 0.0%
lobehub incremental +4.1% -0.011% +1.9% +0.1%
sentry check +0.7% -0.001% -0.2% +0.3%
sentry incremental -2.0% -0.002% -0.2% +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.
Measurements missing or invalid on: mui-docs (check), formbricks-web (incremental), date-fns (check), date-fns (incremental), opencode-core (incremental). See the workflow run for errors.

Measured medians (main → PR)
Project Mode Single-thread wall time (s) Single-thread instructions Default wall time (s) Default peak RSS (MiB)
vscode check 10.993 → 10.453 81,815,907,329.5 → 81,816,384,958.5 1.838 → 2.051 1801.8 → 1806.3
vscode incremental 10.545 → 10.361 84,217,137,379.5 → 84,217,090,067 2.131 → 2.088 2127.7 → 2122.7
xstate-main check 0.566 → 0.570 5,520,582,131.5 → 5,520,637,765.5 0.153 → 0.151 239.4 → 239.9
xstate-main incremental 0.609 → 0.631 5,679,449,997 → 5,679,447,149 0.180 → 0.174 241.7 → 242.2
webpack check 0.911 → 0.910 10,760,058,859.5 → 10,759,897,634 0.199 → 0.193 401.5 → 400.3
webpack incremental 1.202 → 1.213 10,980,250,677.5 → 10,980,348,458.5 0.291 → 0.287 398.8 → 398.4
mui-docs incremental 3.062 → 3.142 34,219,659,590 → 34,222,159,367 1.320 → 1.439 1140.6 → 1139.7
Compiler check 0.170 → 0.166 1,745,214,186.5 → 1,745,212,088 0.072 → 0.072 76.3 → 76.4
Compiler incremental 0.144 → 0.145 1,759,525,063.5 → 1,759,525,035.5 0.067 → 0.066 78.4 → 78.4
Compiler-Unions check 0.194 → 0.196 3,014,332,640.5 → 3,014,348,928.5 0.091 → 0.090 80.0 → 80.0
Compiler-Unions incremental 0.332 → 0.318 3,026,965,709 → 3,026,979,947 0.180 → 0.176 83.7 → 83.6
cal-diy check 3.550 → 3.535 28,707,569,996.5 → 28,707,843,108 1.138 → 1.147 1332.1 → 1332.9
cal-diy incremental 2.786 → 2.761 30,308,682,851.5 → 30,307,365,174.5 1.084 → 1.080 1245.7 → 1247.2
formbricks-web check 3.719 → 3.593 36,892,164,054.5 → 36,892,491,729 0.895 → 0.892 1557.1 → 1558.4
supabase-studio check 4.519 → 4.601 40,539,493,844 → 40,539,640,491 0.962 → 0.935 1282.9 → 1286.4
supabase-studio incremental 3.949 → 3.950 43,469,902,248.5 → 43,469,996,469 1.177 → 1.167 1344.2 → 1342.9
t3code-server check 3.869 → 4.015 40,781,868,273 → 40,780,954,568 1.147 → 1.147 1299.4 → 1302.0
t3code-server incremental 4.704 → 4.646 41,287,351,846 → 41,291,269,582.5 1.591 → 1.570 1293.1 → 1292.7
mikro-orm check 4.919 → 4.701 44,047,615,958.5 → 44,047,175,392.5 0.885 → 0.902 1258.8 → 1259.1
mikro-orm incremental 4.779 → 4.613 44,355,595,781 → 44,356,407,955.5 0.957 → 0.956 1235.2 → 1237.4
next-packages-next check 1.893 → 1.927 17,278,000,310 → 17,278,124,107.5 0.445 → 0.452 552.2 → 552.7
next-packages-next incremental 1.510 → 1.513 17,588,877,183.5 → 17,589,116,086 0.440 → 0.438 554.5 → 555.0
next-root check 1.175 → 1.162 13,893,356,229.5 → 13,893,330,241.5 0.257 → 0.255 427.4 → 427.1
next-root incremental 1.215 → 1.207 14,350,518,048 → 14,350,322,724.5 0.311 → 0.312 466.9 → 467.6
storybook check 1.182 → 1.186 8,813,028,893.5 → 8,812,996,282.5 0.384 → 0.373 388.6 → 391.5
storybook incremental 0.803 → 0.803 9,132,215,674.5 → 9,132,360,145.5 0.237 → 0.238 368.9 → 368.4
nuxt check 0.821 → 0.825 8,428,794,165.5 → 8,429,000,167.5 0.211 → 0.212 384.8 → 384.4
nuxt incremental 1.207 → 1.213 8,824,875,920 → 8,824,719,913.5 0.288 → 0.288 383.2 → 384.9
playwright check 0.675 → 0.677 7,363,173,356.5 → 7,363,070,971 0.172 → 0.173 361.4 → 355.1
playwright incremental 0.701 → 0.697 7,539,472,257 → 7,539,546,642.5 0.196 → 0.194 337.5 → 338.1
drizzle-orm check 0.520 → 0.517 5,907,132,954.5 → 5,907,157,454 0.175 → 0.174 374.0 → 378.4
drizzle-orm incremental 0.538 → 0.537 6,076,316,080 → 6,075,849,099 0.177 → 0.176 340.6 → 340.1
typeorm check 0.604 → 0.604 6,344,344,768.5 → 6,344,430,821.5 0.148 → 0.150 224.2 → 223.9
typeorm incremental 0.675 → 0.679 6,728,544,251 → 6,728,509,458.5 0.184 → 0.178 229.3 → 229.2
opencode-core check 4.829 → 4.197 25,107,890,140 → 25,108,944,736.5 1.318 → 1.537 1194.8 → 1198.3
lobehub check 21.587 → 20.970 185,329,148,652 → 185,333,218,689 5.827 → 5.803 4385.4 → 4387.1
lobehub incremental 22.301 → 23.219 188,895,976,046.5 → 188,882,529,818 8.229 → 8.228 4431.3 → 4437.7
sentry check 8.106 → 8.036 91,310,412,229 → 91,308,467,405.5 1.707 → 1.705 1748.4 → 1753.8
sentry incremental 9.155 → 8.788 93,270,010,554.5 → 93,267,991,369 2.093 → 2.091 1894.6 → 1896.5

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 -0.7% 0.0% +0.1% 35406, identical
webpack TSRS_FAST=1 +0.6% +0.5% -0.1% 35406, identical
drizzle-orm default -1.7% -0.2% 0.0% 7055, identical
drizzle-orm TSRS_FAST=1 -0.2% +0.6% +0.1% 7055, identical
xstate-main default +1.2% +1.2% +0.1% 6489, identical
xstate-main TSRS_FAST=1 -1.7% -0.6% -0.3% 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.361 → 0.358 1.879 → 1.861 454.6 → 454.9
webpack TSRS_FAST=1 0.357 → 0.366 1.860 → 1.882 454.7 → 454.4
drizzle-orm default 0.233 → 0.231 1.243 → 1.233 392.9 → 393.0
drizzle-orm TSRS_FAST=1 0.233 → 0.229 1.218 → 1.228 392.9 → 393.4
xstate-main default 0.339 → 0.346 1.506 → 1.512 338.2 → 338.7
xstate-main TSRS_FAST=1 0.342 → 0.337 1.511 → 1.484 336.4 → 335.5

@camc314
camc314 added this pull request to the merge queue Nov 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue because a pull request earlier in the stack was removed Nov 30, 2026
@camc314
camc314 force-pushed the fix/lint-prefer-optional-chain-1415 branch from 840bf5c to 58a6ca0 Compare November 30, 2026 14:55
@camc314
camc314 enabled stacked auto-merge November 30, 2026 15:04
@camc314
camc314 added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit 547ee89 Nov 30, 2026
18 of 26 checks passed
@camc314
camc314 deleted the fix/lint-prefer-optional-chain-1415 branch November 30, 2026 17:04
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