Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/eslint.ts
4770 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import eventStream from 'event-stream';
7
import vfs from 'vinyl-fs';
8
import { eslintFilter } from './filters.ts';
9
import gulpEslint from './gulp-eslint.ts';
10
11
function eslint(): NodeJS.ReadWriteStream {
12
return vfs
13
.src(Array.from(eslintFilter), { base: '.', follow: true, allowEmpty: true })
14
.pipe(
15
gulpEslint((results) => {
16
if (results.warningCount > 0 || results.errorCount > 0) {
17
throw new Error(`eslint failed with ${results.warningCount + results.errorCount} warnings and/or errors`);
18
}
19
})
20
).pipe(eventStream.through(function () { /* noop, important for the stream to end */ }));
21
}
22
23
if (import.meta.main) {
24
eslint().on('error', (err) => {
25
console.error();
26
console.error(err);
27
process.exit(1);
28
});
29
}
30
31