Skip to content

feat(lint): add no-unsafe-class-instance-assignment rule - #1059

Merged
camc314 merged 4 commits into
mainfrom
codex/no-unsafe-class-instance-assignment
Nov 21, 2026
Merged

camc314 merged 4 commits into
mainfrom
codex/no-unsafe-class-instance-assignment

Conversation

@camc314

@camc314 camc314 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

class Point {
  constructor(public x: number, public y: number) {}
}

const point: Point = { x: -1, y: -2 };

Details

Ports oxc-project/tsgolint#1372, which adds the typescript-eslint rule
from typescript-eslint/typescript-eslint#12907. The baseline imports all
56 valid and 82 invalid upstream cases from tsgolint 71c8fc21.

The mixed all-rules fixture now runs 62 rules; replaying it through a
headless build of tsgolint 71c8fc21 gives the same records in all four
fix modes.
Copilot AI balanced review requested due to automatic review settings November 20, 2026 22:49

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 20, 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-21T11:16:56.675138Z 53b065e 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

đź’ˇ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c3f0834b9d

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codspeed

codspeed Bot commented Nov 20, 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/no-unsafe-class-instance-assignment (450260d) with main (ae99b78)

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 20, 2026 •

Copy link
Copy Markdown
Contributor

Performance change vs main

Workflow run · main fd57202e5ded → PR merge 3e4f09dd3f22 (head 450260d5e45c)

Clef gate: Running benchmarks because the decision was unavailable (crates/tsrs_lint/src/rules/no_unsafe_class_instance_assignment.rs: patch exceeds the Clef context limit (14888 bytes)).

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.0% 0.000% -0.4% -0.1%
vscode incremental -0.1% +0.002% -1.1% -0.1%
xstate-main check +0.1% +0.010% +3.5% -0.5%
xstate-main incremental -1.1% -0.015% -1.7% +0.6%
webpack check 0.0% 0.000% -1.4% +0.1%
webpack incremental +0.1% +0.002% -0.7% -0.1%
mui-docs check 0.0% -0.006% -2.6% -0.8%
mui-docs incremental 0.0% +0.020% -1.3% 0.0%
Compiler check -0.8% -0.009% -1.8% -0.1%
Compiler incremental +0.4% +0.081% -1.3% +0.1%
Compiler-Unions check -0.1% -0.009% +0.2% +0.7%
Compiler-Unions incremental -0.6% -0.017% -0.4% 0.0%
cal-diy check -0.1% +0.007% +0.5% -0.1%
cal-diy incremental -0.4% +0.004% +0.1% +0.1%
formbricks-web check +0.5% +0.002% +0.6% -0.1%
formbricks-web incremental +0.2% +0.002% -0.3% +0.1%
supabase-studio check -0.1% +0.004% -0.3% +0.1%
supabase-studio incremental -1.0% -0.005% +0.7% -0.2%
t3code-server check -0.1% +0.004% +1.5% +0.6%
t3code-server incremental -0.3% +0.002% -0.7% 0.0%
mikro-orm check +1.1% 0.000% +1.6% 0.0%
mikro-orm incremental -0.1% 0.000% -0.3% +0.1%
next-packages-next check -1.6% -0.002% -1.5% +0.2%
next-packages-next incremental -0.2% +0.002% -0.8% -0.3%
next-root check -0.7% +0.005% -1.1% 0.0%
next-root incremental -0.1% 0.000% -0.8% -0.1%
storybook check +0.7% 0.000% 0.0% +0.5%
storybook incremental -0.5% +0.006% -2.0% -0.5%
nuxt check 0.0% -0.001% -2.8% +0.1%
nuxt incremental +0.1% +0.002% +1.0% +0.1%
playwright check +0.3% +0.002% +1.2% +0.8%
playwright incremental +0.6% +0.019% +0.2% +0.5%
drizzle-orm check -0.6% +0.002% -2.8% -0.3%
drizzle-orm incremental +0.5% -0.001% -1.0% -0.1%
typeorm check +0.7% -0.002% -2.8% -0.3%
typeorm incremental +0.1% -0.001% +0.6% -0.6%
date-fns check -0.4% +0.005% -2.2% +1.4%
date-fns incremental +0.4% +0.005% +1.9% -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.

Measured medians (main → PR)
Project Mode Single-thread wall time (s) Single-thread instructions Default wall time (s) Default peak RSS (MiB)
vscode check 9.260 → 9.360 82,258,698,167 → 82,258,150,648.5 1.475 → 1.460 1840.7 → 1838.4
vscode incremental 8.439 → 8.436 84,675,409,204.5 → 84,676,942,969.5 1.639 → 1.635 2162.9 → 2160.2
xstate-main check 0.510 → 0.509 5,566,112,937.5 → 5,566,698,299.5 0.123 → 0.128 241.5 → 240.4
xstate-main incremental 0.546 → 0.542 5,729,198,598 → 5,728,329,380 0.164 → 0.163 241.9 → 243.2
webpack check 0.916 → 0.917 10,884,908,433.5 → 10,884,830,267 0.200 → 0.197 403.1 → 403.5
webpack incremental 0.948 → 0.953 11,108,766,423 → 11,108,825,010.5 0.242 → 0.242 402.8 → 402.4
mui-docs check 2.358 → 2.363 33,110,497,671 → 33,108,341,139.5 0.966 → 0.922 1232.4 → 1222.2
mui-docs incremental 2.680 → 2.691 34,454,462,905.5 → 34,461,952,189.5 1.164 → 1.131 1160.2 → 1160.7
Compiler check 0.140 → 0.140 1,775,686,889 → 1,775,527,202.5 0.064 → 0.064 75.5 → 75.4
Compiler incremental 0.143 → 0.144 1,788,494,138 → 1,789,939,965 0.067 → 0.066 78.6 → 78.8
Compiler-Unions check 0.192 → 0.192 3,053,501,061 → 3,053,225,062 0.091 → 0.092 80.3 → 80.8
Compiler-Unions incremental 0.209 → 0.208 3,065,324,966.5 → 3,064,793,307 0.104 → 0.102 84.2 → 84.1
cal-diy check 2.576 → 2.572 28,972,116,735 → 28,973,713,020.5 0.818 → 0.827 1356.6 → 1355.8
cal-diy incremental 2.701 → 2.691 30,593,203,918.5 → 30,594,393,949.5 1.017 → 1.015 1263.6 → 1264.8
formbricks-web check 3.340 → 3.353 37,085,543,164.5 → 37,086,844,672.5 0.855 → 0.860 1580.6 → 1579.5
formbricks-web incremental 3.549 → 3.556 39,688,818,751 → 39,689,642,632.5 1.084 → 1.079 1621.0 → 1623.0
supabase-studio check 3.673 → 3.669 40,821,810,363 → 40,823,634,111 0.930 → 0.922 1308.2 → 1308.9
supabase-studio incremental 4.070 → 4.049 43,772,106,587.5 → 43,770,208,235 1.054 → 1.054 1363.1 → 1360.0
t3code-server check 3.516 → 3.514 41,057,301,174 → 41,059,001,856 1.569 → 1.573 1438.3 → 1447.2
t3code-server incremental 3.669 → 3.655 41,582,155,452 → 41,582,854,464.5 1.439 → 1.432 1304.9 → 1304.8
mikro-orm check 4.013 → 4.056 44,484,668,625.5 → 44,484,539,481.5 0.839 → 0.850 1279.1 → 1279.4
mikro-orm incremental 4.060 → 4.052 44,795,629,612 → 44,795,653,915.5 1.079 → 1.076 1258.9 → 1259.6
next-packages-next check 1.458 → 1.434 17,404,904,265.5 → 17,404,667,374 0.368 → 0.362 557.8 → 558.9
next-packages-next incremental 1.480 → 1.477 17,731,007,090 → 17,731,622,378.5 0.441 → 0.437 563.4 → 562.0
next-root check 1.160 → 1.151 13,962,951,688.5 → 13,963,415,404 0.257 → 0.255 430.5 → 430.4
next-root incremental 1.232 → 1.230 14,425,663,543.5 → 14,425,828,249.5 0.316 → 0.312 472.0 → 471.4
storybook check 0.768 → 0.774 8,867,355,574 → 8,867,421,443 0.203 → 0.199 394.9 → 396.8
storybook incremental 0.802 → 0.799 9,192,288,159 → 9,192,609,825 0.251 → 0.246 375.0 → 373.2
nuxt check 0.810 → 0.808 8,501,471,280.5 → 8,501,566,682.5 0.212 → 0.207 389.1 → 389.6
nuxt incremental 0.864 → 0.868 8,904,193,281 → 8,904,328,641 0.233 → 0.234 390.8 → 391.1
playwright check 0.667 → 0.667 7,402,927,268.5 → 7,403,048,820 0.177 → 0.179 361.4 → 364.2
playwright incremental 0.699 → 0.701 7,574,908,513.5 → 7,576,410,413.5 0.198 → 0.195 339.0 → 340.6
drizzle-orm check 0.513 → 0.513 5,948,396,823 → 5,948,639,007 0.173 → 0.173 381.6 → 380.6
drizzle-orm incremental 0.525 → 0.525 6,120,124,984 → 6,120,081,942.5 0.180 → 0.177 345.0 → 344.6
typeorm check 0.583 → 0.587 6,392,898,997.5 → 6,392,775,189.5 0.139 → 0.134 226.2 → 225.6
typeorm incremental 0.639 → 0.642 6,770,565,946.5 → 6,770,459,274 0.180 → 0.180 233.4 → 231.9
date-fns check 0.275 → 0.273 3,348,437,391.5 → 3,348,747,238 0.086 → 0.083 151.1 → 153.2
date-fns incremental 0.309 → 0.309 3,585,697,582 → 3,585,880,127 0.145 → 0.146 162.8 → 162.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.3% +0.5% +0.1% 37258, identical
webpack TSRS_FAST=1 -0.6% -0.4% -0.2% 37258, identical
drizzle-orm default -1.2% -1.6% 0.0% 7057, identical
drizzle-orm TSRS_FAST=1 +0.4% -0.4% -0.1% 7057, identical
xstate-main default -0.7% -0.4% +0.2% 6489, identical
xstate-main TSRS_FAST=1 +0.8% +0.7% -0.7% 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.358 → 0.355 1.842 → 1.846 467.2 → 467.6
webpack TSRS_FAST=1 0.355 → 0.352 1.834 → 1.826 467.6 → 466.7
drizzle-orm default 0.217 → 0.215 1.169 → 1.151 403.4 → 403.2
drizzle-orm TSRS_FAST=1 0.214 → 0.215 1.160 → 1.158 404.0 → 403.8
xstate-main default 0.308 → 0.309 1.371 → 1.359 340.5 → 341.1
xstate-main TSRS_FAST=1 0.310 → 0.310 1.357 → 1.366 343.4 → 340.9

