From 526784c564e9a405cac6ad9115b17d3d299fa1bb Mon Sep 17 00:00:00 2001 From: Todor Totev Date: Wed, 18 Nov 2015 14:28:24 +0200 Subject: [PATCH] Enable linter for common lib --- Gruntfile.js | 14 +++++++++++++- package.json | 1 + tslint.json | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 tslint.json diff --git a/Gruntfile.js b/Gruntfile.js index 2d47e1fe..82d74a86 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -67,6 +67,17 @@ module.exports = function(grunt) { } }, + tslint: { + build: { + files: { + src: ["**/*.ts", "!node_modules/**/*.ts", "!messages/**/*.ts", "!**/*.d.ts"] + }, + options: { + configuration: grunt.file.readJSON("./tslint.json") + } + } + }, + watch: { devall: { files: ["**/*.ts", "!node_modules/**/*.ts", 'test/**/*.ts'], @@ -121,6 +132,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks("grunt-contrib-watch"); grunt.loadNpmTasks("grunt-shell"); grunt.loadNpmTasks("grunt-ts"); + grunt.loadNpmTasks("grunt-tslint"); grunt.registerTask("set_package_version", function(version) { var buildVersion = getBuildVersion(version); @@ -167,6 +179,6 @@ module.exports = function(grunt) { "shell:build_package", "setPackageName" ]); - + grunt.registerTask("lint", ["tslint:build"]); grunt.registerTask("default", "ts:devlib"); }; diff --git a/package.json b/package.json index 2a784d92..fb4110e2 100644 --- a/package.json +++ b/package.json @@ -78,6 +78,7 @@ "grunt-contrib-watch": "0.6.1", "grunt-shell": "1.1.2", "grunt-ts": "4.2.0", + "grunt-tslint": "2.5.0", "istanbul": "0.3.17", "mocha": "2.2.5", "mocha-fibers": "https://github.com/Icenium/mocha-fibers/tarball/master", diff --git a/tslint.json b/tslint.json new file mode 100644 index 00000000..40b9f253 --- /dev/null +++ b/tslint.json @@ -0,0 +1,49 @@ +{ + "rules": { + "class-name": true, + "curly": true, + "eofline": true, + "indent": true, + "interface-name": true, + "jsdoc-format": true, + "max-line-length": [false, 140], + "no-consecutive-blank-lines": true, + "no-construct": true, + "no-debugger": true, + "no-duplicate-key": true, + "no-duplicate-variable": true, + "no-shadowed-variable": true, + "no-empty": true, + "no-eval": true, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unreachable": true, + "no-unused-expression": true, + "no-unused-variable": true, + "no-use-before-declare": true, + "no-var-keyword": true, + "no-var-requires": false, + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else" + ], + "quotemark": [false, "double"], + "semicolon": true, + "switch-default": false, + "triple-equals": [true, "allow-null-check"], + "use-strict": true, + "variable-name": [false, "allow-leading-underscore"], + "whitespace": [ + false, + "check-branch", + "check-decl", + "check-operator", + "check-module", + "check-separator", + "check-type", + "check-typecast" + ] + } +} \ No newline at end of file