Skip to content

[naming-convention] Allow underscore prefix for unused parameters #1510

Closed
@glen-84

Description

@glen-84

Repro

{
  "rules": {
    "@typescript-eslint/naming-convention": [
      "error",
      {
        "selector": "default",
        "format": ["strictCamelCase"]
      }
    ]
  }
}
onComplete: (_id, name, responseJson) => {
    // Using name and responseJson, but not id.
}

Expected Result

No error on _id.

Actual Result

Error on _id.

Additional Info

As mentioned here with Brad's response here.

When using the noUnusedParameters compiler option, you have to use an underscore to suppress TypeScript's error. However, this shouldn't be done unless the parameter is actually unused.

Versions

package version
@typescript-eslint/eslint-plugin 2.16.0
@typescript-eslint/parser 2.16.0
TypeScript 3.7.5
ESLint 6.8.0
node 12.14.1
npm 6.13.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions