Repository navigation
fix(lint/no-duplicate-type-constituents): report constituents with identical syntax - #1214
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: Running benchmarks because the decision was unavailable (crates/tsrs_lint/src/rules/no_duplicate_type_constituents.rs: patch exceeds the Clef context limit (6015 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. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the updated duplicate-type constituent detection.
No open issues 🎉
What changed in this PR
Updates no-duplicate-type-constituents to detect syntactically identical constituents that have distinct checker types, porting upstream tsgolint fix #1463.
Changes:
- Compares constituent syntax, ignoring parentheses, before checking type identity.
- Enables object-literal baseline cases and adds function-signature and generic-parameter coverage.
- Updates the rule’s upstream reference and porting progress.
| File | Description |
|---|---|
crates/tsrs_lint/tests/baselines/PROGRESS.md |
Records the updated upstream revision. |
crates/tsrs_lint/tests/baselines/no-duplicate-type-constituents/REFERENCE |
Pins the baseline to tsgolint commit 74ffdbf1. |
crates/tsrs_lint/tests/baselines/no-duplicate-type-constituents/baseline.json |
Adds and enables cases with expected diagnostics and fixes. |
crates/tsrs_lint/src/rules/no_duplicate_type_constituents.rs |
Adds recursive syntax comparison and shares duplicate-reporting logic. |
Review effort: Balanced
Ports oxc-project/tsgolint#1463 (
74ffdbf1), including its baseline update.Each function type or object type literal gets its own anonymous checker type, so the type-identity check never matched copies of the same signature or literal. Like typescript-eslint's
isSameAstNode, the rule now compares the syntax of earlier constituents, ignoring parentheses, before it looks at types. The two upstream object-literal cases that were skipped now run.