Commit 88f36cbd by David Kaltschmidt

Compile TS of the whole project to detect type errors

- was not covered by TS lint
- TS errors are only noticed in broken builds
- added grunt task to run `tsc --noEmit`
parent 31b8bf2d
// Lint and build CSS // Lint and build CSS
module.exports = function(grunt) { module.exports = function (grunt) {
'use strict'; 'use strict';
grunt.registerTask('default', [ grunt.registerTask('default', [
...@@ -18,15 +18,16 @@ module.exports = function(grunt) { ...@@ -18,15 +18,16 @@ module.exports = function(grunt) {
grunt.registerTask('precommit', [ grunt.registerTask('precommit', [
'sasslint', 'sasslint',
'exec:tslint', 'exec:tslint',
'exec:tsc',
'no-only-tests' 'no-only-tests'
]); ]);
grunt.registerTask('no-only-tests', function() { grunt.registerTask('no-only-tests', function () {
var files = grunt.file.expand('public/**/*_specs\.ts', 'public/**/*_specs\.js'); var files = grunt.file.expand('public/**/*_specs\.ts', 'public/**/*_specs\.js');
files.forEach(function(spec) { files.forEach(function (spec) {
var rows = grunt.file.read(spec).split('\n'); var rows = grunt.file.read(spec).split('\n');
rows.forEach(function(row) { rows.forEach(function (row) {
if (row.indexOf('.only(') > 0) { if (row.indexOf('.only(') > 0) {
grunt.log.errorlns(row); grunt.log.errorlns(row);
grunt.fail.warn('found only statement in test: ' + spec) grunt.fail.warn('found only statement in test: ' + spec)
......
module.exports = function(config, grunt) { module.exports = function (config, grunt) {
'use strict'; 'use strict';
return { return {
tslint: 'node ./node_modules/tslint/lib/tslintCli.js -c tslint.json --project ./tsconfig.json', tslint: 'node ./node_modules/tslint/lib/tslintCli.js -c tslint.json --project ./tsconfig.json',
tsc: 'yarn tsc --noEmit',
jest: 'node ./node_modules/jest-cli/bin/jest.js --maxWorkers 2', jest: 'node ./node_modules/jest-cli/bin/jest.js --maxWorkers 2',
webpack: 'node ./node_modules/webpack/bin/webpack.js --config scripts/webpack/webpack.prod.js', webpack: 'node ./node_modules/webpack/bin/webpack.js --config scripts/webpack/webpack.prod.js',
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment