Gulp 吞下棉线未在控制台上打印棉线错误

Gulp 吞下棉线未在控制台上打印棉线错误,gulp,tslint,Gulp,Tslint,您好,我正在尝试在angular 2小应用程序上使用gulp运行tslint任务,但它似乎不起作用。以下是我目前的情况: 这是我的gulpFile: const gulp = require('gulp'); const tslint = require('gulp-tslint'); gulp.task('tslint', () => { return gulp.src("app/**/*.ts") .pipe(tslint({ configuration: "

您好,我正在尝试在angular 2小应用程序上使用gulp运行tslint任务,但它似乎不起作用。以下是我目前的情况:

这是我的gulpFile:

const gulp = require('gulp');
const tslint = require('gulp-tslint');

gulp.task('tslint', () => {
    return gulp.src("app/**/*.ts")
        .pipe(tslint({ configuration: "tslint.json" }))
        .pipe(tslint.report('verbose'));
});
为了绝对确保我在tslist.json中设置了以下选项:“max line length”:[true,5]

当我运行此任务时,我得到以下信息:

[10:29:54] Using gulpfile ~\Desktop\InovationWeek\InovationWeek\Gulpfile.js
[10:29:54] Starting 'tslint'...
Process terminated with code 1.
它没有说明它发现了什么样的linting错误,只是进程以代码0终止


我做错了什么?

我遇到了一个类似的问题,tslint在我的配置中遇到了问题,实际上没有执行任何linting

这导致进程使用代码1终止,但没有返回任何linting错误,这似乎与您看到的问题相同

我的解决方案是在gulp中添加一点错误处理:

gulp.task("tslint", function() {
  return gulp.src(config.tsSrc)
    .pipe(tslint({
      formatter: "verbose",
      configuration: "tslint.json"
    }))
    .on('error', printError)
    .pipe(tslint.report());
});

// print the error out
var printError = function(error) {
  console.log(error.toString());
}
这意味着导致tslint无法运行的配置错误被写入控制台,我能够修复我的配置