我正在用 gulp 尝试 eslint。我已经设置了这样的任务:
gulp.task('lint', function () {
return gulp.src([
'components/myjs.js'
])
// eslint() attaches the lint output to the eslint property
// of the file object so it can be used by other modules.
.pipe(eslint())
// eslint.format() outputs the lint results to the console.
// Alternatively use eslint.formatEach() (see Docs).
.pipe(eslint.format())
// To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failOnError last.
.pipe(eslint.failOnError());
});
当我运行gulp lint
它告诉我很多错误。现在我正在尝试一一修复它们。但是我必须手动重新运行gulp lint
它才能给我一个更新的报告。如何设置它以便每次更新时它都会自动重新运行'components/myjs.js'
?