简体   繁体   中英

How to run jshint in emacs web-mode?

As stated on the web-mode.org page, since May 2014 web-mode supports jshint.

I've been using jshint in js-mode , for which purpose I installed flycheck and added the following setting to the .emacs file:

(require 'flycheck)
(add-hook 'js-mode-hook
          (lambda () (flycheck-mode t)))

I would also like to make jshint work in web-mode , but failed to do so. Here's what I tried:

open .js file

Mx web-mode

Mx web-mode-jshint

Mx flycheck

But no luck. Could you please suggest how to make jshint work in emacs's web-mode ?

UPDATE: fxbois pointed out below that the only command that needs to be executed is Mx web-mode-jshint . This works on regular .js files, but does not work on .js.erb files (which are recognized by the regular web-mode ). So the next part of my question is, does anybody know how to make web-mode-jshint work with .js.erb files?

You should only have to execute Mx web-mode-jshint

(of course, jshint should be installed)

I just ran into this in the past 20 minutes and found that web-mode-jshint does not run automatically, use Cc Cj to evaluate the buffer manually. I am still searching for a way to run the evaluation automatically.

(IMO) It is unfortunate that web-mode-jshint does not integrate existing jshint solutions, eg flycheck, but implements its own highlighting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM