Browse Source

added tslint check for travis

sanex3339 9 years ago
parent
commit
e21c9f7ec7
4 changed files with 148 additions and 2 deletions
  1. 2 0
      .travis.yml
  2. 4 1
      package.json
  3. 1 1
      src/Nodes.ts
  4. 141 0
      tslint.json

+ 2 - 0
.travis.yml

@@ -3,6 +3,8 @@ language: node_js
 node_js:
   - "stable"
 
+script: "npm run travis"
+
 after_success:
   - npm run test:coveralls
   - rm -rf ./coverage

+ 4 - 1
package.json

@@ -35,6 +35,7 @@
     "mocha": "^2.5.3",
     "ts-loader": "^0.8.2",
     "ts-node": "^0.9.1",
+    "tslint": "^3.11.0",
     "typescript": "^1.8.10",
     "typings": "^0.8.1",
     "webpack": "^2.1.0-beta.12",
@@ -47,7 +48,7 @@
   "scripts": {
     "start": "npm run watch",
     "webpack": "node_modules/.bin/webpack",
-    "build": "npm run webpack && npm test",
+    "build": "npm run webpack && npm run tslint && npm test",
     "watch": "node_modules/.bin/webpack --watch",
     "test:compile": "node_modules/.bin/tsc -p tsconfig-test.json",
     "test:dev": "node test/dev/test.js",
@@ -56,6 +57,8 @@
     "test:mocha": "npm run test:compile && node_modules/.bin/mocha test-tmp/test/**/**.spec.js  && npm run test:removeTestTmpDir",
     "test:removeTestTmpDir": "rm -rf test-tmp",
     "test": "npm run test:dev && npm run test:full",
+    "tslint": "tslint src/*.ts",
+    "travis": "npm run tslint && npm test",
     "typings": "node_modules/.bin/typings install"
   },
   "author": {

+ 1 - 1
src/Nodes.ts

@@ -89,4 +89,4 @@ export class Nodes {
     public static isNodeHasBlockStatement (node: INode): node is TNodeWithBlockStatement {
         return node.hasOwnProperty('body') && Array.isArray((<TNodeWithBlockStatement>node).body);
     }
-}
+}

+ 141 - 0
tslint.json

@@ -0,0 +1,141 @@
+{
+  "rules": {
+    "align": [
+      true,
+      "parameters",
+      "statements"
+    ],
+    "ban": [
+      true,
+      [ "_", "forEach" ],
+      [ "_", "each" ],
+      [ "$", "each" ],
+      [ "angular", "forEach" ]
+    ],
+    "class-name": true,
+    "comment-format": [
+      true,
+      "check-space",
+      "check-lowercase"
+    ],
+    "curly": true,
+    "eofline": true,
+    "forin": true,
+    "indent": [
+      true,
+      "spaces"
+    ],
+    "interface-name": [
+      true,
+      "always-prefix"
+    ],
+    "jsdoc-format": true,
+    "label-position": true,
+    "label-undefined": true,
+    "max-line-length": false,
+    "member-access": true,
+    "member-ordering": [
+      true,
+      { "order": "fields-first" }
+    ],
+    "new-parens": true,
+    "no-angle-bracket-type-assertion": false,
+    "no-any": false,
+    "no-arg": true,
+    "no-bitwise": true,
+    "no-conditional-assignment": true,
+    "no-consecutive-blank-lines": false,
+    "no-console": [
+      true,
+      "debug",
+      "info",
+      "time",
+      "timeEnd",
+      "trace"
+    ],
+    "no-construct": true,
+    "no-constructor-vars": true,
+    "no-debugger": true,
+    "no-default-export": true,
+    "no-duplicate-key": true,
+    "no-duplicate-variable": true,
+    "no-empty": false,
+    "no-eval": false,
+    "no-inferrable-types": false,
+    "no-internal-module": true,
+    "no-invalid-this": [
+      true,
+      "check-function-in-method"
+    ],
+    "no-null-keyword": false,
+    "no-reference": true,
+    "no-require-imports": false,
+    "no-shadowed-variable": false,
+    "no-string-literal": false,
+    "no-switch-case-fall-through": true,
+    "no-trailing-whitespace": false,
+    "no-unreachable": true,
+    "no-unused-expression": true,
+    "no-unused-variable": true,
+    "no-use-before-declare": true,
+    "no-var-keyword": true,
+    "no-var-requires": false,
+    "object-literal-sort-keys": false,
+    "one-line": [
+      true,
+      "check-open-brace",
+      "check-catch",
+      "check-else",
+      "check-finally",
+      "check-whitespace"
+    ],
+    "one-variable-per-declaration": false,
+    "quotemark": false,
+    "radix": true,
+    "semicolon": [true, "always"],
+    "switch-default": true,
+    "trailing-comma": false,
+    "triple-equals": [
+      true,
+      "allow-null-check",
+      "allow-undefined-check"
+    ],
+    "typedef": [
+      true,
+      "call-signature",
+      "parameter",
+      "arrow-parameter",
+      "property-declaration",
+      "variable-declaration",
+      "member-variable-declaration"
+    ],
+    "typedef-whitespace": [
+      true,
+      {
+        "call-signature": "nospace",
+        "index-signature": "nospace",
+        "parameter": "nospace",
+        "property-declaration": "nospace",
+        "variable-declaration": "nospace"
+      },
+      {
+        "call-signature": "space",
+        "index-signature": "space",
+        "parameter": "space",
+        "property-declaration": "space",
+        "variable-declaration": "space"
+      }
+    ],
+    "use-isnan": true,
+    "use-strict": false,
+    "variable-name": false,
+    "whitespace": [
+      true,
+      "check-branch",
+      "check-decl",
+      "check-operator",
+      "check-separator",
+      "check-type"
+    ]
+  }
+}