💅 noUndeclaredDependencies
false positive with type-only imports
#3872
Labels
A-Linter
Area: linter
L-JavaScript
Language: JavaScript and super languages
S-Bug-confirmed
Status: report has been confirmed as a valid bug
Environment information
Rule name
noUndeclaredDependencies
Playground link
https://biomejs.dev/playground/?lintRules=all&code=aQBtAHAAbwByAHQAIAB0AHkAcABlACAAUgBlAGEAYwB0ACAAZgByAG8AbQAgACIAcgBlAGEAYwB0ACIAOwAKAAoAZQB4AHAAbwByAHQAIAB0AHkAcABlACAARQB4AGEAbQBwAGwAZQAgAD0AIAAoACkAIAA9AD4AIABSAGUAYQBjAHQALgBKAFMAWAAuAEUAbABlAG0AZQBuAHQAOwA%3D
Expected result
Type only imports should not be reported as errors by the
noUndeclaredDependencies
rule.In the playground example you can see a type imported from
react
. Which is actually imported from@types/react
. This means that thereact
package is not require and the code works correctly without installing it.I have notice that for example
noNodejsModules
ignores type only imports. That sounds somewhat similar.Code of Conduct
The text was updated successfully, but these errors were encountered: