Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 951 Bytes

no-use-ignored-vars.md

File metadata and controls

49 lines (33 loc) · 951 Bytes

Disallow a use of ignored variables (no-use-ignored-vars)

We can specify to ignore unused variables by a name pattern for no-unused-vars rule. But no-unused-vars rule does not notify a use of the ignored variables. A use of ignored variables causes confusing to developers.

This rule disallows a use of the ignored variables.

Rule Details

Examples of incorrect code for this rule:

/*eslint no-use-ignored-vars: "error"*/

let _foo = 0
doSomething(_foo)

function foo(_a) {
    doSomething(_a)
}

Examples of correct code for this rule:

/*eslint no-use-ignored-vars: "error"*/

let _foo = 0

function foo(_a) {
    doSomething()
}

Options

This rule has a string option.

{
    "no-use-ignored-vars": ["error", "^_[a-zA-Z]+$"]
}

The string option is a regular expression of the ignored name pattern. Default is "^_[a-zA-Z]+$".