On this page... (hide)
JS Lint - javascript error-checker
jslint considered harmful?
backlash
more notes on JSLint and SpiderMonkey with comparisons to Rhino usage
Stack Overflow: questions containing JSLint
Command-line jslint
Ian Bicking’s jslint from the command-line - requires Spider Monkey
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.
EmacsW32 integration
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!!!
(lambda ()
;;; 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
;;(set 'javascript-mode-hook nil)
non-recognized errors
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)
getting it working in CygWin
See Spider Monkey notes for build
then, smjs didn’t exist, and line 73 of jslint wouldn’t execute without it
so I changed
to
Additionally, jslintrun.js line 55 had troubles with null lines???
changed to
Silly notes (things I forget)
c:/cygwin/usr/share/pjslint/jslintrun.js - JavaScript wrapper for fulljslint
c:/cygwin/usr/share/pjslint/fulljslint.js
.jslint (options) file goes into the $HOME directory which in my case is C:/Emacs (since that came before cygwin)
See Also
Spider Monkey
Perl.Command Line Wild Card - Wild.pm was needed for some step in the above, that runs with Perl....
Testing
Unit Testing





