Skip to content

💅 useReadonlyClassProperties with class expressions #10039

@gardinbe

Description

@gardinbe

Environment information

useReadonlyClassProperties fails to detect private properties within class expressions as having never been reassigned.

Please see the playground link below, as that should be a minimal reproduction.

Rule name

style.useReadonlyClassProperties

Playground link

https://biomejs.dev/playground/?lineWidth=120&indentStyle=space&lintRules=useReadonlyClassProperties&analyzerFixMode=safeAndUnsafeFixes&tab=formatter&pane=Diagnostics&code=YwBsAGEAcwBzACAATgBvAHIAbQBhAGwAQwBsAGEAcwBzACAAewAKACAAIAAjAHAAcgBvAHAAIAA9ACAAMQAyADMAOwAgAC8ALwAgAHAAaQBjAGsAZQBkACAAdQBwACAAYwBvAHIAcgBlAGMAdABsAHkACgAKACAAIABjAG8AbgBzAHQAcgB1AGMAdABvAHIAKAApACAAewAKACAAIAAgACAAYwBvAG4AcwBvAGwAZQAuAGwAbwBnACgAdABoAGkAcwAuACMAcAByAG8AcAApADsACgAgACAAfQAKAH0ACgAKAAoAYwBvAG4AcwB0ACAAQQBuAG8AbgBDAGwAYQBzAHMAIAA9ACAAYwBsAGEAcwBzACAAewAKACAAIAAjAHAAcgBvAHAAIAA9ACAAMQAyADMAOwAgAC8ALwAgAG4AbwB0ACAAcgBlAGMAbwBnAG4AaQB6AGUAZAAKAAoAIAAgAGMAbwBuAHMAdAByAHUAYwB0AG8AcgAoACkAIAB7AAoAIAAgACAAIABjAG8AbgBzAG8AbABlAC4AbABvAGcAKAB0AGgAaQBzAC4AIwBwAHIAbwBwACkAOwAKACAAIAB9AAoAfQAKAAoA

Expected result

useReadonlyClassProperties fails to detect private properties within class expressions as having never been reassigned when it should be able to.

This applies to both ts private fields, and private fields using the # symbol.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LinterArea: linterL-JavaScriptLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions