6

I have project with eslint already setup and I would like to use it in Spacemacs. Unfortunately Spacemacs seems to ignore .eslintrc.js file in project root.

enter image description here

enter image description here

I'm on Windows 10 ...

Can anyone help?

Piotr Pasieka
  • 2,063
  • 1
  • 12
  • 14

2 Answers2

7

Spacemacs (and flycheck, the autocompletion plugin that interfaces with eslint) don't look for eslint configs, they delegate that to eslint itself. If you're getting this issue it means eslint itself is erroring out when it tries to load your project config.

Run eslint --print-config . from your project directory and resolve all errors it prints out, and that should fix it.

Benji L.
  • 197
  • 11
  • hmm. Thanks but this is not related with errors in configuration. I can run eslint from terminal and it work correctly. Same with other editors. Only Spacemacs with Flycheck seems to have problem. – Piotr Pasieka Nov 29 '16 at 09:21
  • 1
    Again, the most recent versions of Flycheck don't check for the config file, they run `eslint --print-config` in the current directory, and check the exit code. So if running `eslint --print-config .` in your project directory doesn't report any issues, then not sure what the problem is. – Benji L. Nov 30 '16 at 11:39
  • I just removed all packages and installed them again. And now Flycheck works. :) – Piotr Pasieka Dec 01 '16 at 08:30
6

I'm running a mac setup, this is what worked for me:

assuming you've installed eslint, you can enable syntax checking in your ~/.spacemacs file


Begin by typing SPC f e d and uncommenting syntax-checking

;; spell-checking
syntax-checking
  • resync your config by typing SPC f e R
  • open a javascript file in your project, which should have an .eslintrc in its root
  • type SPC e v

From here you can confirm that javascript-eslint is enabled and that an .eslintrc has been detected for your project.

random-forest-cat
  • 33,652
  • 11
  • 120
  • 99