const gulp = require('gulp'); const eslint = require('gulp-eslint'); const srcDir = [ 'src/*.js', 'src/**/*.js', ]; function checkSrc() { return gulp.src(srcDir) .pipe(eslint()) .pipe(eslint.format()) .pipe(eslint.failAfterError()); } function watchEslint() { gulp.watch(srcDir, checkSrc); } gulp.task('check:lint', checkSrc); gulp.task('watch:lint', watchEslint); gulp.task('default', gulp.parallel('watch:lint'));