Skip to content

fix(lint/no-unnecessary-condition): stop checking type predicates of array predicate callbacks - #1188

Merged
camc314 merged 1 commit into
fix/lint-consistent-return-1443from
fix/lint-no-unnecessary-condition-1439
Dec 1, 2026
Merged

camc314 merged 1 commit into
fix/lint-consistent-return-1443from
fix/lint-no-unnecessary-condition-1439

Conversation

@camc314

@camc314 camc314 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Ports oxc-project/tsgolint#1439 (e018a471), including its baseline update.

With checkTypePredicates on, array predicate callbacks such as filter(pred) were reported as unnecessary type guards whenever their parameter type already matched the predicate, which is normal for a callback that still accepts or rejects each element. Like typescript-eslint, type predicates are now checked only on the guard call itself, and callbacks passed to array methods are only checked for always-truthy or always-falsy return values.

// checkTypePredicates: true
const pred = (x: number): x is number => x > 0;
[1, -1].filter(pred); // no longer reported

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

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-30T23:20:13.172791Z 8c82a1a 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:32
@camc314
camc314 force-pushed the fix/lint-no-unnecessary-condition-1439 branch from f75d7f6 to fd030eb 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 66b0a7a7891a โ†’ PR merge 74b6f7005eab (head 8c82a1a34d34)

Clef gate: Clef estimated 21.7% default and single-threaded wall time, 17.3% peak RSS, 29.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 +0.4% 0.000% +0.8% +0.3%
vscode incremental +1.3% 0.000% -0.7% +0.3%
xstate-main check -0.3% 0.000% -1.0% -0.1%
xstate-main incremental 0.0% 0.000% +0.5% 0.0%
webpack check +0.9% +0.001% -1.8% +0.2%
webpack incremental +1.4% -0.001% +4.5% -0.2%
mui-docs check +1.3% +0.001% -1.3% +1.5%
mui-docs incremental -3.1% +0.003% +0.4% -0.2%
Compiler check +0.8% 0.000% +4.9% 0.0%
Compiler incremental -0.7% -0.001% +1.9% -0.1%
Compiler-Unions check +2.7% 0.000% -4.1% +0.3%
Compiler-Unions incremental -0.3% -0.001% -1.7% -0.1%
cal-diy check +5.4% -0.002% +3.2% +0.4%
cal-diy incremental +0.5% +0.002% +3.0% -0.1%
formbricks-web check +2.7% +0.001% -0.4% +0.1%
formbricks-web incremental -2.4% -0.002% +2.1% 0.0%
supabase-studio check +1.5% +0.002% +2.1% -0.3%
supabase-studio incremental -4.1% -0.003% +0.7% 0.0%
t3code-server check +0.1% +0.006% +0.1% -0.3%
t3code-server incremental -0.2% +0.001% -0.8% -0.1%
mikro-orm check -1.7% 0.000% -1.5% -0.1%
mikro-orm incremental -0.1% +0.001% -1.3% 0.0%
next-packages-next check +0.2% -0.001% -1.6% -0.4%
next-packages-next incremental -1.8% -0.003% -2.1% +0.1%
next-root check +0.8% +0.001% -0.8% +0.4%
next-root incremental +0.4% -0.002% +1.6% +0.1%
storybook check +1.1% 0.000% -0.3% -0.7%
storybook incremental -1.6% +0.004% -3.6% 0.0%
nuxt check +1.7% +0.001% -0.1% -0.1%
nuxt incremental +0.1% +0.004% -0.9% -0.4%
playwright check -1.8% +0.001% +4.5% +1.9%
playwright incremental +2.6% 0.000% -3.5% -0.2%
drizzle-orm check +2.6% +0.013% -2.9% -2.4%
drizzle-orm incremental +2.3% 0.000% +3.5% 0.0%
typeorm check -4.0% 0.000% +2.7% -0.2%
typeorm incremental -2.1% 0.000% -3.2% 0.0%
date-fns check +0.7% +0.005% -0.1% +0.3%
date-fns incremental -1.5% +0.005% -4.9% -0.5%
opencode-core check -0.1% +0.007% +6.5% +1.3%
opencode-core incremental +0.4% +0.002% 0.0% +0.1%
lobehub check -0.8% -0.008% +0.6% 0.0%
lobehub incremental +2.1% -0.011% +3.3% -0.2%
sentry check +0.5% +0.002% +0.1% +0.3%
sentry incremental +2.0% 0.000% -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 12.660 โ†’ 12.810 81,815,445,827 โ†’ 81,815,767,643 1.682 โ†’ 1.677 1804.7 โ†’ 1810.5
vscode incremental 10.501 โ†’ 10.511 84,217,865,811 โ†’ 84,218,078,519.5 1.706 โ†’ 1.677 2127.7 โ†’ 2134.4
xstate-main check 0.610 โ†’ 0.604 5,520,579,168 โ†’ 5,520,578,918 0.140 โ†’ 0.139 240.4 โ†’ 240.2
xstate-main incremental 0.574 โ†’ 0.577 5,679,479,531 โ†’ 5,679,465,232.5 0.165 โ†’ 0.167 242.0 โ†’ 242.1
webpack check 1.350 โ†’ 1.381 10,759,855,148.5 โ†’ 10,759,978,524 0.281 โ†’ 0.276 401.3 โ†’ 402.0
webpack incremental 1.253 โ†’ 1.262 10,980,358,085.5 โ†’ 10,980,346,714.5 0.351 โ†’ 0.364 398.9 โ†’ 398.2
mui-docs check 2.825 โ†’ 2.905 32,889,386,916.5 โ†’ 32,889,974,057 1.038 โ†’ 1.047 1181.1 โ†’ 1199.3
mui-docs incremental 3.403 โ†’ 3.309 34,220,377,692.5 โ†’ 34,221,289,715 1.376 โ†’ 1.362 1141.7 โ†’ 1139.7
Compiler check 0.211 โ†’ 0.217 1,745,210,344 โ†’ 1,745,219,224 0.092 โ†’ 0.100 76.9 โ†’ 77.0
Compiler incremental 0.228 โ†’ 0.230 1,759,520,925.5 โ†’ 1,759,524,093 0.114 โ†’ 0.112 78.5 โ†’ 78.4
Compiler-Unions check 0.275 โ†’ 0.282 3,014,341,440.5 โ†’ 3,014,347,358.5 0.120 โ†’ 0.122 79.7 โ†’ 79.9
Compiler-Unions incremental 0.332 โ†’ 0.333 3,026,975,081.5 โ†’ 3,026,960,629.5 0.153 โ†’ 0.148 83.7 โ†’ 83.6
cal-diy check 3.079 โ†’ 3.126 28,706,765,145 โ†’ 28,706,980,828.5 0.821 โ†’ 0.839 1332.1 โ†’ 1337.1
cal-diy incremental 5.078 โ†’ 6.499 30,307,559,329.5 โ†’ 30,308,172,723 1.221 โ†’ 1.254 1247.5 โ†’ 1246.4
formbricks-web check 4.276 โ†’ 4.111 36,892,153,104 โ†’ 36,892,651,785.5 0.895 โ†’ 0.901 1557.2 โ†’ 1559.0
formbricks-web incremental 5.195 โ†’ 5.126 39,475,374,546.5 โ†’ 39,474,088,177.5 2.324 โ†’ 2.302 1600.9 โ†’ 1600.2
supabase-studio check 4.292 โ†’ 4.364 40,539,830,284.5 โ†’ 40,540,636,466.5 1.102 โ†’ 1.128 1288.8 โ†’ 1285.0
supabase-studio incremental 4.708 โ†’ 4.573 43,471,354,669 โ†’ 43,470,067,627 1.150 โ†’ 1.157 1342.7 โ†’ 1343.2
t3code-server check 4.539 โ†’ 4.363 40,781,731,771.5 โ†’ 40,785,240,316.5 1.137 โ†’ 1.143 1301.6 โ†’ 1297.5
t3code-server incremental 3.650 โ†’ 3.651 41,289,856,638.5 โ†’ 41,289,840,868.5 1.435 โ†’ 1.421 1292.9 โ†’ 1292.1
mikro-orm check 8.119 โ†’ 7.764 44,047,513,527 โ†’ 44,047,518,382 1.825 โ†’ 1.819 1256.7 โ†’ 1255.0
mikro-orm incremental 4.436 โ†’ 4.387 44,356,125,252 โ†’ 44,356,540,631.5 1.040 โ†’ 1.050 1237.2 โ†’ 1236.8
next-packages-next check 2.042 โ†’ 2.023 17,278,190,453 โ†’ 17,277,813,111 0.509 โ†’ 0.499 554.7 โ†’ 552.5
next-packages-next incremental 3.261 โ†’ 3.252 17,588,982,405.5 โ†’ 17,588,890,754.5 0.867 โ†’ 0.915 555.5 โ†’ 556.3
next-root check 1.567 โ†’ 1.566 13,893,529,431 โ†’ 13,893,720,257.5 0.561 โ†’ 0.460 424.5 โ†’ 426.3
next-root incremental 1.307 โ†’ 1.311 14,350,396,239.5 โ†’ 14,350,038,455 0.375 โ†’ 0.377 467.5 โ†’ 468.1
storybook check 0.855 โ†’ 0.877 8,812,987,570 โ†’ 8,813,034,742.5 0.218 โ†’ 0.220 392.2 โ†’ 389.3
storybook incremental 1.037 โ†’ 0.989 9,132,107,830.5 โ†’ 9,132,465,623 0.318 โ†’ 0.300 368.7 โ†’ 368.7
nuxt check 0.861 โ†’ 0.904 8,428,928,526.5 โ†’ 8,429,028,233.5 0.207 โ†’ 0.206 385.0 โ†’ 384.8
nuxt incremental 0.983 โ†’ 0.986 8,824,828,745 โ†’ 8,825,058,824 0.251 โ†’ 0.249 384.8 โ†’ 383.2
playwright check 0.736 โ†’ 0.736 7,363,181,205 โ†’ 7,363,229,732 0.186 โ†’ 0.188 354.7 โ†’ 361.5
playwright incremental 0.744 โ†’ 0.815 7,539,520,617 โ†’ 7,539,500,855 0.212 โ†’ 0.202 337.4 โ†’ 336.6
drizzle-orm check 0.758 โ†’ 0.757 5,907,173,453 โ†’ 5,908,358,822.5 0.237 โ†’ 0.219 378.2 โ†’ 369.0
drizzle-orm incremental 0.643 โ†’ 0.661 6,075,905,766.5 โ†’ 6,075,907,250.5 0.192 โ†’ 0.192 340.1 โ†’ 340.0
typeorm check 0.736 โ†’ 0.718 6,344,389,229.5 โ†’ 6,344,450,263.5 0.173 โ†’ 0.187 224.0 โ†’ 223.5
typeorm incremental 0.742 โ†’ 0.720 6,728,630,621 โ†’ 6,728,613,874.5 0.199 โ†’ 0.204 229.6 โ†’ 229.5
date-fns check 0.271 โ†’ 0.273 3,297,446,495 โ†’ 3,297,469,671 0.086 โ†’ 0.086 148.9 โ†’ 149.4
date-fns incremental 0.370 โ†’ 0.378 3,531,120,271.5 โ†’ 3,530,753,620.5 0.168 โ†’ 0.149 161.4 โ†’ 160.7
opencode-core check 2.159 โ†’ 2.159 25,108,038,853.5 โ†’ 25,109,023,336.5 1.053 โ†’ 1.131 1184.9 โ†’ 1200.1
opencode-core incremental 2.397 โ†’ 2.461 25,468,331,522 โ†’ 25,468,491,860.5 1.215 โ†’ 1.216 1090.3 โ†’ 1090.9
lobehub check 20.508 โ†’ 20.552 185,347,904,636.5 โ†’ 185,329,373,928 6.177 โ†’ 6.225 4379.5 โ†’ 4381.3
lobehub incremental 20.742 โ†’ 21.380 188,906,292,726 โ†’ 188,892,065,626.5 8.441 โ†’ 8.369 4438.5 โ†’ 4429.7
sentry check 9.724 โ†’ 9.863 91,308,539,648 โ†’ 91,310,477,444 1.772 โ†’ 1.776 1749.4 โ†’ 1754.8
sentry incremental 9.412 โ†’ 9.406 93,268,412,157.5 โ†’ 93,269,160,602 2.114 โ†’ 2.127 1896.2 โ†’ 1895.7

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 -3.0% -1.4% +0.2% 35405, identical
webpack TSRS_FAST=1 -3.0% -2.9% +0.1% 35405, identical
drizzle-orm default -2.1% +0.2% +0.1% 7087, identical
drizzle-orm TSRS_FAST=1 -2.8% -0.8% +0.2% 7087, identical
xstate-main default +0.3% +0.3% +0.2% 6489, identical
xstate-main TSRS_FAST=1 +0.9% +1.3% -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.

