-
Notifications
You must be signed in to change notification settings - Fork 3
/
flymake-jslint.el
35 lines (28 loc) · 1 KB
/
flymake-jslint.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
;; use V8 Javascript to run JSLint for flymake
(require 'flymake)
(defcustom jslint-v8-shell "/usr/local/bin/v8"
"Javascript V8 shell program"
:type 'string
:group 'jslint-v8)
(defcustom jslint-v8-location (concat (getenv "HOME")
"/.emacs.d/jslint-v8")
"Location of jslint-v8"
:type 'string
:group 'jslint-v8)
(defun flymake-jslint-init ()
"Initialize flymake for jslint"
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace)))
(list jslint-v8-shell
(list "-e" (concat "var input_filename = \"" temp-file "\"")
(concat jslint-v8-location "/JSLint/jslint.js")
(concat jslint-v8-location "/v8shell.js")))))
(add-to-list 'flymake-allowed-file-name-masks
'(".+\\.js$"
flymake-jslint-init
flymake-simple-cleanup
flymake-get-real-file-name))
(add-to-list 'flymake-err-line-patterns
'("^Lint at line \\([[:digit:]]+\\) character \\([[:digit:]]+\\): \\(.+\\)$"
nil 1 2 3))
(provide 'flymake-jslint)