Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
build: add a gulp lint task
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb authored and IgorMinar committed Oct 4, 2016
1 parent 16be7f9 commit 2cad6b3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
22 changes: 17 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@
var gulp = require('gulp');
var rollup = require('gulp-rollup');
var rename = require("gulp-rename");
var gutil = require("gulp-util");
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var pump = require('pump');
var uglify = require('gulp-uglify');
var path = require('path');
var spawn = require('child_process').spawn;


var distFolder = './dist';

function generateScript(inFile, outFile, minify, callback) {
inFile = path.join('./build-esm/', inFile).replace(/\.ts$/, '.js');
var parts = [
Expand Down Expand Up @@ -172,10 +168,26 @@ gulp.task('test/node', ['compile'], function(cb) {
});
jrunner.print = function(value) {
process.stdout.write(value);
}
};
jrunner.addReporter(new JasmineRunner.ConsoleReporter(jrunner));
jrunner.projectBaseDir = __dirname;
jrunner.specDir = '';
jrunner.addSpecFiles(specFiles);
jrunner.execute();
});

// Check the coding standards and programming errors
gulp.task('lint', () => {
const tslint = require('gulp-tslint');
// Built-in rules are at
// https://github.com/palantir/tslint#supported-rules
const tslintConfig = require('./tslint.json');

return gulp.src(['lib/**/*.ts', 'test/**/*.ts'])
.pipe(tslint({
tslint: require('tslint').default,
configuration: tslintConfig,
formatter: 'prose',
}))
.pipe(tslint.report({emitError: true}));
});
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"test": "test"
},
"scripts": {
"prepublish": "./node_modules/.bin/tsc && gulp build",
"prepublish": "tsc && gulp build",
"ws-server": "node ./test/ws-server.js",
"tsc": "./node_modules/.bin/tsc",
"tsc:w": "./node_modules/.bin/tsc -w",
"tsc": "tsc",
"tsc:w": "tsc -w",
"test": "npm run tsc && concurrently \"npm run tsc:w\" \"npm run ws-server\" \"karma start karma.conf.js\"",
"test-node": "./node_modules/.bin/gulp test/node",
"test-node": "gulp test/node",
"serve": "python -m SimpleHTTPServer 8000"
},
"repository": {
Expand All @@ -38,11 +38,11 @@
"@types/systemjs": "^0.19.30",
"concurrently": "^2.2.0",
"es6-promise": "^3.0.2",
"whatwg-fetch": "^1.0.0",
"gulp": "^3.8.11",
"gulp-rename": "^1.2.2",
"gulp-rollup": "^2.3.0",
"gulp-tsc": "^1.1.4",
"gulp-tslint": "^6.1.2",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.7",
"jasmine": "^2.4.1",
Expand All @@ -58,6 +58,8 @@
"pump": "^1.0.1",
"systemjs": "^0.19.37",
"ts-loader": "^0.6.0",
"typescript": "^2.0.2"
"tslint": "^3.15.1",
"typescript": "^2.0.2",
"whatwg-fetch": "^1.0.0"
}
}
7 changes: 7 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"rules": {
"no-duplicate-variable": true,
"semicolon": true,
"variable-name": [true, "ban-keywords"]
}
}

0 comments on commit 2cad6b3

Please sign in to comment.