Repository navigation
fix(lint/no-deprecated): check each union constituent for deprecated properties - #1208
Conversation
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. |
Performance change vs mainWorkflow run · main Clef gate: Clef estimated 18.9% default and single-threaded wall time, 18.2% peak RSS, 27.6% 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.
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. |
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the union-member deprecation changes.
No open issues 🎉
What changed in this PR
Updates no-deprecated to detect deprecated properties on individual union members, aligning JSX attribute and contextual object literal checks with upstream tsgolint.
Changes:
- Adds a shared helper to check each union constituent for deprecated properties.
- Uses raw contextual types for object keys while excluding primitive constituents to avoid unrelated deprecated-member reports.
- Adds eight regression cases and updates baseline provenance to upstream commit
56028945.
| File | Description |
|---|---|
crates/​tsrs_lint/​tests/​baselines/​PROGRESS.md |
Records the updated upstream revision for no-deprecated. |
crates/​tsrs_lint/​tests/​baselines/​no-deprecated/​REFERENCE |
Updates the baseline’s tsgolint commit reference. |
crates/​tsrs_lint/​tests/​baselines/​no-deprecated/​baseline.json |
Adds optional, union, intersection, and JSX property diagnostics. |
crates/​tsrs_lint/​src/​rules/​no_deprecated.rs |
Implements constituent-level lookup and primitive filtering for object keys. |
Review effort: Balanced
Ports oxc-project/tsgolint#1458 (
56028945), including its baseline update.JSX attributes and contextual object literal keys looked their property up on the whole contextual type, so when only one arm of a union declared the property as deprecated, the lookup returned nothing or a synthetic union property and nothing was reported. Like typescript-eslint, each union constituent is now checked on its own, through a
constituent_deprecationhelper, and object keys use the raw contextual type instead of the apparent one.Primitive constituents are skipped, as upstream, so an object literal in a
string | Optionscontext still doesn't pick upString#link(oxc-project/tsgolint#1046), although typescript-eslint reports that case.