traviblog

just some sort of lame blog

Adding An Easy Shortcut to the JSLint javascript validator to Visual Studio

Update: 2011-05-13: JSLint WSH no longer available, see JSHint WSH.


Ever wish that Visual Studio had a JSLint add-in? Inspired by a reply to my tweet, I discovered the following solution.

  1. Grab the WSH version of JSLint.

  2. Add this jslint.bat file to the same folder you have JSLint in:

    @echo off
    cscript jslint.js //Nologo < %1
    echo.
    echo Done.
  3. In Visual Studio → Tools → External Tools…

  4. Add a new tool with the following field values:

    Title:
    &JSLint
    Command:
    %YourJSLintPath%\jslint.bat
    Arguments:
    $(ItemPath)
    Initial directory:
    %YourJSLintPath%\
    Use Output window
    checked

    VS: External Tools

  5. Open up any *.js file you'd like to validate

  6. Select the all new JSLint from your tools menu:

    VS: Tools Menu

  7. Try not to let JSLint hurt your feelings too much:

    VS: Output From JSLint

In short, JSLint is awesome.

Comments

comments powered by Disqus