1

I'm having trouble getting flycheck to use the .eslintrc file in the root of the current project, and I'm struggling to find any documentation that will tell me how to configure it to use the appropriate file. This setup was derived from this blogpost

(use-package flycheck
  :ensure t
  :diminish flycheck-mode
  :config
  (global-flycheck-mode)

  (setq-default flycheck-temp-prefix ".")
  ;; disable jshint since we prefer eslint checking
  (setq-default flycheck-disabled-checkers
                (append flycheck-disabled-checkers
                        '(javascript-jshint)))

  (setq flycheck-checkers '(javascript-eslint))
  ;; use eslint with web-mode for jsx files
  (flycheck-add-mode 'javascript-eslint 'web-mode)
  (flycheck-add-mode 'javascript-eslint 'js2-mode)
  (flycheck-add-mode 'javascript-eslint 'js-mode)
  ;; disable json-jsonlist checking for json files
  (setq-default flycheck-disabled-checkers
                (append flycheck-disabled-checkers
                        '(json-jsonlist)))
  )

(provide 'init-flycheck)

do i have to configure my local eslint installation, the javascript-eslint package, or flycheck?

i've also tried using M-x customize-group, but even though I specify the file i.e ~/.eslintrc (yaml) it doesn't apply the rules from config. is there anyway of seeing if it has found the file?

3 Answers 3

3

ESLint silently ignores hidden files. Thus, by setting flycheck-temp-prefix to . you've effectively disabled ESLint, which is why Flycheck shows no errors anymore: It doesn't get any from ESLint.

However, Flycheck 0.25.1 no longer creates temporary files for ESLint (and plenty of other checkers) and passes buffer contents via standard input instead. Hence the issue with mocha should be gone now, and you don't need to change flycheck-temp-prefix anymore.

1

The problem was that I had set the value of flycheck-temp-prefix to "." - this was specifically to hide flycheck files from mocha.

The irony is that mocha sees dot files, and flycheck doesn't...

1
  • 1
    Flycheck saw your file, but eslint swallows all errors in hidden files. However, the latest release of Flycheck (0.25.1 that is) does not create temporary files for eslint anymore. The problem should be gone now.
    – user227
    Commented Nov 27, 2015 at 10:52
0

Try adding this line in your conf

(setq flycheck-eslintrc "~/.eslintrc")

To verify just do C-h v flycheck-eslintrc

1
  • pretty much the same outcome as using M-x customize-group - the value is set, the file exists - permissions are correct - but the rules are not applied. The file itself is yaml, I'm wondering if that is an issue?
    – sunwukung
    Commented Aug 24, 2015 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.