Javascript lint – saviour of mortal developers

Something I really, really love at the moment is a little application called javascript lint.

It’s a javascript syntax checker that’s built on top of the Mozilla javascript engine. You can run it over a javascript include file (I don’t know if it’ll work on inline javascript) and it’ll syntax check it for you without you having to go to the browser (avoiding the productivity halting “do you want to debug?” VS2005/IE7 error that stops you doing anything until you restart the whole web application).

It works really well with VS2005 too. You can set it up to be an extra command in the tools menu and it will give you a list of error messages for the current file. You can then double click on any error message and it will go right to the line that’s giving you the problem. It also gives you a position in the file, the actual line of code and a (so far) much more helpful error message than “null is not an object”.

You can also set it up to give you warnings about a heap of different shady javascript practices. You just set up a configuration file saying which ones you want and which ones you don’t and off it goes to analyze your code.

If you are perfect and never get syntax errors in your javascript code then this tool won’t really be that helpful. If you are mortal it’s a lot less frustrating than trying to hunt down subtle syntax errors (or things caused by common javascript dodginess) than the IE error messages that don’t even tell you the right line that the syntax error is on.

(I love it! I love it! I love it! I also hope one day javascript will be a full citizen by default in Microsoft development tools)

Posted on 05 Feb 07 by Helen Emerson (last updated on 05 Feb 07).
Filed under Javascript, Tools, Web development