I'd like to use JSLint, but I am wary of tools that have access to my unfiltered source code. Is there an offline version or is there another similar tool that does "lint
error checking" for JavaScript offline?
Edit: One with a GUI and that shows you a styled list of errors, instead of a command line interface?
If you like the JSLint web interface, you can do File
> Save Page As...
and Save as type:
Web Page, complete
(in Firefox, doing it in Internet Explorer may be slightly different) to a local folder.
I change the name to jslint.htm
to get it under 8.3 with no spaces.
It seems to work when saved locally.
Three things:
JSLint can be run offline with either WSH or Rhino:
http://www.jslint.com/lint.html#try
Edit: In the two years since this question was asked, JSLint has dropped support for Rhino and WSH. I encourage anyone interested in linting their code to also check out JSHint. It's a fork of JSLint which aims to be more flexible than the original, but also happens to support Node, Rhino, and WSH (in addition to browsers, of course).
Yes:
Basically, you just need an embedded JavaScript compiler to run jslint.js
.
There's another JS Linter, called JavaScript Lint, that has both online and downloadable command line versions. I use the downloadable version all time. I've been thinking about integrating it into SVN as part of a hook. I like it better than JSLint because it has more options and seems to detect more things. It can be configured to treat certain identifiers as predefined, for toolkits and the like, which allows it to check for usage of undefined variables, which I'm pretty sure JSLint can't do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With