Skip to content

fix(lint/prefer-optional-chain): only treat equality operators as comparisons - #1153

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

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

Conversation

@camc314

@camc314 camc314 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Ports oxc-project/tsgolint#1393 (662a3990), including its baseline update.

parse_operand treated any binary expression involving a member access as a trailing comparison, so the fixer also rewrote assignments and arithmetic, dropping a property write or changing the result. Like typescript-eslint, only ==, ===, != and !== can now end a chain. Other binary operands are invalid in both AND and OR chains.

declare const x: { n: number } | undefined;
x && (x.n = 1); // was fixed to x?.n
x && x.n + 1; // was fixed to x?.n + 1

Copilot AI balanced review requested due to automatic review settings November 30, 2026 11:55

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-30T11:56:25.778034Z 323b56f PR opened
ℹ️ 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 11:56
@camc314
camc314 enabled stacked auto-merge November 30, 2026 12:00
@camc314
camc314 added this pull request to the merge queue Nov 30, 2026
@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-1393 (323b56f) with main (9c6bacf)2

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

  2. No successful run was found on main (3cae89d) during the generation of this report, so 9c6bacf was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@github-actions

Copy link
Copy Markdown
Contributor

Performance change vs main

Workflow run · main 3cae89d2347a → PR merge 9c414df6a6c8 (head 323b56f8e1d6)

