Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
raymondfeng opened this issue May 29, 2019 · 0 comments · Fixed by #688
Closed

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

raymondfeng opened this issue May 29, 2019 · 0 comments · Fixed by #688
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin scope analyser Issues that are caused by bugs/incomplete cases in the scope analyser

Comments

@raymondfeng
Copy link

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
@raymondfeng raymondfeng added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels May 29, 2019
@bradzacher bradzacher added bug Something isn't working scope analyser Issues that are caused by bugs/incomplete cases in the scope analyser and removed triage Waiting for team members to take a look labels May 29, 2019
@bradzacher bradzacher added the has pr there is a PR raised to close this label Jul 16, 2019
@bradzacher bradzacher added this to the scope analysis rewrite milestone Apr 6, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin scope analyser Issues that are caused by bugs/incomplete cases in the scope analyser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants