Environment information
CLI:
Version: 2.2.4
Color support: true
Platform:
CPU Architecture: x86_64
OS: linux
Environment:
BIOME_LOG_PATH: unset
BIOME_LOG_PREFIX_NAME: unset
BIOME_CONFIG_PATH: unset
BIOME_THREADS: unset
NO_COLOR: unset
TERM: xterm-256color
JS_RUNTIME_VERSION: v22.19.0
JS_RUNTIME_NAME: node
NODE_PACKAGE_MANAGER: bun/1.2.22
Biome Configuration:
Status: Loaded successfully
Path: biome.jsonc
Formatter enabled: true
Linter enabled: true
Assist enabled: true
VCS enabled: true
Workspace:
Open Documents: 0
What happened?
A lint/correctness/noUnusedImports error is always triggered when I define a variable with the same name as an imported type namespace object.
Program that triggers the error
// lint/correctness/noUnusedImports: This import is unused.
import type * as hast from "hast"
const _ = () => {
let hast: hast.Root
}
https://biomejs.dev/playground/?code=aQBtAHAAbwByAHQAIAB0AHkAcABlACAAKgAgAGEAcwAgAGgAYQBzAHQAIABmAHIAbwBtACAAIgBoAGEAcwB0ACIACgAKAGMAbwBuAHMAdAAgAF8AIAA9ACAAKAApACAAPQA%2BACAAewAKACAAIABsAGUAdAAgAGgAYQBzAHQAOgAgAGgAYQBzAHQALgBSAG8AbwB0AAoAfQA%3D
Program that does not trigger the error
This just changes the variable name to hoge from hast.
import type * as hast from "hast"
const _ = () => {
let hoge: hast.Root
}
https://biomejs.dev/playground/?code=aQBtAHAAbwByAHQAIAB0AHkAcABlACAAKgAgAGEAcwAgAGgAYQBzAHQAIABmAHIAbwBtACAAIgBoAGEAcwB0ACIACgAKAGMAbwBuAHMAdAAgAF8AIAA9ACAAKAApACAAPQA%2BACAAewAKACAAIABsAGUAdAAgAGgAbwBnAGUAOgAgAGgAYQBzAHQALgBSAG8AbwB0AAoAfQA%3D
Expected result
lint/correctness/noUnusedImports error should not be triggered.
Code of Conduct
Environment information
What happened?
A
lint/correctness/noUnusedImportserror is always triggered when I define a variable with the same name as an imported type namespace object.Program that triggers the error
https://biomejs.dev/playground/?code=aQBtAHAAbwByAHQAIAB0AHkAcABlACAAKgAgAGEAcwAgAGgAYQBzAHQAIABmAHIAbwBtACAAIgBoAGEAcwB0ACIACgAKAGMAbwBuAHMAdAAgAF8AIAA9ACAAKAApACAAPQA%2BACAAewAKACAAIABsAGUAdAAgAGgAYQBzAHQAOgAgAGgAYQBzAHQALgBSAG8AbwB0AAoAfQA%3D
Program that does not trigger the error
This just changes the variable name to
hogefromhast.https://biomejs.dev/playground/?code=aQBtAHAAbwByAHQAIAB0AHkAcABlACAAKgAgAGEAcwAgAGgAYQBzAHQAIABmAHIAbwBtACAAIgBoAGEAcwB0ACIACgAKAGMAbwBuAHMAdAAgAF8AIAA9ACAAKAApACAAPQA%2BACAAewAKACAAIABsAGUAdAAgAGgAbwBnAGUAOgAgAGgAYQBzAHQALgBSAG8AbwB0AAoAfQA%3D
Expected result
lint/correctness/noUnusedImportserror should not be triggered.Code of Conduct