Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Not working with eslint v2 ? #435

Closed
skratchdot opened this issue Feb 14, 2016 · 10 comments
Closed

Not working with eslint v2 ? #435

skratchdot opened this issue Feb 14, 2016 · 10 comments

Comments

@skratchdot
Copy link

First off, thanks for the great plugin! It's extremely useful/valuable for my day-to-day workflow.

I recently created a new project using gulp-eslint like I have in the past. My gulp lint task works as expected (i.e. running it uses my eslint v2 configuration correctly)- although when I open the project in Atom (version 1.6.0-beta3) using linter-eslint (version 6.0.0), my configuration is not working.

I'm wondering if v2 changed the .eslintrc.js naming convention? Mine now has a .js extension. I've tried with and without the .js extension, as well as changing my linter-eslint configuration settings, but I haven't had any luck.

My .eslintrc.js file looks like:

module.exports = {
  "extends": "standard",
  "plugins": [
      "standard"
  ],
  "rules": {
    "semi": [2, "always"]
  }
};

gulp lint uses that file, and produces no errors (unless I explicitly do something like remove the "semi" rule, or introduce a lint error intentionally.

When I open a file that is being linted correctly by gulp lint in Atom, I see:

ESLint - Error - Fatal - Parsing Error: The keyword 'const' is reserved at line 2 col 1

I am using babel as well, but this has never been a problem in the past. My other eslint Atom projects work correctly, but they are all eslint v1. I only notice issues with this new project that uses eslint v2.

Thanks again.

Logging this bug due to the comments I made in #433

@steelbrain
Copy link
Contributor

linter-eslint has options to use local or global eslint. If you install eslint in your project or globally it'll use that instead of the bundled versions, try that and let us know if it works for you

@skratchdot
Copy link
Author

I always have eslint installed in my local project (i.e. I don't check the "use global" option). Here is my linter-eslint config:

  "linter-eslint":
    disableWhenNoEslintrcFileInPath: true

Have you successfully used eslint v2 in a local project?

@skratchdot
Copy link
Author

confirming that it's installed locally:

$ ./node_modules/.bin/eslint -v
v2.0.0

My local eslint config file:

$ cat ./.eslintrc.js
module.exports = {
  "extends": "standard",
  "plugins": [
      "standard"
  ],
  "rules": {
    "semi": [2, "always"]
  }
};

eslint things install locally:

$ ls ./node_modules/ | grep eslint
eslint
eslint-config-airbnb
eslint-config-standard
eslint-plugin-promise
eslint-plugin-react
eslint-plugin-standard
gulp-eslint

My .babelrc config:

$ cat .babelrc
{"presets": ["es2015", "stage-0", "react"]}

@skratchdot
Copy link
Author

I created a test-eslint.js file:

const foo = 'Hello';
const bar = 'World!'
console.log(`${foo} ${bar}`);

I linted using the locally installed version:

$ ./node_modules/.bin/eslint ./test-eslint.js

/Users/[myusername]/Projects/git/[myprojectname]/test-eslint.js
  2:21  error  Missing semicolon  semi

✖ 1 problem (1 error, 0 warnings)

Which is working the way I intended (only 1 error: a missing semi-colon).

Here's what I'm seeing in Atom v1.6.0-beta3:

Image 1

Image 2

@skratchdot
Copy link
Author

Well, I just restarted Atom, and things are now working. Not sure what's up. I didn't make any changes at all, just restarted Atom. I'm guessing something screwed up when it auto-updated to 1.6.0-beta3.

Sorry for wasting your time.

@steelbrain
Copy link
Contributor

I am glad you got it to work! :)

@skratchdot
Copy link
Author

Yeah, me too! I kinda wish I could've done more debugging before restarting Atom on a whim. I guess it's something to suggest to people if they log an unexplainable bug. It's usually something I try before going to the step of making a Github Issue, but I thought I had already restarted after the Atom upgrade.

Not sure what the deal was, but an Atom restart definitely fixed it. Thanks again!

@steelbrain
Copy link
Contributor

Please note that we've had reports of ESLint caching config untill rebooted in versions <2.x

@skratchdot
Copy link
Author

Yeah... I think I may have read one of the old issues which put the idea in my head to try a restart. Still wish I would've used devtools or something to try to figure it out. Oh well. Something I'll keep in mind if another Atom issue ever pops up...

@skratchdot
Copy link
Author

Thanks again for this invaluable tool!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants