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're in a Java environment, you may find my jslint4java tool useful. It comes in a command line variant, and can also be integrated into an ant script. No GUI, because I suck badly at those. :-)
Since JSLint itself is written in JavaScript, you can run it offline by copying the HTML and referenced JavaScript files locally. IE7's "Save As..." "webpage, complete" feature does this just fine.
It's pretty easy to recreate what Crockford has on JSLint.com. JSLint.com's online version of the .js is a minified conglomeration of a few files that includes some overhead I don't quite understand, like that
ADSAFE
stuff. Let's strip it down to a simplest case wrapper instead.Building your own HTML wrapper for JSLint:
Here's the code to a web page that'll look for jslint.js (the latest version of JSLint can currently be found in github here as raw text) in the same directory and fire away in a similar fashion as JSLint.com does now.
^ From an old blog post of mine.
It's up to the proverbial reader to make the GUI more gooey, but this reports as well as the JSLint site does now.
I have a tool for running JSLint from the command line with either the SpiderMonkey shell or Rhino. It also includes a plugin for Vim that allows you to press a button to automatically highlight any problem lines while editing a file:
http://github.com/hallettj/jslint.vim/
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.