Skip to content

[no-unused-vars] False positive with parameter decorators #571

Closed
@raymondfeng

Description

@raymondfeng

Repro

{
  "rules": {
    "@typescript-eslint/no-unused-vars": [
      "error",
      {
        "vars": "all",
        "args": "none"
      }
    ]
  }
}
// Create a parameter decorator
const log = function(target: Object, method: string, index: number) {
  console.log('decorating %s[%d]', method, index); 
}

class MyService {
  constructor(@log public x: string) {}
}

Expected Result

No violation of unused-vars is reported.

Actual Result

It complains that log is declared but not used.

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 1.4.2
@typescript-eslint/parser 1.4.2
TypeScript 3.4.5
ESLint 5.16.0
node 12.1.0
npm 6.9.0

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