Post Conference Friday Toolchain
Today at work I put to use a lot of the stuff that I learned at the conference this week. The first thing I did was install JSLint Multi. I already use Yahoo! Widgets for the weather and an analog clock, so it wasn’t a big deal to install some widget.
My biggest problem with JSLint is that it’s hassle city to run. Part of that had to do with my own lack of knowledge about how to use it. So this tool will basically run JSLint on a bunch of files, just drag files and folders into the widget and it will automatically watch them. Whenever a file changes it will run JSLint on the file and if it turns red something was wrong. Just click on the file and it will show the first error for that file. The main thing that you may notice is that it doesn’t know about the Ext namespace. To take care of that put this at the top of files that use Ext:
/*global Ext */
Also, you probably want to configure JSLint Multi so that it tests what you want. For example, by default it doesn’t allow ++ or – because that could be “too clever.” I’m a programmer. So are my colleagues. We know what ++ and – does. Disallowing ++ and – seems totally dumb. So I tweaked a bunch of stuff so that it matches more what we do.
match Error /,\_s*[)\]}]\|[:,]\[^ ]\|[^0-9]\.[0-9]\+\|=\@!===\@!\|!==\@!/
That will highlight trailing commas, numbers without an initial numeral (.5), ==, !=, and some spacing issues like foo:‘bar’ or (‘foo’,‘bar’). It gives some false positives, but for now it’s helpful. I hope to tweak it some more so that it doesn’t look at strings or whatever.