If you write a lot of JavaScript, then you’ll find Matthias Miller’s website

chockfull of useful information. And even better, he’s put together two great

tools.

The first is JavaScript

Lint, a tool that analyzes JavaScript code and reports potential

errors. Mozilla’s SpiderMonkey JavaScript

engine has similar functionality, which you can turn on by typing about:config

as the URL and then searching for javascript.options.strict. However, JavaScript

Lint detects more types of errors and is configurable. To give it a try,

I ran it over the MapBuzz code base and was very impressed by the errors it revealed.

I immediately added it to our automated testing processes (i.e., its spawned

by a rake task

now) and have come to depend on it.

And if that wasn’t enough, Matthias has adopted a second tool, called Drip,

that detects memory leaks in Internet Explorer’s JavaScript engine. Memory

leaks occur in IE because it uses COM based

reference counting to delete objects. Reference counting is

fast, and easy to understand, but does not handle

circular object

references. As you use your website in IE, Drip keeps track of these circular

references. Once you’re done, it prints out a report showing you where the

memory leaks occurred.

Thanks for the great tools Matthias.

Update1 – A few people have pointed out some negative articles aboout JSLint. I’ve never used JSLint so I don’t have any opinions about it. What I’m talking about above is a totally separate project called JavaScript Lint (confusing, isn’t it?). I highly recommend JavaScript Lint, it turned up a number of bugs that I hadn’t caught previously. In addition, it is highly configurable so it’s easy to turn off certains classes of errors. And for the utmost in flexibility, you can annote your code to tell JavaScript Lint to skip certain sections of it.

Update 2 – A couple of people mentioned FireBug and Venkman as invaluable tools. I couldn’t agree more – I posted about Firebug a while back when I first started using it. And Venkman has been an old favorite for years – it was great to see it finally updated to workin Firefox 1.5. Hopefully it will also be quickly updated to work with Firefox 2.0. And if you’re debugging Internet Explorer, Visual Studio provides a good JavaScript debugger as does Microsoft’s free script debugger package.