fix(no-duplicates): treat entry points declared in one shared declaration file as different modules #627
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.37) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 228 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.325
Real PR Conversation Timeline
1 comments
"Review active on #627"
general
weight: 0.35
thekhegay
Closes #308
Svelte bundles all entry points into one
types/index.d.tswithdeclare module 'svelte' {},declare module 'svelte/transition' {}and so on, and everyexportssubpath pointstypesat that file. With TS resolver they all resolve to same path, so rule reported them as duplicates and autofix merged them into one import, which breaks the codeNow when imports with different specifiers resolve to same
.d.ts/.d.mts/.d.cts, the file is parsed once (cached by mtime) and specifiers it declares with top leveldeclare modulebecome their own modules. Same specifier imported twice is still reported,considerQueryStringandwhitelistwork as before. File is only parsed when one file imports more than one specifier that resolves thereNames come from parser AST, so comments around
declare moduledont matter, and if file cant be parsed rule groups by path like before. Docs now say svelte needs nowhitelist, whitelist examples use made upui-kitpackage so they stay correct. New specs fail without the change, full suite 4020 pass<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
The duplicate-import check now distinguishes package entry points that resolve to the same declaration file but declare separate modules. Imports from distinct entry points are no longer incorrectly reported as duplicates, while repeated imports of the same entry point are still reported and can be autofixed.
Documentation
Updated the rule documentation with examples explaining how distinct entry points are handled, including cases where the whitelist determines whether imports are treated as duplicates.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->