Skip to content

fix(lint/no-unnecessary-boolean-literal-compare): require nullable unions to contain only booleans - #1145

Merged
camc314 merged 1 commit into
mainfrom
fix/lint-no-unnecessary-boolean-literal-compare-nullable-unions
Nov 29, 2026
Merged

camc314 merged 1 commit into
mainfrom
fix/lint-no-unnecessary-boolean-literal-compare-nullable-unions

Conversation

@camc314

@camc314 camc314 commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Ports oxc-project/tsgolint#1401 to tsrs.

The nullable-boolean check OR-ed the flags of every union part, so any union with a nullish part and a boolean part counted as a nullable boolean, even when it had other members. typescript-eslint drops the nullish parts and requires every remaining part to be boolean.

With allowComparingNullableBooleansToTrue: false, this comparison was reported and fixed to !!x, so matches(1) started returning true:

export function matches(x: 1 | true | undefined): boolean {
  return x === true;
}

Require at least one nullish part, at least one other part, and every non-nullish part to be boolean-like, matching tsgolint ada797a9. This refreshes the rule baseline to that commit and adds the upstream case.

Copilot AI balanced review requested due to automatic review settings November 29, 2026 17:03

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 29, 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-29T18:31:56.321267Z 29ea886 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 enabled auto-merge November 29, 2026 17:04
@camc314
camc314 added this pull request to the merge queue Nov 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 29, 2026
@camc314
camc314 force-pushed the fix/lint-no-unnecessary-boolean-literal-compare-nullable-unions branch from cd9323d to 9acf0ca Compare November 29, 2026 17:24
@codspeed

codspeed Bot commented Nov 29, 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-no-unnecessary-boolean-literal-compare-nullable-unions (29ea886) with main (ac1fa77)

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

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Performance change vs main

Workflow run · main ac1fa7795616 → PR merge 8541bf36c1b3 (head 29ea8862a201)

