forked from JetBrains/ring-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsc-teamcity.js
28 lines (25 loc) · 894 Bytes
/
tsc-teamcity.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const tsm = require('teamcity-service-messages');
tsm.autoFlowId = false;
const errorFormat = /^(.+)\((\d+),\d+\): error (TS\d+): (.*)+$/m;
const origWrite = process.stdout.write;
const registeredErrorCodes = new Set();
process.stdout.write = function write(error) {
const match = error.match(errorFormat);
if (match != null) {
// eslint-disable-next-line no-unused-vars
const [_, file, line, errorCode, message] = match;
if (!registeredErrorCodes.has(errorCode)) {
tsm.inspectionType({
id: errorCode,
name: errorCode,
category: 'TypeScript errors',
description: 'Errors reported by TypeScript'
});
registeredErrorCodes.add(errorCode);
}
tsm.inspection({typeId: errorCode, file, line, message});
}
return origWrite.apply(this, arguments);
};
process.argv.push('--pretty', 'false');
require('typescript/lib/tsc');