Function: web-mode-jshint
web-mode-jshint is an interactive and natively compiled function
defined in web-mode.el.
Signature
(web-mode-jshint)
Documentation
Run JSHint on all the JavaScript parts.
Key Bindings
web-mode-map C-c C-j
Source Code
;; Defined in /nix/store/2qgnz1rp30nzfz6w0apx4kdm14if1bbs-emacs-packages-deps/share/emacs/site-lisp/elpa/web-mode-20260831.219/web-mode.el
(defun web-mode-jshint ()
"Run JSHint on all the JavaScript parts."
(interactive)
(let (proc)
(when (buffer-file-name)
(setq proc (start-process
"jshint-proc"
nil
(or (executable-find "jshint") "/usr/local/bin/jshint")
"--extract=auto"
(buffer-file-name)))
(setq web-mode-jshint-errors 0)
(set-process-filter proc
(lambda (_proc output)
(let ((offset 0) overlay pos (old 0) msg)
(remove-overlays (point-min) (point-max) 'font-lock-face 'web-mode-error-face)
(while (string-match
"line \\([[:digit:]]+\\), col \\([[:digit:]]+\\), \\(.+\\)\\.$"
output offset)
(setq web-mode-jshint-errors (1+ web-mode-jshint-errors))
(setq offset (match-end 0))
(setq pos (web-mode-coord-position
(match-string-no-properties 1 output)
(match-string-no-properties 2 output)))
(when (get-text-property pos 'tag-beg)
(setq pos (1- pos)))
(when (not (= pos old))
(setq old pos)
(setq overlay (make-overlay pos (1+ pos)))
(overlay-put overlay 'font-lock-face 'web-mode-error-face)
)
(setq msg (or (overlay-get overlay 'help-echo)
(concat "line="
(match-string-no-properties 1 output)
" column="
(match-string-no-properties 2 output)
)))
(overlay-put overlay 'help-echo
(concat msg " ## " (match-string-no-properties 3 output)))
) ;while
))
)
) ;when
))