Skip to content

fix(lint/non-nullable-type-assertion-style): leave JSDoc casts in JavaScript files alone - #1080

Merged
camc314 merged 1 commit into
mainfrom
codex/non-nullable-type-assertion-style-js-casts
Nov 24, 2026
Merged

camc314 merged 1 commit into
mainfrom
codex/non-nullable-type-assertion-style-js-casts

Conversation

@camc314

@camc314 camc314 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Ports oxc-project/tsgolint#1286, which fixes oxc-project/tsgolint#1282.

typescript-go reparses a JSDoc cast in a JavaScript file as an as expression, so this rule offered a ! rewrite even though that is not valid JavaScript:

/** @param {string[]} queue */
export function pop(queue) {
  const name = /** @type {string} */ (queue.pop());
  return name;
}

Before, tsrs reported "Use a ! assertion to more succinctly remove null and undefined from the type." and suggested inserting ! after queue.pop(). Now it reports nothing. TypeScript as assertions are still reported.

The rule baseline is refreshed from 020d62f7104077577f6d3e19552e8c98ac760c9f, adding the upstream JavaScript case:

node tools/tsgolint/export.mts <tsgolint-checkout> <output> --rule non_nullable_type_assertion_style --reference 020d62f7104077577f6d3e19552e8c98ac760c9f

Copilot AI balanced review requested due to automatic review settings November 24, 2026 12:53

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 24, 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-24T12:54:34.236900Z ae932af 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 enabled auto-merge November 24, 2026 12:53
@camc314
camc314 added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit 7a04074 Nov 24, 2026
20 checks passed
@camc314
camc314 deleted the codex/non-nullable-type-assertion-style-js-casts branch November 24, 2026 13:03
@codspeed

codspeed Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

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 codex/non-nullable-type-assertion-style-js-casts (ae932af) with main (73f99eb)

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 73f99eb1091e β†’ PR merge 6864d5246a51 (head ae932af1a82c)

Clef gate: Clef estimated 21.7% default and single-threaded wall time, 16.0% peak RSS, 20.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.002% -0.1% +0.2%
vscode incremental +2.8% -0.001% -0.6% +0.1%
xstate-main check +0.4% +0.001% -0.2% +0.1%
xstate-main incremental -3.8% -0.001% -0.5% +0.5%
webpack check -1.2% +0.001% -1.8% +0.2%
webpack incremental -4.2% -0.001% -5.1% -0.2%
mui-docs check +0.2% -0.005% +4.0% +2.0%
mui-docs incremental +0.1% -0.005% +2.4% +0.1%
Compiler check +2.8% 0.000% +4.2% -2.3%
Compiler incremental +2.3% 0.000% +2.9% 0.0%
Compiler-Unions check +0.5% -0.001% +4.5% -0.3%
Compiler-Unions incremental +6.0% 0.000% +12.2% 0.0%
cal-diy check +1.7% +0.001% -0.1% +0.6%
cal-diy incremental +0.1% -0.002% -0.6% -0.1%
formbricks-web check +0.9% -0.003% +1.5% -0.1%
formbricks-web incremental +1.7% -0.004% -0.5% -0.1%
supabase-studio check +1.1% -0.003% -0.6% 0.0%
supabase-studio incremental +0.3% +0.002% -1.9% -0.1%
t3code-server check +0.4% 0.000% -1.6% -0.6%
t3code-server incremental +4.9% -0.001% +0.4% -0.2%
mikro-orm check +1.1% 0.000% -0.2% +0.1%
mikro-orm incremental +0.4% +0.002% +0.6% -0.1%
next-packages-next check +0.3% 0.000% -0.5% -0.2%
next-packages-next incremental -0.1% +0.002% -1.0% +0.2%
next-root check +2.4% +0.001% -0.6% +0.5%
next-root incremental +2.3% +0.002% -0.4% +0.2%
storybook check +1.1% 0.000% +0.1% +0.2%
storybook incremental -0.3% +0.049% -1.9% -0.2%
nuxt check -0.1% -0.003% -1.8% +0.4%
nuxt incremental +0.3% +0.004% -1.0% +0.2%
playwright check +1.0% 0.000% +4.2% +1.4%
playwright incremental -0.1% +0.001% -2.6% +0.3%
drizzle-orm check +4.1% -0.002% -1.0% +0.5%
drizzle-orm incremental +2.2% +0.002% -0.1% -0.3%
typeorm check -1.3% +0.001% +2.2% +0.1%
typeorm incremental -0.6% -0.004% +1.7% -0.4%
date-fns check +0.9% -0.001% -2.7% +0.5%
date-fns incremental -1.3% +0.002% +0.5% +0.4%

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.405 β†’ 8.367 82,259,194,836.5 β†’ 82,259,203,003.5 1.454 β†’ 1.451 1838.2 β†’ 1842.7
vscode incremental 12.423 β†’ 13.088 84,676,808,828 β†’ 84,676,270,048.5 2.149 β†’ 2.124 2160.4 β†’ 2162.6
xstate-main check 0.515 β†’ 0.519 5,566,674,863 β†’ 5,566,724,217.5 0.126 β†’ 0.125 241.2 β†’ 241.3
xstate-main incremental 0.705 β†’ 0.697 5,728,440,144 β†’ 5,728,294,292 0.219 β†’ 0.212 242.6 β†’ 244.0
webpack check 1.269 β†’ 1.250 10,884,974,715 β†’ 10,885,012,382.5 0.241 β†’ 0.243 403.9 β†’ 404.7
webpack incremental 1.107 β†’ 1.048 11,108,805,402.5 β†’ 11,108,654,931.5 0.299 β†’ 0.289 403.0 β†’ 402.2
mui-docs check 2.436 β†’ 2.433 33,107,568,101.5 β†’ 33,103,892,566.5 0.950 β†’ 0.996 1223.2 β†’ 1247.1
mui-docs incremental 3.015 β†’ 3.025 34,460,360,920.5 β†’ 34,459,845,429.5 1.350 β†’ 1.392 1159.4 β†’ 1161.0
Compiler check 0.193 β†’ 0.194 1,775,534,037.5 β†’ 1,775,534,330.5 0.080 β†’ 0.081 78.0 β†’ 76.1
Compiler incremental 0.150 β†’ 0.153 1,789,922,064.5 β†’ 1,789,929,417.5 0.069 β†’ 0.071 79.8 β†’ 79.7
Compiler-Unions check 0.215 β†’ 0.218 3,053,246,294.5 β†’ 3,053,223,277 0.105 β†’ 0.107 81.3 β†’ 81.1
Compiler-Unions incremental 0.323 β†’ 0.341 3,064,784,716.5 β†’ 3,064,788,204 0.153 β†’ 0.161 85.3 β†’ 85.3
cal-diy check 3.448 β†’ 3.478 28,973,315,792.5 β†’ 28,973,444,624.5 1.033 β†’ 1.064 1352.7 β†’ 1361.1
cal-diy incremental 2.777 β†’ 2.786 30,593,525,119.5 β†’ 30,593,506,013.5 1.043 β†’ 1.054 1267.7 β†’ 1265.8
formbricks-web check 3.421 β†’ 3.417 37,085,431,576 β†’ 37,084,829,227 0.883 β†’ 0.887 1581.0 β†’ 1580.0
formbricks-web incremental 4.911 β†’ 4.948 39,691,183,269 β†’ 39,689,431,825 1.342 β†’ 1.354 1625.4 β†’ 1623.9
supabase-studio check 3.675 β†’ 3.735 40,820,906,457 β†’ 40,822,048,679.5 0.912 β†’ 0.915 1309.5 β†’ 1309.1
supabase-studio incremental 4.820 β†’ 4.815 43,768,988,032.5 β†’ 43,769,282,289 1.159 β†’ 1.129 1364.8 β†’ 1364.1
t3code-server check 3.761 β†’ 3.743 41,056,995,910.5 β†’ 41,057,094,283.5 1.666 β†’ 1.618 1446.1 β†’ 1436.9
t3code-server incremental 4.294 β†’ 4.511 41,583,886,483.5 β†’ 41,582,045,081 1.400 β†’ 1.417 1307.1 β†’ 1305.1
mikro-orm check 4.620 β†’ 4.662 44,484,996,976.5 β†’ 44,484,958,754.5 0.861 β†’ 0.862 1280.1 β†’ 1281.8
mikro-orm incremental 4.918 β†’ 4.945 44,795,567,640 β†’ 44,796,380,478.5 1.241 β†’ 1.249 1257.3 β†’ 1255.7
next-packages-next check 1.478 β†’ 1.470 17,404,863,340.5 β†’ 17,404,790,197 0.369 β†’ 0.363 560.3 β†’ 559.2
next-packages-next incremental 1.756 β†’ 1.760 17,731,412,868.5 β†’ 17,731,685,384.5 0.458 β†’ 0.453 563.8 β†’ 564.9
next-root check 1.554 β†’ 1.555 13,963,345,914.5 β†’ 13,963,395,856 0.331 β†’ 0.334 430.2 β†’ 432.4
next-root incremental 1.482 β†’ 1.532 14,425,640,338.5 β†’ 14,426,016,770 0.353 β†’ 0.356 472.9 β†’ 473.6
storybook check 0.766 β†’ 0.774 8,867,468,081.5 β†’ 8,867,500,912 0.203 β†’ 0.202 397.0 β†’ 397.8
storybook incremental 0.844 β†’ 0.830 9,192,814,375 β†’ 9,197,573,330 0.263 β†’ 0.262 375.5 β†’ 374.7
nuxt check 0.831 β†’ 0.830 8,501,756,252.5 β†’ 8,501,675,186.5 0.219 β†’ 0.218 389.7 β†’ 391.4
nuxt incremental 1.129 β†’ 1.121 8,904,256,224 β†’ 8,904,552,401.5 0.269 β†’ 0.268 391.6 β†’ 392.5
playwright check 0.924 β†’ 0.930 7,403,155,487.5 β†’ 7,403,093,248 0.214 β†’ 0.218 360.2 β†’ 365.4
playwright incremental 0.692 β†’ 0.693 7,576,423,598 β†’ 7,576,580,177.5 0.193 β†’ 0.190 339.8 β†’ 340.7
drizzle-orm check 0.608 β†’ 0.615 5,948,761,523.5 β†’ 5,948,544,901 0.190 β†’ 0.185 378.7 β†’ 380.5
drizzle-orm incremental 0.546 β†’ 0.556 6,120,213,538 β†’ 6,120,296,407 0.180 β†’ 0.179 345.5 β†’ 344.6
typeorm check 0.799 β†’ 0.775 6,392,817,745 β†’ 6,392,811,822.5 0.172 β†’ 0.175 226.8 β†’ 227.1
typeorm incremental 0.673 β†’ 0.664 6,770,529,137 β†’ 6,770,568,122.5 0.196 β†’ 0.190 233.5 β†’ 232.6
date-fns check 0.270 β†’ 0.275 3,348,610,092 β†’ 3,348,580,237 0.083 β†’ 0.083 151.6 β†’ 152.4
date-fns incremental 0.342 β†’ 0.339 3,586,281,714 β†’ 3,585,829,072 0.155 β†’ 0.153 163.4 β†’ 164.1

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.1% -0.5% 37258 β†’ 35405, 1853 only on main, 0 only on PR
webpack TSRS_FAST=1 0.0% -1.1% -0.8% 37258 β†’ 35405, 1853 only on main, 0 only on PR
drizzle-orm default +0.7% +2.2% -0.3% 7057, identical
drizzle-orm TSRS_FAST=1 -1.8% -2.6% 0.0% 7057, identical
xstate-main default -0.1% +0.6% +0.8% 6489, identical
xstate-main TSRS_FAST=1 +0.9% +1.6% +0.1% 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: non-nullable-type-assertion-style examples/build-common.js:2570 preferNonNullAssertion
  • main only: non-nullable-type-assertion-style examples/build-common.js:2731 preferNonNullAssertion
  • main only: non-nullable-type-assertion-style examples/build-common.js:2796 preferNonNullAssertion
  • main only: non-nullable-type-assertion-style lib/Compilation.js:26074 preferNonNullAssertion
  • main only: non-nullable-type-assertion-style lib/Compilation.js:26183 preferNonNullAssertion
    webpack (TSRS_FAST=1):
  • main only: non-nullable-type-assertion-style examples/build-common.js:2570 preferNonNullAssertion
  • main only: non-nullable-type-assertion-style examples/build-common.js:2731 preferNonNullAssertion
  • main only: non-nullable-type-assertion-style examples/build-common.js:2796 preferNonNullAssertion
  • main only: non-nullable-type-assertion-style lib/Compilation.js:26074 preferNonNullAssertion
  • main only: non-nullable-type-assertion-style lib/Compilation.js:26183 preferNonNullAssertion
Measured lint medians (main β†’ PR)
Project Mode Wall time (s) CPU time (s) Peak RSS (MiB)
webpack default 0.355 β†’ 0.353 1.830 β†’ 1.823 467.7 β†’ 465.3
webpack TSRS_FAST=1 0.353 β†’ 0.353 1.831 β†’ 1.817 467.8 β†’ 464.1
drizzle-orm default 0.399 β†’ 0.390 1.907 β†’ 1.880 404.3 β†’ 403.3
drizzle-orm TSRS_FAST=1 0.393 β†’ 0.392 1.920 β†’ 1.875 403.8 β†’ 403.7
xstate-main default 0.310 β†’ 0.310 1.350 β†’ 1.370 340.1 β†’ 342.9
xstate-main TSRS_FAST=1 0.309 β†’ 0.311 1.360 β†’ 1.366 342.7 β†’ 342.9

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.

non-nullable-type-assertion-style: JSDoc casts in .js/.mjs files are reported with a ! suggestion that is not JavaScript

2 participants