Repository navigation
feat(lint): add no-unsafe-class-instance-assignment rule - #1059
Conversation
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.
There was a problem hiding this comment.
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.
Codex Review Summary: âś… CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
đź’ˇ 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".
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
Performance change vs mainWorkflow run · main 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.
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)
tsrs-lintRelease
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)
|
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>
Summary
no-unsafe-class-instance-assignment, ported from feat(no-unsafe-class-instance-assignment): add rule tsgolint#1372 and fix(no-unsafe-class-instance-assignment): guard recursive type comparisons tsgolint#1373, which port feat(eslint-plugin): [no-unsafe-class-instance-assignment] add rule typescript-eslint/typescript-eslint#12907.Point[]andPromise<Point>.Details
eac99bdc.eac99bdcproduces the same records in all four fix modes.