With this article, I wanted to do something completely different from my previous two. If you've read them, you saw that they are detailed descriptions of respective topics – somewhat like guides that arm you with complete knowledge on a subject.
The problem with that is – you leave the reader without something solid. You just can't write "Guide to .NET Reporting" that'll design reports that the reader needs. So, this time, I wanted to provide you with something you can use on a daily basis, without needing to chew on knowledge presented here or tailor it to fit your needs. I wanted to do something short, sweet, and immediately useful.
Here is the JSLint.VS in action on a file:
And, here it is validating a code statement:
Finally, here is JSLint.VS in action when the programmer decides to Build Solution:
JSLint.VS is a pretty standard Visual Studio add-in. I won't go into the basics, so if you lack knowledge about add-ins, you'll probably want to read an article like this to catch on the concepts.
As in any Visual Studio add-in,
Connect is the main class that handles the events of Visual Studio and executes the commands. In this project, it is used to register
OptionsForm is the interface with the user, enabling the configuration of JSLint.VS. You can see it in action in the image below:
To sum up everything said, here is the class diagram showing the main parts of the previously mentioned classes. You can also notice the additional, less important, helper classes – for holding data (
JSLintOptionsItem) and serializing
JSLint options to hard disk (
I left lots of comments in the code, so I'm sure that you'll manage on your own if you are into further extending this add-in. Requesting features through comments that I'll implement for you is always an option.
As said in the introduction, I hope that reading this article enriched your development arsenal with one useful tool. Before leaving you to play with the source code, one final word of warning – as Douglas said in one of his speeches –
JSLint notifications that tell you - your code is crap.
- January 28, 2009 - Bugfixes related to build integration, CodePlex page (thanks to Alexander Turlov & Frederick Staats)
- December 11, 2007 - Updated add-in to support Visual Studio 2008, a few small bug fixes.
- November 25, 2007 - Initial version of the article.