Skip to content

[no-unused-vars] False positive when using decorators #557

Closed
@njdancer

Description

@njdancer

Repro

{
  "rules": {
    "@typescript-eslint/indent": ["error", 2],
    "@typescript-eslint/member-delimiter-style": [
      "warn",
      {
        "multiline": {
          "delimiter": "none",
          "requireLast": true
        },
        "singleline": {
          "delimiter": "semi",
          "requireLast": false
        }
      }
    ],
    "@typescript-eslint/explicit-function-return-type": "off",
    "no-console": "warn"
  }
}
const Decorator = () => {}
const Entity = () => {}

@Decorator(returns => Entity)
class Test {
  public test() {
    return 1 + 1
  }
}
new Test()

Expected Result
Decorator parameter should not create unused var warning

Actual Result
'returns' is defined but never used.

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 1.9.0
@typescript-eslint/parser 1.9.0
TypeScript 3.4.5
ESLint 5.16.0
node 12.3.1
yarn 1.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement: plugin rule optionNew rule option for an existing eslint-plugin rulehas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions