Normally, when editing JavaScript on emacs, I use flycheck with jshint to check for syntax errors. So I have jshint installed globally, and the following command in the .emacs
file to use flycheck in js-mode:
(require 'flycheck)
(add-hook 'js-mode-hook
(lambda () (flycheck-mode t)))
But I also contribute to a project where they use eslint to define syntax rules. I have a .dir-locals.el
file in that project folder, which at the moment only defines the required tabulation:
((nil . ((tab-width . 4)
(js-indent-level . 4)))
(js-mode . ((tab-width . 4)
(js-indent-level . 4)))
(html-mode . ((tab-width . 4)
(sgml-basic-offset . 4))))
Is it possible, perhaps with the help of .dir-locals.el
file, to tell emacs to use flycheck with eslint in this particular project folder while keep using flycheck with jshint in the rest of the projects? I've heard the following lines should do the trick for switching from jshint to eslint, but am not entirely sure where to add them:
(setq flycheck-disabled-checkers '(javascript-jshint))
(setq flycheck-checkers '(javascript-eslint))
(As you can guess, I am not at all good with setting up emacs, so I will be very grateful for specific instructions.)