Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting JSLint to break a build in visual studio 2010

I have integrated JSLint (http://javascriptlint.com) into my projects post build - but can't seem to get it to fail the build if an error/warning occurs?

Currently JSLint is ran from a .bat file that gets executed on post-build

Is there a param I can pass in to tell JSLint to fail the build if error/warning is encountered?

Thanks in advance folks

like image 561
Dave Lister Avatar asked Oct 17 '11 13:10

Dave Lister


1 Answers

The JSLint extension for VS2010 has an option to automatically display JSLint warnings in the error list. In addition, you can run JSLint on build and cancel the build if a rule is violated.

Or, if you would like to continue running JSLint through a batch script, you could force MSBuild to raise an error depending on the return exit code of the script:

<Target Name="AfterBuild">
    <Exec Command="jslint.bat" ContinueOnError="true">
        <Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
    </Exec>

    <Error Text="Error running JSLint" Condition="'$(ErrorCode)'>'0'" />
</Target>
like image 108
Justin Rusbatch Avatar answered Sep 24 '22 10:09

Justin Rusbatch