Measured lint medians (main โ†’ PR)
Project Mode Wall time (s) CPU time (s) Peak RSS (MiB)
webpack default 0.440 โ†’ 0.423 2.168 โ†’ 2.105 453.8 โ†’ 454.6
webpack TSRS_FAST=1 0.422 โ†’ 0.404 2.116 โ†’ 2.091 454.3 โ†’ 454.8
drizzle-orm default 0.251 โ†’ 0.246 1.305 โ†’ 1.296 393.0 โ†’ 393.4
drizzle-orm TSRS_FAST=1 0.243 โ†’ 0.240 1.271 โ†’ 1.262 392.7 โ†’ 393.4
xstate-main default 0.336 โ†’ 0.335 1.473 โ†’ 1.462 336.5 โ†’ 337.1
xstate-main TSRS_FAST=1 0.334 โ†’ 0.337 1.469 โ†’ 1.483 337.2 โ†’ 335.8

@camc314
camc314 force-pushed the fix/lint-no-unnecessary-condition-1439 branch 2 times, most recently from d9a1875 to 1c0da73 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-no-unnecessary-condition-1439 (8c82a1a) with fix/lint-consistent-return-1443 (8566db3)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 fix/lint-consistent-return-1443 (66b0a7a) during the generation of this report, so 4390fd4 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. โ†ฉ

@camc314
camc314 force-pushed the fix/lint-no-unnecessary-condition-1439 branch from 1c0da73 to 5d9a17c Compare November 30, 2026 22:22
@camc314
camc314 force-pushed the fix/lint-no-unnecessary-condition-1439 branch from 5d9a17c to 8c82a1a Compare November 30, 2026 23:18
@camc314
camc314 added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 0eedd77 Dec 1, 2026
77 checks passed
@camc314
camc314 deleted the fix/lint-no-unnecessary-condition-1439 branch December 1, 2026 09:20
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