noUnusedPrivateClassMembers
Este conteúdo não está disponível em sua língua ainda.
Diagnostic Category: lint/correctness/noUnusedPrivateClassMembers
Since: v1.3.3
Sources:
- Same as:
no-unused-private-class-members
Disallow unused private class members
Private class members that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such class members take up space in the code and can lead to confusion by readers.
Examples
Section titled ExamplesInvalid
Section titled Invalidcode-block.js:2:3 lint/correctness/noUnusedPrivateClassMembers FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ This private class member is defined but never used.
1 │ class OnlyWrite {
> 2 │ #usedOnlyInWrite = 5;
│ ^^^^^^^^^^^^^^^^
3 │
4 │ method() {
ℹ Unsafe fix: Remove unused declaration.
1 1 │ class OnlyWrite {
2 │ - ··#usedOnlyInWrite·=·5;
3 2 │
4 3 │ method() {
code-block.ts:2:12 lint/correctness/noUnusedPrivateClassMembers FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ This private class member is defined but never used.
1 │ class TsBioo {
> 2 │ private unusedProperty = 5;
│ ^^^^^^^^^^^^^^
3 │ }
4 │
ℹ Unsafe fix: Remove unused declaration.
1 1 │ class TsBioo {
2 │ - ···private·unusedProperty·=·5;
3 2 │ }
4 3 │
code-block.ts:2:12 lint/correctness/noUnusedPrivateClassMembers FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ This private class member is defined but never used.
1 │ class TsBioo {
> 2 │ private unusedMethod() {}
│ ^^^^^^^^^^^^
3 │ }
4 │
ℹ Unsafe fix: Remove unused declaration.
1 1 │ class TsBioo {
2 │ - ···private·unusedMethod()·{}
3 2 │ }
4 3 │