diff --git a/git_hooks/pre-commit b/git_hooks/pre-commit new file mode 100755 index 0000000..b43b99c --- /dev/null +++ b/git_hooks/pre-commit @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +git_root=$(git rev-parse --show-toplevel) +PATH=${PATH}:${git_root}/bin ${git_root}/bin/gulp strict + diff --git a/gulpfile.js b/gulpfile.js index f78379c..798a8e1 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -75,6 +75,11 @@ gulp.task('tslint', function () { emitError: false })); }); +gulp.task('tslintstrict', function () { + return gulp.src(['src/scripts/game/**/*.ts', 'src/scripts/view/**/*.ts']) + .pipe(tslint()) + .pipe(tslint.report('verbose')); +}); gulp.task('processhtml', function () { return gulp.src(paths.index) @@ -121,7 +126,7 @@ gulp.task('minifyCss', ['less'], function () { gulp.task('deploy', function () { return gulp.src('./dist/**/*') .pipe(deploy({ - remoteUrl: "git@github.com:thunderk/spacetac.git", + remoteUrl: "git@github.com:thunderk/spacetac.git" })); }); @@ -131,3 +136,6 @@ gulp.task('default', function () { gulp.task('build', function () { return runSequence('clean', ['typescript', 'tslint', 'less', 'copy', 'minifyJs', 'minifyCss', 'processhtml']); }); +gulp.task('strict', function () { + return runSequence('clean', ['typescript', 'tslintstrict', 'tests']); +}); diff --git a/src/scripts/game/Battle.ts b/src/scripts/game/Battle.ts index 146e463..e026681 100644 --- a/src/scripts/game/Battle.ts +++ b/src/scripts/game/Battle.ts @@ -92,11 +92,11 @@ module SpaceTac.Game { var alive_fleets = this.countAliveFleets(); - if (alive_fleets == 0) { + if (alive_fleets === 0) { // It's a draw this.ended = true; this.log.add(new EndBattleEvent(null)); - } else if (alive_fleets == 1) { + } else if (alive_fleets === 1) { // We have a winner var winner: Player = null; this.fleets.forEach((fleet: Fleet) => { diff --git a/src/scripts/game/specs/Battle.spec.ts b/src/scripts/game/specs/Battle.spec.ts index 480f725..4fcc58d 100644 --- a/src/scripts/game/specs/Battle.spec.ts +++ b/src/scripts/game/specs/Battle.spec.ts @@ -153,7 +153,7 @@ module SpaceTac.Game { var ship1 = new Ship(fleet1, "F1S1"); var ship2 = new Ship(fleet1, "F1S2"); - var ship3 = new Ship(fleet2, "F2S1"); + new Ship(fleet2, "F2S1"); var battle = new Battle(fleet1, fleet2);