💅 noUnusedImports fix can change TS modules into ambient contexts #4888
Labels
A-Linter
Area: linter
good first issue
Good for newcomers
S-Bug-confirmed
Status: report has been confirmed as a valid bug
S-Help-wanted
Status: you're familiar with the code base and want to help the project
Environment information
Rule name
noUnusedImports
Playground link
https://biomejs.dev/playground/?lintRules=all&code=aQBtAHAAbwByAHQAIAB7AGYAbwBvACAAYQBzACAAXwBmAG8AbwB9ACAAZgByAG8AbQAgACIAZgBvAG8AIgA7AAoACgAvAC8AIABSAGUAbQBvAHYAaQBuAGcAIAB0AGgAZQAgAGkAbQBwAG8AcgB0ACAAbQBhAGsAZQBzACAAdAB5AHAAZQBzAGMAcgBpAHAAdAAgAHQAaABpAG4AawAgAHQAaABpAHMAIABpAHMAIABnAGwAbwBiAGEAbAAuAAoAZgB1AG4AYwB0AGkAbwBuACAAZgBvAG8AKAApADoAbgB1AG0AYgBlAHIAIAB7AAoAIAAgAHIAZQB0AHUAcgBuACAAMAA7AAoAfQAKAAoALwAvACAAUgBlAG0AbwB2AGkAbgBnACAAdABoAGUAIABpAG0AcABvAHIAdAAgAHIAZQBwAGwAYQBjAGUAcwAgAHQAaABlACAAcgBlAGEAbAAgAG0AbwBkAHUAbABlACAAdwBpAHQAaAAgAHQAaABpAHMAIABkAGUAYwBsAGEAcgBhAHQAaQBvAG4ALAAgAGkAbgBzAHQAZQBhAGQAIABvAGYAIABtAGUAcgBnAGkAbgBnACAAdABoAGUAIABpAG4AdABlAHIAZgBhAGMAZQAuAAoAZABlAGMAbABhAHIAZQAgAG0AbwBkAHUAbABlACAAIgByAGUAYQBjAHQAIgAgAHsACgAgACAAaQBuAHQAZQByAGYAYQBjAGUAIABJAG0AZwBIAFQATQBMAEEAdAB0AHIAaQBiAHUAdABlAHMAPABUAD4AIABlAHgAdABlAG4AZABzACAASABUAE0ATABBAHQAdAByAGkAYgB1AHQAZQBzADwAVAA%2BACAAewAKACAAIAAgACAAZgBlAHQAYwBoAHAAcgBpAG8AcgBpAHQAeQA%2FADoAIAAiAGgAaQBnAGgAIgAgAHwAIAAiAGwAbwB3ACIAIAB8ACAAIgBhAHUAdABvACIAOwAKACAAIAB9AAoAfQAKAA%3D%3D
Expected result
Removing the last import from a file with no exports should be an unsafe fix or should add
export {}
at the bottom.Typescript files with no imports or exports are ambient and all their declarations become global which usually breaks something.
This can realistically happen when using interface merging, because interface merging doesn't need any export statement, which is what happened to me.
Code of Conduct
The text was updated successfully, but these errors were encountered: