On this page... (hide)
more notes on JSLint and SpiderMonkey with comparisons to Rhino usage
Stack Overflow: questions containing JSLint
See also: jsHint - a fork that has more options to turn things off.
Cory Bennett adapts Bicking at more command line JSLint and via extra Perl, and provides some emacs integration (in the compile-mode); this is the version I’m working with. Has an unfortunate tendency to run well past the end of the file, generate verbose errors.
A lot of the options are settable, but not every online option is available (such as “maxerrors” -- see http://www.jslint.com/webjslint.js for the full super-set.
Cory Bennett’s notes presume the use of Linux; I’m on Windows with Cygwin, where my jslint runs mostly (why? I can’t quite recall -- becuase I could shebang a script named “jslint” without an extension of “.pl”???)
Integrating this into the emacs-sytem, Cygwin isn’t called, so the compilation-mode hook needs to change from just “/path/to/jslint” to “perl /path/to/jslint”
I also added in --laxbreak
note that not all of the errors are recognized by the compilation-mode buffer (see below). But those that do--ah! convenience!!!
;;; make emacs recognize the error format produced by jslint
(set (make-local-variable 'compilation-error-regexp-alist)
'(("^\\([a-zA-Z.0-9_/-]+\\):\\([0-9]+\\):\\([0-9]+\\)" 1 2 3)))
(set (make-local-variable 'compile-command)
(let ((file (file-name-nondirectory buffer-file-name)))
(concat "perl c:/cygwin/bin/jslint " file)))))
;; for resets
my Compile-mode isn’t highlightinh/recognizing all of the error-lines; The regex seems to work just fine when I do a search-forward-regexp - it matches everything, even the non-highlighted items; it’s not particular types of errors -- some are marked, some aren’t.
Also added the below, to get rid of the escapement above (not actually the source of the errors, but so visually distracting that I though they were)
See Spider Monkey notes for build
smjs didn’t exist, and line 73 of
jslint wouldn’t execute without it
so I changed
jslintrun.js line 55 had troubles with null lines???
.jslint (options) file goes into the $HOME directory which in my case is C:/Emacs (since that came before cygwin)