Force build failure on any JShint Error


#1

Is there a way to define ember-cli build tolerance for JSHint errors?
For example, when JSHint only raises an undefined variable error, the build supposed to fail.
Thanks.


#2

I don’t believe this is yet supported. However, you could throw an exception here instead of a log – which will effectively stop the build.

In any case, this would make for a great pull request to optionally prevent the write when an error occurred.


#3

This is great, thanks. I submitted a PR, but I decided to throw the error in an earlier stage at JSHinter.prototype.processString.


This is because JSHinter.prototype.write is never reached when JSHinter is passed with a custom logError method, which what happens in the tests (to avoid dirty error messages in the tests log).


#4

Hi guys, PR is already merged into broccoli-jshint. Is it possible somehow implement failOnAnyError flag to ember-cli-build.js to enable this feature? Thanks


#5

I modified my ember-cli-build.js in the following way to make use of the new option:

var EmberApp = require('ember-cli/lib/broccoli/ember-app'); var jsHint = require('broccoli-jshint'); jsHint.prototype.failOnAnyError = true;

I admit it feels ugly to have to touch the prototype and am grateful for better suggestions.

EDIT: I just realized this is still gonna pose a problem for environment===‘production’, since jsHint seems to be completely switched off for that environment :confused:


Force build failure on any ESLint Error