Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit 675ef72

Browse files
Add types to all non-test files (#291)
PR-URL: #291
1 parent 2733e5c commit 675ef72

17 files changed

+863
-186
lines changed

gulpfile.js

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ const spawn = require('child_process').spawn;
2525
const ts = require('gulp-typescript');
2626
const path = require('path');
2727
const process = require('process');
28+
const tslint = require('gulp-tslint');
29+
const clangFormat = require('clang-format');
30+
const format = require('gulp-clang-format');
2831

2932
const tsconfigPath = path.join(__dirname, 'tsconfig.json');
33+
const tslintPath = path.join(__dirname, 'tslint.json');
3034
const outDir = '.';
3135
const sources = ['src.ts/**/*.ts', 'src.ts/**/*.js'];
3236

@@ -37,6 +41,26 @@ function onError() {
3741
}
3842
}
3943

44+
gulp.task('test.check-format', () => {
45+
return gulp.src(sources)
46+
.pipe(format.checkFormat('file', clangFormat))
47+
.on('warning', onError);
48+
});
49+
50+
gulp.task('format', () => {
51+
return gulp.src(sources, {base: '.'})
52+
.pipe(format.format('file', clangFormat))
53+
.pipe(gulp.dest('.'));
54+
});
55+
56+
gulp.task('test.check-lint', () => {
57+
return gulp.src(sources)
58+
.pipe(tslint(
59+
{configuration: tslintPath, formatter: 'verbose'}))
60+
.pipe(tslint.report())
61+
.on('warning', onError);
62+
});
63+
4064
gulp.task('clean', () => {
4165
return del(['src']);
4266
});
@@ -56,11 +80,25 @@ gulp.task('compile', () => {
5680
]);
5781
});
5882

83+
gulp.task('test.compile', ['compile'], () => {
84+
// TODO: Complete this when the test files have been converted
85+
// to Typescript.
86+
});
87+
5988
gulp.task('test.unit', ['compile'], cb => {
6089
spawn('bash', ['./bin/run-test.sh'], {
6190
stdio : 'inherit'
6291
}).on('close', cb);
6392
});
6493

65-
gulp.task('test', ['test.unit']);
94+
gulp.task('watch', () => {
95+
exitOnError = false;
96+
gulp.start(['test.compile']);
97+
// TODO: also run unit tests in a non-fatal way
98+
return gulp.watch(sources, ['test.compile']);
99+
});
100+
101+
// TODO: Add the test.check-format and test.check-lint tests when the code
102+
// is in a state that is ready to be formatted.
103+
gulp.task('test', ['test.unit']);//, 'test.check-format', 'test.check-lint']);
66104
gulp.task('default', ['compile']);

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,20 @@
2121
"node": ">=4"
2222
},
2323
"devDependencies": {
24+
"@types/acorn": "^4.0.2",
25+
"@types/estree": "0.0.35",
2426
"@types/node": "^7.0.18",
27+
"@types/source-map": "^0.5.0",
2528
"changelog-maker": "^2.2.2",
29+
"clang-format": "^1.0.53",
2630
"closure-npc": "*",
2731
"coveralls": "^2.11.2",
2832
"del": "^2.2.2",
2933
"extend": "^3.0.0",
3034
"gulp": "^3.9.1",
3135
"gulp-clang-format": "^1.0.23",
3236
"gulp-sourcemaps": "^2.6.0",
33-
"gulp-tslint": "^8.0.0",
37+
"gulp-tslint": "^8.1.1",
3438
"gulp-typescript": "^3.1.6",
3539
"istanbul": "^0.4.1",
3640
"jshint": "^2.7.0",
@@ -40,6 +44,7 @@
4044
"proxyquire": "^1.7.11",
4145
"request": "^2.81.0",
4246
"source-map-support": "^0.4.15",
47+
"tslint": "^5.4.3",
4348
"typescript": "^2.3.2"
4449
},
4550
"dependencies": {

src.ts/agent/debug-assert.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ fakeAssert.deepEqual = fakeAssert.deepStrictEqual = fakeAssert.doesNotThrow =
2525
fakeAssert.strictEqual = fakeAssert.throws =
2626
fakeAssert.AssertionError = nop;
2727

28-
export function debugAssert(enableAssertions) {
28+
export function debugAssert(enableAssertions: boolean) {
2929
return enableAssertions ? realAssert : fakeAssert;
3030
};

0 commit comments

Comments
 (0)