我想在VS2017中使用eslint并按照以下说明操作:
当我从" Task Runner Explorer"中调用它时,ESlint似乎有效。通过Gulp VS2017 Window(见下文),但我希望在"错误列表"中有警告和错误。 VS2017窗口。这是怎么做到的?
我承认这通常是默认设置,为什么我很尴尬。
我的Gulp代码:
gulp.task('eslint', function (done) {
gulp.src([
paths.root + 'js/**/*.js',
paths.root + 'Modules/**/js/*.js',
'!' + paths.root + 'js/plugins/**/*.js',
'!' + paths.root + 'js/lib/**/*.js'
])
.pipe(eslint('./.eslintrc.json'))
.pipe(eslint.result(function (result) {
if (result.warningCount > 0 || result.errorCount > 0) {
console.log('ESLint error: ' + result.filePath + ' : ');
console.log(result.messages);
}
}))
.pipe(eslint.failOnError())
.on('end', done)
});
我从任务运行器资源管理器窗口获得的内容:
ESLint error: [FILEPATH] :
[ { ruleId: 'no-unused-vars',
severity: 2,
message: '\'file\' is defined but never used.',
line: 54,
column: 32,
nodeType: 'Identifier',
source: ' removedfile: function (file) {' } ]
Process terminated with code 0.
感谢您的帮助。
塞缪尔