Clef gate: Clef estimated 12.9% default and single-threaded wall time, 9.5% peak RSS, 11.8% 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.5% 0.000% -0.1% 0.0%
vscode incremental +0.3% 0.000% -0.2% -0.1%
xstate-main check +0.1% 0.000% +0.4% -0.3%
xstate-main incremental -0.6% +0.001% -0.7% -0.2%
webpack check +0.6% +0.003% +0.3% +0.1%
webpack incremental 0.0% 0.000% +0.8% -0.1%
mui-docs check +0.3% -0.004% -5.4% -1.1%
mui-docs incremental +0.1% -0.004% +0.9% -0.1%
Compiler check -0.4% 0.000% -1.0% +1.4%
Compiler incremental -0.3% 0.000% -0.7% -0.3%
Compiler-Unions check +1.0% 0.000% -0.6% +0.7%
Compiler-Unions incremental -1.5% -0.001% -2.2% +0.2%
cal-diy check +0.2% +0.002% -1.0% +0.1%
cal-diy incremental -0.3% +0.002% -0.2% -0.1%
formbricks-web check -0.8% +0.002% +0.3% 0.0%
formbricks-web incremental -0.2% +0.002% +0.7% 0.0%
supabase-studio check +0.2% 0.000% -0.2% +0.1%
supabase-studio incremental +0.1% +0.001% +0.4% -0.1%
t3code-server check +0.1% +0.001% -0.7% +0.1%
t3code-server incremental +0.5% -0.003% -0.3% +0.1%
mikro-orm check -0.7% +0.001% -0.9% 0.0%
mikro-orm incremental +0.7% +0.001% -0.2% 0.0%
next-packages-next check -0.3% 0.000% -0.3% -0.1%
next-packages-next incremental -0.1% -0.001% -0.8% 0.0%
next-root check +1.0% -0.001% -0.1% +0.6%
next-root incremental -0.7% -0.003% -0.9% -0.5%
storybook check +0.5% -0.001% -0.3% -0.2%
storybook incremental -0.3% -0.005% -1.0% -0.5%
nuxt check +0.1% +0.002% +0.1% 0.0%
nuxt incremental +0.4% +0.002% -1.9% -0.3%
playwright check -0.9% -0.001% -1.4% -1.0%
playwright incremental +0.3% +0.001% +1.0% -0.2%
drizzle-orm check +0.6% +0.004% -1.1% -0.9%
drizzle-orm incremental +0.8% -0.003% -1.6% -0.2%
typeorm check 0.0% -0.002% -1.0% -0.1%
typeorm incremental -0.7% 0.000% -3.5% 0.0%
date-fns check +0.6% -0.006% -1.5% +0.5%
date-fns incremental -0.6% -0.004% -2.5% +0.4%
opencode-core check -0.2% +0.001% -0.7% -0.2%
opencode-core incremental 0.0% +0.003% -0.2% -0.1%
lobehub check -0.1% -0.010% -0.2% 0.0%
lobehub incremental -0.1% +0.001% +0.1% +0.1%
sentry check 0.0% +0.001% +0.6% -0.4%
sentry incremental 0.0% +0.005% +0.4% 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.454 → 8.476 81,815,642,077 → 81,815,359,176.5 1.468 → 1.466 1801.4 → 1801.8
vscode incremental 8.634 → 8.664 84,218,152,413 → 84,218,195,635 1.673 → 1.668 2130.0 → 2127.2
xstate-main check 0.508 → 0.506 5,520,583,408.5 → 5,520,562,167 0.125 → 0.127 241.0 → 240.2
xstate-main incremental 0.535 → 0.531 5,679,443,083.5 → 5,679,513,118 0.159 → 0.159 242.0 → 241.4
webpack check 0.919 → 0.925 10,760,292,157.5 → 10,760,230,809 0.199 → 0.204 400.9 → 401.3
webpack incremental 1.034 → 1.030 10,980,373,480 → 10,980,426,727.5 0.269 → 0.273 398.8 → 398.4
mui-docs check 2.366 → 2.379 32,890,980,719 → 32,889,791,161.5 0.996 → 0.933 1196.1 → 1183.1
mui-docs incremental 2.565 → 2.559 34,223,608,608 → 34,221,386,669.5 1.126 → 1.128 1141.7 → 1140.5
Compiler check 0.142 → 0.142 1,745,223,448.5 → 1,745,216,958 0.064 → 0.064 76.1 → 77.2
Compiler incremental 0.143 → 0.144 1,759,530,320.5 → 1,759,526,901.5 0.066 → 0.066 78.6 → 78.4
Compiler-Unions check 0.196 → 0.197 3,014,344,274.5 → 3,014,344,065.5 0.093 → 0.092 80.0 → 80.6
Compiler-Unions incremental 0.195 → 0.194 3,026,970,835.5 → 3,026,960,613.5 0.095 → 0.092 83.7 → 83.9
cal-diy check 2.530 → 2.536 28,707,316,651.5 → 28,707,630,937 0.802 → 0.803 1338.4 → 1339.9
cal-diy incremental 2.682 → 2.674 30,308,298,365.5 → 30,308,179,465 1.008 → 1.005 1247.1 → 1246.3
formbricks-web check 3.459 → 3.434 36,891,711,928 → 36,893,280,619.5 0.867 → 0.871 1558.4 → 1557.8
formbricks-web incremental 3.573 → 3.566 39,474,585,857 → 39,474,959,504.5 1.088 → 1.085 1599.1 → 1599.8
supabase-studio check 3.619 → 3.631 40,539,733,171.5 → 40,539,329,525.5 0.904 → 0.905 1286.2 → 1286.9
supabase-studio incremental 4.154 → 4.158 43,470,669,798 → 43,470,878,758 1.136 → 1.130 1343.8 → 1341.9
t3code-server check 3.545 → 3.533 40,782,262,346 → 40,783,211,641.5 1.136 → 1.135 1296.4 → 1298.3
t3code-server incremental 3.667 → 3.691 41,290,234,925 → 41,289,650,561 1.445 → 1.444 1294.2 → 1295.2
mikro-orm check 4.027 → 4.000 44,047,544,592 → 44,047,579,872 0.847 → 0.839 1256.7 → 1256.5
mikro-orm incremental 3.974 → 4.011 44,355,957,165.5 → 44,356,635,260.5 0.944 → 0.942 1238.5 → 1238.0
next-packages-next check 1.441 → 1.438 17,278,020,178.5 → 17,277,848,819 0.359 → 0.356 553.0 → 552.2
next-packages-next incremental 1.471 → 1.471 17,589,142,051 → 17,589,148,296.5 0.441 → 0.436 556.2 → 556.2
next-root check 1.169 → 1.183 13,893,338,952 → 13,893,243,108.5 0.259 → 0.260 427.0 → 429.6
next-root incremental 1.244 → 1.236 14,350,458,612 → 14,350,235,184.5 0.320 → 0.318 468.4 → 466.0
storybook check 0.770 → 0.772 8,813,067,887.5 → 8,812,992,813 0.204 → 0.199 390.4 → 389.7
storybook incremental 0.801 → 0.800 9,132,656,515 → 9,132,417,926.5 0.242 → 0.240 369.2 → 367.2
nuxt check 0.827 → 0.830 8,428,881,413.5 → 8,428,827,515.5 0.214 → 0.215 384.7 → 384.7
nuxt incremental 0.871 → 0.872 8,824,725,809.5 → 8,825,174,285 0.242 → 0.226 385.2 → 383.9
playwright check 0.666 → 0.661 7,363,248,512.5 → 7,363,056,174.5 0.178 → 0.174 363.1 → 359.6
playwright incremental 0.696 → 0.699 7,539,491,182 → 7,539,519,428 0.191 → 0.196 337.5 → 336.7
drizzle-orm check 0.502 → 0.502 5,907,225,259 → 5,907,335,907.5 0.170 → 0.168 376.0 → 372.6
drizzle-orm incremental 0.525 → 0.528 6,076,030,033 → 6,075,943,777.5 0.177 → 0.173 340.6 → 340.1
typeorm check 0.603 → 0.606 6,344,377,436 → 6,344,328,544 0.140 → 0.137 224.2 → 224.0
typeorm incremental 0.648 → 0.644 6,728,617,193 → 6,728,610,466.5 0.174 → 0.167 229.3 → 229.4
date-fns check 0.274 → 0.276 3,297,332,175.5 → 3,297,134,498 0.086 → 0.084 150.1 → 150.8
date-fns incremental 0.306 → 0.304 3,530,944,198 → 3,529,838,027 0.103 → 0.101 161.9 → 162.5
opencode-core check 2.412 → 2.384 25,106,982,500 → 25,109,713,237 1.043 → 1.040 1185.2 → 1182.8
opencode-core incremental 2.142 → 2.143 25,468,774,368.5 → 25,468,639,308 1.069 → 1.067 1092.3 → 1091.0
lobehub check 16.527 → 16.524 185,342,840,291.5 → 185,328,029,666.5 5.545 → 5.534 4378.3 → 4379.6
lobehub incremental 17.131 → 17.107 188,892,544,864.5 → 188,884,178,605 7.012 → 7.026 4427.9 → 4431.5
sentry check 7.782 → 7.786 91,309,566,665.5 → 91,312,975,404 1.718 → 1.732 1754.0 → 1747.4
sentry incremental 7.877 → 7.877 93,268,979,951.5 → 93,274,687,284.5 2.058 → 2.054 1896.0 → 1895.3

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.2% +0.5% -0.2% 35405, identical
webpack TSRS_FAST=1 +1.9% +0.7% 0.0% 35405, identical
drizzle-orm default +0.3% +1.3% 0.0% 7057, identical
drizzle-orm TSRS_FAST=1 -1.2% -0.5% +0.2% 7057, identical
xstate-main default -0.2% +0.1% +0.2% 6489, identical
xstate-main TSRS_FAST=1 +0.2% -0.1% +0.5% 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.357 → 0.358 1.828 → 1.835 455.0 → 454.2
webpack TSRS_FAST=1 0.354 → 0.360 1.822 → 1.835 454.6 → 454.5
drizzle-orm default 0.217 → 0.219 1.155 → 1.165 392.8 → 392.7
drizzle-orm TSRS_FAST=1 0.217 → 0.215 1.157 → 1.153 392.4 → 393.3
xstate-main default 0.312 → 0.311 1.361 → 1.364 336.9 → 337.6
xstate-main TSRS_FAST=1 0.312 → 0.313 1.363 → 1.373 335.5 → 337.2

@camc314
camc314 added this pull request to the merge queue Nov 29, 2026
@camc314
camc314 removed this pull request from the merge queue due to a manual request Nov 29, 2026
@camc314
camc314 force-pushed the fix/lint-no-unnecessary-boolean-literal-compare-nullable-unions branch from 9acf0ca to 29ea886 Compare November 29, 2026 18:30
@camc314
camc314 enabled auto-merge November 29, 2026 18:36
@camc314
camc314 added this pull request to the merge queue Nov 29, 2026
Merged via the queue into main with commit 5784fad Nov 29, 2026
76 checks passed
@camc314
camc314 deleted the fix/lint-no-unnecessary-boolean-literal-compare-nullable-unions branch November 29, 2026 18:51
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