sebastien 7 years ago
parent
commit
10c848d8ba
3 changed files with 38 additions and 3 deletions
  1. 13 1
      Tools/Gulp/gulpfile.js
  2. 3 1
      Tools/Gulp/package.json
  3. 22 1
      tslint.json

+ 13 - 1
Tools/Gulp/gulpfile.js

@@ -30,6 +30,8 @@ var fs = require("fs");
 var dtsBundle = require('dts-bundle');
 const through = require('through2');
 var karmaServer = require('karma').Server;
+var gulpTslint = require("gulp-tslint");
+var tslint = require("tslint");
 
 //viewer declaration
 var processDeclaration = require('./processViewerDeclaration');
@@ -268,9 +270,19 @@ gulp.task("build", gulp.series("shaders", function build() {
 * Compiles all typescript files and creating a js and a declaration file.
 */
 gulp.task("typescript-compile", function () {
+    var program = tslint.Linter.createProgram("../../src/tsconfig.json");
+
     var tsResult = gulp.src(config.typescript)
+        .pipe(gulpTslint({
+            formatter: "stylish",
+            configuration: "../../tslint.json",
+            program
+        }))
+        .pipe(gulpTslint.report())
         .pipe(sourcemaps.init())
-        .pipe(tsProject());
+        .pipe(tsProject({
+            summarizeFailureOutput: true
+        }));
 
     //If this gulp task is running on travis, file the build!
     if (process.env.TRAVIS) {

+ 3 - 1
Tools/Gulp/package.json

@@ -45,7 +45,9 @@
         "typedoc": "^0.12.0",
         "typescript": "^3.0.1",
         "webpack": "^4.16.3",
-        "webpack-stream": "5.0.0"
+        "webpack-stream": "5.0.0",
+        "tslint": "^5.11.0",
+        "gulp-tslint": "^8.1.3"
     },
     "scripts": {
         "install": "cd ../../gui && npm install && cd ../Tools/Gulp/ &&  cd ../../inspector && npm install && cd ../Tools/Gulp/ && npm --prefix ../../Playground/ install ../../Playground/ && npm --prefix ../../tests/unit/ install ../../tests/unit/ && npm --prefix ../../Viewer/tests/ install ../../Viewer/tests/ && cd ../../Viewer && npm install && cd ../Tools/Gulp/ && gulp deployLocalDev"

+ 22 - 1
tslint.json

@@ -1,6 +1,27 @@
 {
     "rules": {
         "no-this-assignment": true,
-        "completed-docs": true
+        "no-eval": true,
+        "align": true,
+        "arrow-parens": true,
+        "no-trailing-whitespace": true,
+        "new-parens": true,
+        "no-consecutive-blank-lines": true,
+        "no-irregular-whitespace": true,
+        "semicolon": true,
+        "space-before-function-paren": [true, "never"],
+        "space-within-parens": true,
+        "curly": true,
+        "whitespace": [true, 
+            "check-branch",
+            "check-decl",
+            "check-operator",
+            "check-module",
+            "check-separator",
+            "check-rest-spread",
+            "check-type",
+            "check-typecast",
+            "check-type-operator",
+            "check-preblock"]
     }
 }