This commit is contained in:
Peng Lyu 2021-11-26 20:28:05 +01:00 committed by GitHub
commit d1e8f2b113
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -132,6 +132,22 @@ function hygiene(some, linting = true) {
);
});
const consoleLog = es.through(function (file) {
const lines = file.__lines;
for (let i = 0; i < lines.length; i++) {
if (/^\s*console\.log/.test(lines[i])) {
console.error(
file.relative + '(' + (i + 1) + ',1): Stray console.log'
);
errorCount++;
break;
}
}
this.emit('data', file);
});
let input;
if (Array.isArray(some) || typeof some === 'string' || !some) {
@ -159,7 +175,9 @@ function hygiene(some, linting = true) {
.pipe(filter(indentationFilter))
.pipe(indentation)
.pipe(filter(copyrightFilter))
.pipe(copyrights);
.pipe(copyrights)
.pipe(filter(tsHygieneFilter))
.pipe(consoleLog);
const streams = [
result.pipe(filter(tsHygieneFilter)).pipe(formatting)