Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Open
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Playground Link
Repro Code
classTest1{// should not reportprivateprop=7;foo(){this['prop']=10;}}classTest2{// should reportprivate[Symbol.iterator]=7;}classTest3{// should not reportprivate'prop'=7;foo(){this.prop=10;}}classTest4{// should report?private[1]=7;}
ESLint Config
module.exports={parser:"@typescript-eslint/parser",rules:{"@typescript-eslint/prefer-readonly":"error",},};
tsconfig
{"compilerOptions": {"strictNullChecks":true }}Expected Result
I expected the rule not to report the first example and third examples and to report on the second and forth examples.
Actual Result
The rule reports on the first example, with the auto-fixer creating a type error:Cannot assign to 'prop' because it is a read-only property..
The second example should be reported but is missed.
The third example should not be reported, and also creates a type error once auto-fixed.
The forth example (I think) should be reported but it's missed.
Additional Info
I think this is very similar to#10211, and I noticed this while working on#10552. I think at least some of these can be tackled withgetStaticMemberAccessValue.