fix(linter): mark consistent-type-definitions fix as dangerous inside declare global blocks#16745
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
d23707c to
fde6142
Compare
CodSpeed Performance ReportMerging #16745 will not alter performanceComparing Summary
Footnotes
|
Merge activity
|
fde6142 to
36b2c72
Compare
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #16743 by marking the auto-fix for the consistent-type-definitions rule as dangerous when converting interfaces to types within declare global blocks. The fix is now conditional based on the context - safe in normal code but dangerous within global declarations, where interface merging behavior differs from type aliases.
Key changes:
- Changed the rule's fix capability from
fixtoconditional_fix_dangerousto support context-dependent fix safety - Added runtime checking via
is_within_declare_global_block()helper function to detect global declaration contexts - Refactored fix application logic to use
ctx.diagnostic_with_dangerous_fix()when inside global blocks andctx.diagnostic_with_fix()elsewhere
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crates/oxc_linter/src/rules/typescript/consistent_type_definitions.rs
Outdated
Show resolved
Hide resolved
d6d1da8 to
06b3dae
Compare
b529655 to
cb51c74
Compare

Fixes #16743
🤖 generated with help from Claude Opus 4.5