Skip to content

Commit 0471a67

Browse files
committed
Run TypeScript on CI
1 parent 9b1ff7b commit 0471a67

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ module.exports = {
3333
'packages/hermione/**',
3434
'**/.hermione.conf.js',
3535
'report-metadata.js',
36-
'security-audit-ci.js'
36+
'security-audit-ci.js',
37+
'tsc-teamcity.js'
3738
],
3839
peerDependencies: true
3940
}],

.teamcity/settings.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,6 +1348,7 @@ object UnitTestsAndBuild : BuildType({
13481348
# Debugging
13491349
npm ls > npm-ls.log || true
13501350
1351+
npm run typecheck-ci
13511352
npm run test-ci
13521353
npm run build
13531354
npm run build-examples

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"serve": "npm --prefix packages/hermione run serve",
4848
"start": "start-storybook -p 9999",
4949
"storybook-debug": "node --inspect-brk node_modules/.bin/start-storybook -p 9999",
50-
"lint:js": "eslint",
50+
"lint:js": "eslint --ext .js,.mjs,.ts,.tsx",
5151
"lint": "npm run lint:js . && npm run stylelint",
5252
"prelint-ci": "echo \"##teamcity[importData type='jslint' path='eslint-report.xml']\"",
5353
"lint-ci": "eslint --format jslint-xml . > eslint-report.xml && npm run stylelint-ci",
@@ -57,6 +57,7 @@
5757
"test-ci": "karma start karma-ci.conf.js",
5858
"test-watch": "karma start karma-watch.conf.js",
5959
"typecheck": "tsc",
60+
"typecheck-ci": "node tsc-teamcity",
6061
"prerelease-ci": "git pull",
6162
"release-ci": "lerna publish --no-verify-access --yes",
6263
"prepublishOnly": "pinst --disable",

tsc-teamcity.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const tsm = require('teamcity-service-messages');
2+
3+
tsm.autoFlowId = false;
4+
5+
const errorFormat = /^(.+)\((\d+),\d+\): error (TS\d+): (.*)+$/m;
6+
const origWrite = process.stdout.write;
7+
const registeredErrorCodes = new Set();
8+
process.stdout.write = function write(error) {
9+
const match = error.match(errorFormat);
10+
if (match != null) {
11+
// eslint-disable-next-line no-unused-vars
12+
const [_, file, line, errorCode, message] = match;
13+
if (!registeredErrorCodes.has(errorCode)) {
14+
tsm.inspectionType({
15+
id: errorCode,
16+
name: errorCode,
17+
category: 'TypeScript errors',
18+
description: 'Errors reported by TypeScript'
19+
});
20+
registeredErrorCodes.add(errorCode);
21+
}
22+
tsm.inspection({typeId: errorCode, file, line, message});
23+
}
24+
return origWrite.apply(this, arguments);
25+
};
26+
process.argv.push('--pretty', 'false');
27+
28+
require('typescript/lib/tsc');

0 commit comments

Comments
 (0)