Clef gate: Clef estimated 17.1% default and single-threaded wall time, 11.9% peak RSS, 16.2% 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 +0.2% 0.000% -0.5% +0.2%
vscode incremental +0.1% -0.002% -1.9% -0.1%
xstate-main check -2.8% +0.001% -2.2% -0.5%
xstate-main incremental -0.3% -0.002% 0.0% 0.0%
webpack check +0.2% 0.000% +0.5% -0.2%
webpack incremental +0.5% 0.000% +1.4% +0.1%
mui-docs check +1.3% -0.007% +1.4% -1.1%
mui-docs incremental +2.2% -0.001% -4.4% 0.0%
Compiler check -1.6% -0.001% +4.4% -0.3%
Compiler incremental +0.2% 0.000% -1.0% -1.5%
Compiler-Unions check +2.9% 0.000% -0.7% +0.4%
Compiler-Unions incremental -1.6% 0.000% -0.3% 0.0%
cal-diy check -2.6% 0.000% +0.3% 0.0%
cal-diy incremental +2.1% -0.003% -3.1% +0.1%
formbricks-web check 0.0% -0.002% -0.3% +0.1%
formbricks-web incremental +0.5% -0.002% -1.2% +0.1%
supabase-studio check -0.6% +0.003% -1.5% -0.1%
supabase-studio incremental -0.4% +0.003% +1.3% -0.1%
t3code-server check +3.6% -0.001% -4.7% +0.5%
t3code-server incremental +2.0% -0.001% -2.6% 0.0%
mikro-orm check +0.9% -0.001% +0.1% 0.0%
mikro-orm incremental -0.1% +0.002% +0.9% -0.1%
next-packages-next check -0.2% 0.000% -1.0% -0.1%
next-packages-next incremental +0.2% 0.000% +1.1% +0.1%
next-root check -0.9% -0.001% +3.2% +0.5%
next-root incremental +0.4% -0.001% -0.5% 0.0%
storybook check -0.7% +0.002% -1.6% -0.2%
storybook incremental +1.1% -0.012% -3.2% -0.2%
nuxt check +1.7% 0.000% +1.3% 0.0%
nuxt incremental +0.4% +0.006% -3.8% +0.1%
playwright check -5.3% +0.002% -4.8% -1.2%
playwright incremental +1.0% +0.003% -2.4% -0.2%
drizzle-orm check +0.5% 0.000% +0.2% -1.2%
drizzle-orm incremental -1.1% -0.001% -1.3% +0.6%
typeorm check -1.3% +0.001% +0.7% -0.6%
typeorm incremental +2.7% 0.000% -4.5% -0.8%
date-fns check +0.3% -0.003% +3.3% +0.1%
date-fns incremental -1.9% -0.002% -3.5% +0.2%
opencode-core check -0.7% +0.003% -3.0% -2.6%
opencode-core incremental +1.5% -0.001% +1.9% -0.1%
lobehub check -0.9% -0.003% -0.2% 0.0%
lobehub incremental -1.0% +0.003% -0.5% 0.0%
sentry check +4.7% -0.001% -1.6% +0.1%
sentry incremental -0.5% 0.000% -0.3% 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.685 → 8.695 81,815,530,392.5 → 81,815,678,861 1.463 → 1.467 1805.8 → 1810.3
vscode incremental 13.105 → 13.041 84,218,252,756 → 84,217,151,386.5 2.994 → 3.051 2126.0 → 2124.6
xstate-main check 0.636 → 0.616 5,520,469,683.5 → 5,520,569,364 0.144 → 0.140 241.2 → 240.0
xstate-main incremental 0.534 → 0.533 5,679,461,702 → 5,679,418,466 0.160 → 0.159 240.7 → 240.8
webpack check 1.009 → 1.018 10,759,936,141 → 10,759,996,570 0.222 → 0.229 401.5 → 400.7
webpack incremental 1.100 → 1.108 10,980,149,314.5 → 10,980,071,738.5 0.257 → 0.259 398.4 → 398.7
mui-docs check 2.457 → 2.481 32,892,502,462 → 32,889,601,574.5 1.092 → 1.077 1209.4 → 1196.5
mui-docs incremental 3.097 → 3.159 34,222,007,796.5 → 34,222,827,406 1.274 → 1.222 1140.9 → 1141.0
Compiler check 0.170 → 0.171 1,745,223,822.5 → 1,745,213,469.5 0.067 → 0.070 77.3 → 77.1
Compiler incremental 0.160 → 0.161 1,759,519,853.5 → 1,759,524,394.5 0.072 → 0.070 79.5 → 78.3
Compiler-Unions check 0.238 → 0.247 3,014,355,182.5 → 3,014,346,979.5 0.110 → 0.110 80.3 → 80.6
Compiler-Unions incremental 0.201 → 0.198 3,026,962,707 → 3,026,960,734 0.095 → 0.095 83.7 → 83.7
cal-diy check 3.237 → 3.107 28,706,834,925 → 28,706,969,003 0.866 → 0.868 1340.0 → 1340.0
cal-diy incremental 2.806 → 2.792 30,307,947,150.5 → 30,307,823,776.5 1.110 → 1.066 1247.2 → 1248.5
formbricks-web check 3.392 → 3.404 36,892,207,365.5 → 36,892,221,909.5 0.861 → 0.859 1558.1 → 1558.9
formbricks-web incremental 3.669 → 3.709 39,474,630,620.5 → 39,474,451,448.5 1.084 → 1.071 1598.8 → 1600.6
supabase-studio check 4.186 → 3.951 40,540,245,206 → 40,540,526,891.5 1.013 → 1.050 1286.1 → 1284.4
supabase-studio incremental 4.263 → 4.182 43,470,262,193.5 → 43,470,997,581 1.246 → 1.265 1343.9 → 1342.5
t3code-server check 4.481 → 4.672 40,782,521,916.5 → 40,781,201,215.5 1.831 → 1.753 1295.3 → 1301.8
t3code-server incremental 5.707 → 5.786 41,290,690,382.5 → 41,290,339,425 2.791 → 2.664 1292.2 → 1291.8
mikro-orm check 3.960 → 3.994 44,047,679,558.5 → 44,047,239,194.5 0.817 → 0.819 1254.5 → 1254.0
mikro-orm incremental 4.106 → 4.108 44,355,682,834.5 → 44,356,788,792 0.953 → 0.953 1238.2 → 1237.3
next-packages-next check 1.515 → 1.511 17,277,916,309 → 17,277,978,245 0.380 → 0.377 553.4 → 553.1
next-packages-next incremental 1.506 → 1.505 17,589,170,874 → 17,589,371,703.5 0.438 → 0.441 554.7 → 555.2
next-root check 1.804 → 1.813 13,893,589,311.5 → 13,893,368,378 0.418 → 0.415 424.7 → 427.0
next-root incremental 1.236 → 1.242 14,350,036,048 → 14,350,127,407.5 0.322 → 0.322 468.2 → 468.3
storybook check 0.777 → 0.774 8,812,970,495.5 → 8,813,031,864 0.204 → 0.201 389.9 → 389.3
storybook incremental 1.155 → 1.139 9,135,027,325 → 9,132,119,041.5 0.346 → 0.338 369.7 → 368.9
nuxt check 0.837 → 0.867 8,428,877,451.5 → 8,428,809,857.5 0.219 → 0.223 384.3 → 384.4
nuxt incremental 0.882 → 0.896 8,824,843,740 → 8,825,252,752.5 0.237 → 0.226 384.6 → 385.1
playwright check 0.863 → 0.875 7,363,139,849.5 → 7,363,203,660 0.193 → 0.184 359.2 → 355.0
playwright incremental 0.737 → 0.750 7,539,437,697 → 7,539,584,900.5 0.207 → 0.202 337.2 → 336.4
drizzle-orm check 0.522 → 0.520 5,907,309,428 → 5,907,282,166.5 0.174 → 0.176 373.0 → 368.4
drizzle-orm incremental 0.614 → 0.616 6,075,857,890 → 6,075,821,531 0.177 → 0.175 339.0 → 341.0
typeorm check 0.668 → 0.661 6,344,297,257 → 6,344,398,142 0.143 → 0.145 224.7 → 223.3
typeorm incremental 0.718 → 0.744 6,728,708,727 → 6,728,600,969 0.194 → 0.190 231.0 → 229.2
date-fns check 0.279 → 0.280 3,297,344,646 → 3,297,267,814.5 0.083 → 0.087 150.7 → 150.8
date-fns incremental 0.356 → 0.361 3,530,167,076.5 → 3,529,841,938 0.124 → 0.117 162.2 → 162.5
opencode-core check 2.950 → 2.989 25,107,190,679.5 → 25,107,762,236.5 1.530 → 1.445 1214.1 → 1182.5
opencode-core incremental 2.368 → 2.411 25,467,896,175 → 25,467,854,952.5 1.121 → 1.137 1091.7 → 1091.0
lobehub check 17.012 → 16.800 185,342,452,345.5 → 185,339,258,778 5.510 → 5.506 4376.0 → 4376.1
lobehub incremental 21.600 → 20.993 188,905,035,131.5 → 188,904,181,871.5 7.022 → 6.979 4431.3 → 4432.3
sentry check 7.990 → 8.524 91,309,077,052 → 91,308,890,652.5 1.826 → 1.783 1750.4 → 1752.8
sentry incremental 7.984 → 7.952 93,270,321,823.5 → 93,270,573,493 2.049 → 2.045 1894.9 → 1895.8

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% +1.1% -0.1% 35405 → 35404, 1 only on main, 0 only on PR
webpack TSRS_FAST=1 -1.0% -0.4% +0.2% 35405 → 35404, 1 only on main, 0 only on PR
drizzle-orm default -2.9% +0.2% +0.1% 7055, identical
drizzle-orm TSRS_FAST=1 +1.0% -0.1% 0.0% 7055, identical
xstate-main default -2.6% -0.9% +0.3% 6489, identical
xstate-main TSRS_FAST=1 +6.1% +2.5% -0.4% 6489, identical

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: prefer-optional-chain lib/css/syntax-parser.js:147171 preferOptionalChain
    webpack (TSRS_FAST=1):
  • main only: prefer-optional-chain lib/css/syntax-parser.js:147171 preferOptionalChain
Measured lint medians (main → PR)
Project Mode Wall time (s) CPU time (s) Peak RSS (MiB)
webpack default 0.384 → 0.383 1.973 → 1.958 455.1 → 454.5
webpack TSRS_FAST=1 0.382 → 0.383 1.985 → 1.962 454.2 → 455.0
drizzle-orm default 0.254 → 0.246 1.335 → 1.321 392.8 → 393.3
drizzle-orm TSRS_FAST=1 0.246 → 0.249 1.312 → 1.342 392.7 → 392.7
xstate-main default 0.363 → 0.369 1.612 → 1.624 336.9 → 338.0
xstate-main TSRS_FAST=1 0.358 → 0.374 1.583 → 1.628 337.9 → 336.5

Merged via the queue into main with commit 7f0da0f Nov 30, 2026
77 checks passed
@camc314
camc314 deleted the fix/lint-prefer-optional-chain-1393 branch November 30, 2026 12:59
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