-
-
Notifications
You must be signed in to change notification settings - Fork 650
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
class Price {
// lint/nursery/useReadonlyClassProperties will say this should be readonly, even though it is written to
#price: string;
@Input()
set some(value: string | number) {
if (value === undefined || value === null || value === 'undefined' || value === 'null' || Number.isNaN(value)) {
this.#price = '';
} else {
this.#price = '' + value;
}
}
Rule name
useReadonlyClassProperties
Playground link
Expected result
Biome does not recognize the write access via the set some(..) accessor, the value will be set readonly via a unsafe fix which breaks the code.
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