Add Jslint Checking To Visual Studio

Using the jsLint tools I provided in my previous post you can add simple checking of an active file within Visual Studio. It also allows you to double click on an issue and go to the corresponding line. Here's a step by step guide.

Choose External Tools from the Tools menu

tools menu - external tools


Click Add and enter the values given in the example below just replacing the command path to point to where you downloaded the example files from the previous post. Ticking Use Output window will make the commandline output show in the Visual Studio output window.

add external tool dialog

You should now have a new command available to you from theTools menu called jsLint current file. Open the JavaScript file you want to validate and run this command.

run the test

The results will be sent to the Output window.

jslint output

You can double click on any result and Visual Studio will send you to the offending line.

click and go to line

The final thing you might need to to is add a comment to your JavaScript file to specify any global or predefined variables. You can do this by adding the variables in to a comma separated list like so:

/*global juxtapo,window,console */

Hope this helps