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
JS_RUNTIME_VERSION: v22.18.0
JS_RUNTIME_NAME: node
NODE_PACKAGE_MANAGER: unset
Biome Configuration:
Status: Not set
Path: unset
Workspace:
Open Documents: 0
If a function or a class member is accessed only from the constructor, it is incorrectly marked as unused. In the following code block the usedMember and usedFunction are marked as 'unused' although they are accessed from the constructor.
export class ClassWithMembersUsedOnlyFromConstructor {
private usedMember: string
private otherMember: string
constructor() {
this.usedMember = ""
this.usedFunction(this.usedMember);
}
private usedFunction(param: string) {
console.log(param)
}
public alsoUsedFunction(): string {
return this.otherMember;
}
}
No lint errors should be reported.
Environment information
What happened?
If a function or a class member is accessed only from the constructor, it is incorrectly marked as unused. In the following code block the
usedMemberandusedFunctionare marked as 'unused' although they are accessed from the constructor.https://biomejs.dev/playground/?code=ZQB4AHAAbwByAHQAIABjAGwAYQBzAHMAIABDAGwAYQBzAHMAVwBpAHQAaABNAGUAbQBiAGUAcgBzAFUAcwBlAGQATwBuAGwAeQBGAHIAbwBtAEMAbwBuAHMAdAByAHUAYwB0AG8AcgAgAHsACgAgACAAcAByAGkAdgBhAHQAZQAgAHUAcwBlAGQATQBlAG0AYgBlAHIAOgAgAHMAdAByAGkAbgBnAAoAIAAgAHAAcgBpAHYAYQB0AGUAIABvAHQAaABlAHIATQBlAG0AYgBlAHIAOgAgAHMAdAByAGkAbgBnAAoACgAgACAAYwBvAG4AcwB0AHIAdQBjAHQAbwByACgAKQAgAHsACgAgACAAIAAgAHQAaABpAHMALgB1AHMAZQBkAE0AZQBtAGIAZQByACAAPQAgACIAIgAKACAAIAAgACAAdABoAGkAcwAuAHUAcwBlAGQARgB1AG4AYwB0AGkAbwBuACgAdABoAGkAcwAuAHUAcwBlAGQATQBlAG0AYgBlAHIAKQA7AAoAIAAgAH0ACgAKACAAIABwAHIAaQB2AGEAdABlACAAdQBzAGUAZABGAHUAbgBjAHQAaQBvAG4AKABwAGEAcgBhAG0AOgAgAHMAdAByAGkAbgBnACkAIAB7AAoAIAAgACAAIABjAG8AbgBzAG8AbABlAC4AbABvAGcAKABwAGEAcgBhAG0AKQAKACAAIAB9AAoACgAgACAAcAB1AGIAbABpAGMAIABhAGwAcwBvAFUAcwBlAGQARgB1AG4AYwB0AGkAbwBuACgAKQA6ACAAcwB0AHIAaQBuAGcAIAB7AAoAIAAgACAAIAByAGUAdAB1AHIAbgAgAHQAaABpAHMALgBvAHQAaABlAHIATQBlAG0AYgBlAHIAOwAKACAAIAB9AAoAfQAKAA%3D%3D
Expected result
No lint errors should be reported.
Code of Conduct