eslint: no-unused-vars flags global variables sometimes when it should not

I am getting numerous errors like the following:

  8:4  warning  formatters is defined but never used  no-unused-vars

when “formatters” is a global Object variable defined as follows:

var formatters = {
...
} ;

In my .eslintrc, I have this rule:

"no-unused-vars": [1, {"vars": "local", "args": "none"}], // default: [2, {"vars": "all", "args": "after-used"}]

Shouldn’t the {“vars”: “local”} option cause no error or warning to be output for the global “formatters” variable?

In addition, I have this in my .eslintrc:

"globals": {
    "formatters": true
}

Shouldn’t this also cause the “formatters” variable to be ignored (even if I didn’t have the rule above)?

I am using eslint 0.16.1.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 17 (11 by maintainers)

Commits related to this issue

Most upvoted comments

No problem, I actually was wondering if maybe you were using ESLint through an intermediary. In any event, glad it got fixed.