2

I have gulp running a watch. Part of that watch is to fire JSHint whenever I save a javascript file. I was able to get the task to notify the dev when a file fails and keep the watch working. However, I would also like to notify the dev if there was no error so that the developer knows that the lint has been completed.

Right now this is the best I have gotten, but it will run the notify regardless of a pass/fail.

gulp.task('lint', function() {
gulp.src(paths.js)
    .pipe(jshint('.jshintrc'))
    .pipe(jshint.reporter('jshint-stylish'))
    .pipe(jshint.reporter('fail'))
    .on("error", notify.onError({
      title: "JSHint Error",
      message: "<%= error.message %>"
    }))
    .pipe(notify({
      title: 'JSHint',
      message: 'JSHint Completed.'
    }))
});
RiddlerDev
  • 7,370
  • 5
  • 46
  • 62

0 Answers0