Skip to content
This repository was archived by the owner on Aug 18, 2021. It is now read-only.
This repository was archived by the owner on Aug 18, 2021. It is now read-only.

babel-eslint not compatible with no-unused-vars: [2, {vars: local}] #136

@kentor

Description

@kentor

Ok I have this setup:

❯ tree -a -I node_modules
.
├── A
│   ├── .eslintrc
│   └── a.js
├── B
│   ├── .eslintrc
│   └── b.js
└── package.json

A/.eslintrc:

---
rules:
  no-unused-vars: [2, {vars: local}]  # Allow defining globals

A/a.js:

var a = 1;

B/.eslintrc:

---
parser: babel-eslint

B/b.js:

var b = 2;

package.json:

{
  "dependencies": {
    "babel-eslint": "^3.1.19",
    "eslint": "^0.24.0",
    "esprima": "^2.4.0",
    "esprima-fb": "^15001.1.0-dev-harmony-fb"
  }
}

Running eslint on dir A and B gives the expected result:

❯ $(npm bin)/eslint A B

B/b.js
  1:4  error  b is defined but never used  no-unused-vars

✖ 1 problem (1 error, 0 warnings)

however, running it on dir B and A gives an additional unexpected error on a.js:

❯ $(npm bin)/eslint B A

B/b.js
  1:4  error  b is defined but never used  no-unused-vars

A/a.js
  1:4  error  a is defined but never used  no-unused-vars

✖ 2 problems (2 errors, 0 warnings)

This only happens when using babel-eslint as the parser for directory B. I've tried the default parser, esprima, and esprima-fb and it does not throw the error for a.js. The result shouldn't change given the order of directories given to eslint right?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions