I'm trying to use gulp-notify when my ESlint task detect errors, but I can't make it work, since gulp-notify needs to be referenced with a pipe after some Node.js stream.
I can "make it work" partially with the following code:
return gulp.src([config.js.all, '!app/assets/scripts/vendor/**'])
.pipe(eslint())
.pipe(plumber())
.pipe(eslint.format())
.pipe(notify('Error!!!'))
.pipe(eslint.failAfterError());
However that throws the message always, not only when I have errors.
I can get the errors in gulp-eslint using the following syntax:
return gulp.src([config.js.all, '!app/assets/scripts/vendor/**'])
.pipe(eslint())
.pipe(plumber())
.pipe(eslint.format())
.pipe(notify('Error!!!'))
.pipe(eslint.result(function (result) {
if(result.errorCount > 0){
console.log('Error');
}
}))
.pipe(eslint.failAfterError());
That returns me the console.log when there are errors, what I need is to make gulp-notify to send a notification inside the above code. Could someone help me?