开发者

Getting JSLint to break a build in visual studio 2010

开发者 https://www.devze.com 2023-04-13 08:28 出处:网络
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?

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


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消