Closed westmark closed 9 years ago
It would be easily fixed by duplicating your jshint task. Use a jshint-ci task that fails for continuous integration setups and use the normal jshint task for watch events.
@westmark This seems more like an issues with jshint than this plugin. jshint should know about non-fatal rules in your jshintrc
At the moment I have configured jshint do overlook debugger statements during watch events and that is working fine. However, the key here is that I would still like to see the "forgotten debugger" warnings in the gulp output, but if I remove the exception the fail reporter will fail the build. So no, I don't think it is an issue with jshint, and @janhoogeveen's suggestion would not solve my particular problem either.
Think of it this way: I want jshint to report debugger warnings, and I want the stylish reporter to react to debugger warnings, but I don't want the fail reporter to do so. Does this make sense at all? :)
@westmark You can write your own stuff for this, it seems too specific to generalize into something.
Option 1:
Write a quick stream that removes debugger errors from file.jshint
jsFiles
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(removeDebuggerErrors())
.pipe(jshint.reporter('fail'))
Option 2:
Use gulp-if to only pass files without debugger errors to the fail reporter
jsFiles
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(gif(hasNoDebugErrors, jshint.reporter('fail'))
Thanks for the tip @contra. That does indeed look like a better solution.
While watching files during development, it would be useful to see jshint errors for forgotten debugger statements, while still allowing the build to continue. I propose that the fail reporter should accept a list of error codes to disregard. This list could easily be adjusted programmatically depending on the nature of the build.