-
-
Notifications
You must be signed in to change notification settings - Fork 714
Open
Open
Copy link
Labels
A-LinterArea: linterArea: linterL-JavaScriptLanguage: JavaScript and super languagesLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bugStatus: report has been confirmed as a valid bug
Description
Environment information
CLI:
Version: 2.1.4
Color support: true
Platform:
CPU Architecture: aarch64
OS: macos
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: v24.5.0
JS_RUNTIME_NAME: node
NODE_PACKAGE_MANAGER: bun/1.2.19
Biome Configuration:
Status: Loaded successfully
Path: biome.json
Formatter enabled: true
Linter enabled: true
Assist enabled: true
VCS enabled: false
Workspace:
Open Documents: 0
What happened?
Code:
class App {
#persistenceRequest: Promise<boolean> | undefined;
saveData() {
this.#persistenceRequest ??= navigator.storage.persist();
// …
}
}
new App();
This results in a lint/correctness/noUnusedPrivateClassMembers
error claiming that the .#persistenceRequest
is field is unused. However, it is accessed on the line with ??=
to gate a call to a function with side effects.
In fact, the linter will no longer error if you change it to essentially equivalent code:
this.#persistenceRequest = this.#persistenceRequest ?? navigator.storage.persist();
Expected result
No error.
Code of Conduct
- I agree to follow Biome's Code of Conduct
Metadata
Metadata
Assignees
Labels
A-LinterArea: linterArea: linterL-JavaScriptLanguage: JavaScript and super languagesLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bugStatus: report has been confirmed as a valid bug