@camc314 camc314 changed the title feat(lint/no-unsafe-class-instance-assignment): add rule feat(lint): add no-unsafe-class-instance-assignment rule Nov 21, 2026
@camc314 camc314 changed the title feat(lint): add no-unsafe-class-instance-assignment rule feat(lint/no-unsafe-class-instance-assignment): add rule Nov 21, 2026
@camc314 camc314 changed the title feat(lint/no-unsafe-class-instance-assignment): add rule feat(lint): add no-unsafe-class-instance-assignment rule Nov 21, 2026
@camc314
camc314 enabled auto-merge November 21, 2026 11:22
@camc314
camc314 added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit e1182c4 Nov 21, 2026
20 checks passed
@camc314
camc314 deleted the codex/no-unsafe-class-instance-assignment branch November 21, 2026 11:30
rjdellecese added a commit to rjdellecese/confect that referenced this pull request Dec 1, 2026
These versions complete the toolchain set in Effect's 0.74.1 support
table. tsrs5 changes two type-aware rules:

- `no-meaningless-void-operator` now rejects `void` on anything but a
  call (oxc-project/tsrs#1071). That flagged the `void x;` markers our
  type tests used to keep compile-time-only values "used".
- `no-unsafe-class-instance-assignment` is new (oxc-project/tsrs#1059).
  It rejects object literals cast to Convex validator classes and the
  `IndexRange` recording fixture.

Rewrite each marker in a form every rule accepts, without weakening the
check. Dropping `void` leaves bare expressions that
`no-unused-expressions` rejects. Bare QueryStream calls trip
`floating-effect`. `_`-prefixed bindings fail `noUnusedLocals`, and on
`@ts-expect-error` lines that unused-local error would satisfy the
directive by itself.

- A binding that existed only to hold an erroring call becomes
  `void call()`, with the directive still on the same line.
- `@ts-expect-error` property accesses become
  `expectTypeOf(…).not.toHaveProperty(…)`.
- Annotated assignability bindings become `toExtend`.
- The constructor check asserts `toBeInstanceOf`, and forced getters
  assert `toBeDefined`.
- Benchmark baseline expressions move into attest's `bench.baseline`.

Breaking each new type assertion fails typecheck, so they still
enforce their conditions.

Class-typed benchmark values and the fixture now cast through `unknown`.
That removes the `{}`-to-class comparison from the 32
`SchemaToValidator` type benchmarks, so their instantiation baselines are
re-recorded. Core baselines and the other server suites are unchanged.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
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