From e21c9f7ec7422175940daec84fb41cb1810207b6 Mon Sep 17 00:00:00 2001 From: sanex3339 Date: Thu, 23 Jun 2016 17:46:38 +0300 Subject: [PATCH] added tslint check for travis --- .travis.yml | 2 + package.json | 5 +- src/Nodes.ts | 2 +- tslint.json | 141 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 tslint.json diff --git a/.travis.yml b/.travis.yml index 289df263..67898ed7 100644 --- a/.travis.yml +++ b/.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 \ No newline at end of file diff --git a/package.json b/package.json index 8022a5ac..74624f20 100644 --- a/package.json +++ b/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": { diff --git a/src/Nodes.ts b/src/Nodes.ts index 212e1401..6104a614 100644 --- a/src/Nodes.ts +++ b/src/Nodes.ts @@ -89,4 +89,4 @@ export class Nodes { public static isNodeHasBlockStatement (node: INode): node is TNodeWithBlockStatement { return node.hasOwnProperty('body') && Array.isArray((node).body); } -} \ No newline at end of file +} diff --git a/tslint.json b/tslint.json new file mode 100644 index 00000000..b3013864 --- /dev/null +++ b/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" + ] + } +} \ No newline at end of file