Technology is supposed to be fun ...

jslint from the terminal

Posted: November 29th, 2007 | Author: | Filed under: .bash_history, All, Javascript, Tips and Tricks | Tags: , | 1 Comment »

Once you get into the habit of using jslint it’s hard not to, it’s just so satisfying when it passes and all the lint has been cleared away. The first few times I used I went to the web application and pasted the file in there and looked at the results, fixed what was wrong and pasted it back into the original file. This is especially inconvenient if you use vim or emacs since pasting from an external environment has always been a bit of a challenge. But fear not, Douglas Crowford, best known for his work on the json spec, has an extended version that works with rhino the java javascript interpreter. The advantage of using jslint through rhino is that you can inspect your javascript files from the terminal. Installing it on a mac is trivial just follow Peters Michaux Install instructions

Here is the short version:


$> curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_6R7.zip
$> unzip rhino1_6R7.zip
$> cp rhino1_6R7/js.jar /Library/java/Extensions/

Download the jslint file


$> curl -O http://www.jslint.com/rhino/jslint.js

And then you should be able to:


$> java org.mozilla.javascript.tools.shell.Main jslint.js your_program.js


One Comment on “jslint from the terminal”

  1. 1 allskonar » Blog Archive » JSlint for Your Big Projcect said at 1:59 am on January 30th, 2011:

    [...] many years ago, I was pretty pumped up about having found a decent way to run JSlint on the command line instead of having to either paste it into the jslint website or even run it through an IDE. That approach [...]