Skip to content

[no-unused-vars] No error for unused class members #965

Closed
@rhalaly

Description

@rhalaly

Repro

{
  "rules": {
        "@typescript-eslint/no-unused-vars": [
            "error",
            {
                "vars": "all",
                "args": "after-used",
                "ignoreRestSiblings": false
            }
        ]
  }
}
class Foo {
   private bar: number= 0;
   private baz: boolean = false;

   public add() {
       this.bar++;
   }

   public decrease() {
       this.bar--;
   }

   private qux() {
       console.log('unused');
   }
}

Expected Result

Error for baz and qux.

Actual Result

No errors

Additional Info

It only catch unused vars inside the functions and args, but not for class members.

Versions

package version
@typescript-eslint/eslint-plugin 2.1.0
@typescript-eslint/parser 2.1.0
TypeScript 3.5.3
ESLint 6.3.0
node 8.11.3
npm 6.11.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginscope analyserIssues that are caused by bugs/incomplete cases in the scope analyser

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions