We're using gulp-tslint in our project which has around 200+ .ts files.
Works like it should 👍 although we've never used type-checking rules of tslint.
However, recently I wanted to give them a try and enable type-checking rules by passing program option in addition to configuration like this:
gulp.task('tslint:app', () => {
let configuration = 'tslint.json';
let program = tslint.Linter.createProgram('tsconfig.json');
return gulp
.src(['./app/**/*.ts'], { base: '.' })
.pipe(gulpTslint({
formatter: 'stylish',
program,
configuration
}))
.pipe(gulpTslint.report());
});
And here I noticed how a bit slower it checks each file than tslint CLI.
I saw that map(...) part in index.ts includes creating instance of tslint.Linter for each and every file.
Perhaps, it'd be better having only once instance of tslint.Linter defined outside of map loop?
I just compared it to the code in tslint itself (runner.ts processFiles which is called from CLI) and it also has only once instance of linter.
I believe downside to that will be that the only thing that needs to be added inside the loop before cb(...) is: tslint.failures = []; tslint.fixes = []; so that failures will not be carried over to the next file.
What do you think? Is it worth creating a PR for that?
Hi,
We're using gulp-tslint in our project which has around 200+ .ts files. Works like it should 👍 although we've never used type-checking rules of tslint.
However, recently I wanted to give them a try and enable type-checking rules by passing
program
option in addition toconfiguration
like this:And here I noticed how a bit slower it checks each file than tslint CLI. I saw that
map(...)
part in index.ts includes creating instance of tslint.Linter for each and every file. Perhaps, it'd be better having only once instance of tslint.Linter defined outside of map loop? I just compared it to the code in tslint itself (runner.tsprocessFiles
which is called from CLI) and it also has only once instance of linter.I believe downside to that will be that the only thing that needs to be added inside the loop before
cb(...)
is:tslint.failures = []; tslint.fixes = [];
so that failures will not be carried over to the next file.What do you think? Is it worth creating a PR for that?