How to use the failAfterError function from gulp-eslint

Find comprehensive JavaScript gulp-eslint.failAfterError code examples handpicked from public code repositorys.

200
201
202
203
204
205
206
207
208
209
gulp.src(['**/*.js','!node_modules/**'])
    .pipe(eslint())
    .pipe(eslint.failOnError());
```

### eslint.failAfterError()

Stop a task/stream if an ESLint error has been reported for any file, but wait for all of them to be processed first.

```javascript
fork icon122
star icon562
watch icon10

+ 3 other calls in file

49
50
51
52
53
54
55
56
57
58
function jsStart() {
  return src(helpers.trim(`${helpers.source()}/${global.config.js.src}/*.js`))
    .pipe(gulpif(global.config.js.sourcemaps, sourcemaps.init()))
    .pipe(gulpif(global.config.js.lint, eslint(thisEslintConfig)))
    .pipe(gulpif(global.config.js.lint, eslint.format()))
    .pipe(gulpif(global.config.js.lint, eslint.failAfterError()))
    .pipe(gulpif(global.config.js.lint, eslint.result((result) => {
      console.log(`[JS] ESLint complete: ${result.filePath}`);
      console.log(`[JS] Messages: ${result.messages.length}`);
      console.warn(`[JS] Warnings: ${result.warningCount}`);
fork icon3
star icon17
watch icon3

23
24
25
26
27
28
29
30
31
32
src,
print(),
filenameHint({ regExp: /(^|\/)[a-z0-9.-]+\.js$/ }),
eslint(),
eslint.format(),
eslint.failAfterError(),
checkGrep(/console\.log(.(?!noqa$))+$/gm, { message: 'console.log' }),
checkGrep(/debugger$(.(?!noqa$))+$/gm, { message: 'debugger' }),
checkGrep.failOnError(),
src.restore
fork icon3
star icon14
watch icon10

+ 3 other calls in file

116
117
118
119
120
121
122
123
124
125
126
127


gulp.task('lint:scripts', () => {
  return gulp.src(allScriptFiles)
    .pipe(eslint())
    .pipe(eslint.format())
    .pipe(continueOnError ? gutil.noop() : eslint.failAfterError())
})


gulp.task('lint:styles', () => {
  return gulp.src(srcStyleFiles)
fork icon0
star icon0
watch icon1

+ 4 other calls in file