-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
What rule do you want to change?
no-unused-vars
(arguably this could be a separate rule as well, something like no-unused-private-fields
)
Does this change cause the rule to produce more or fewer warnings?
More
How will the change be implemented? (New option, new default behavior, etc.)?
New default behavior
Please provide some example code that this change will affect:
class MyClass {
#unusedField = 5;
#usedFieldOnlyInWrite = 42;
#usedWhenReadingAndWriting = 500;
someMethod() {
this.#usedFieldOnlyInWrite = 42;
this.#usedWhenReadingAndWriting += 1;
}
someOtherMethod() {
return this.#usedWhenReadingAndWriting;
}
}
What does the rule currently do for this code?
Nothing
What will the rule do after it's changed?
Report unused fields declared in a class. In the above example, it should report that both #unusedField
and #usedFieldOnlyInWrite
are unused. This should be possible, as private fields are only concerned in a particular class context, so you can collect all fields in a class, iterate through all usages and mark does that are never read as unused.
Are you willing to submit a pull request to implement this change?
I would be able to give it a go, but I am not sure how difficult this would be.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status