From 33f7d7649a614daccc194b0f76caf8db13b7dc70 Mon Sep 17 00:00:00 2001 From: Paris Kasidiaris Date: Thu, 15 Dec 2016 13:53:26 +0200 Subject: [PATCH 1/4] Add tslint Fix #408 --- package.json | 2 ++ tslint.json | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 tslint.json diff --git a/package.json b/package.json index cd83738398..e05454584c 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,12 @@ "pty.js": "0.3.1", "sleep": "^3.0.1", "sorcery": "^0.10.0", + "tslint": "^4.0.2", "typescript": "^2.0.3" }, "scripts": { "start": "nodemon --watch src --watch addons --watch demo --exec bash -c './bin/build && node demo/app'", + "lint": "tslint src/**/*.ts", "test": "mocha --recursive ./lib", "build:docs": "jsdoc -c jsdoc.json", "build": "./bin/build", diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000000..d571d9c5c9 --- /dev/null +++ b/tslint.json @@ -0,0 +1,53 @@ +{ + "rules": { + "class-name": true, + "comment-format": [ + true, + "check-space" + ], + "indent": [ + true, + "spaces" + ], + "eofline": true, + "no-eval": true, + "no-internal-module": true, + "no-trailing-whitespace": true, + "no-unsafe-finally": true, + "no-var-keyword": true, + "quotemark": [ + true, + "single" + ], + "semicolon": [ + true, + "always" + ], + "triple-equals": [ + true, + "allow-null-check" + ], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "variable-name": [ + true, + "ban-keywords" + ], + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ] + } +} From 20b6f209089ba5b88f33e988472384959c491eee Mon Sep 17 00:00:00 2001 From: Paris Kasidiaris Date: Thu, 15 Dec 2016 13:57:25 +0200 Subject: [PATCH 2/4] Make linter happy --- src/handlers/Clipboard.test.ts | 2 +- src/handlers/Clipboard.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/handlers/Clipboard.test.ts b/src/handlers/Clipboard.test.ts index 3302cb6c2f..093746941b 100644 --- a/src/handlers/Clipboard.test.ts +++ b/src/handlers/Clipboard.test.ts @@ -5,7 +5,7 @@ import * as Clipboard from './Clipboard'; describe('evaluateCopiedTextProcessing', function () { it('should strip trailing whitespaces and replace nbsps with spaces', function () { - var nonBreakingSpace = String.fromCharCode(160), + let nonBreakingSpace = String.fromCharCode(160), copiedText = 'echo' + nonBreakingSpace + 'hello' + nonBreakingSpace, processedText = Clipboard.prepareTextForClipboard(copiedText); diff --git a/src/handlers/Clipboard.ts b/src/handlers/Clipboard.ts index e4967598cb..073310bf5d 100644 --- a/src/handlers/Clipboard.ts +++ b/src/handlers/Clipboard.ts @@ -108,11 +108,11 @@ export function rightClickHandler(ev: MouseEvent, term: ITerminal) { if (s.rangeCount) { let r = s.getRangeAt(0), - cr = r.getClientRects(), - i, rect; + cr = r.getClientRects(); + + for (let i = 0; i < cr.length; i++) { + let rect = cr[i]; - for (i=0; i rect.left) && (x < rect.right) && (y > rect.top) && (y < rect.bottom) From 850a238ca297bfef8f5633ca0f9508fbcc2fcb24 Mon Sep 17 00:00:00 2001 From: Paris Kasidiaris Date: Thu, 15 Dec 2016 14:02:38 +0200 Subject: [PATCH 3/4] Include lint test into travis --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index bdc4783851..2eeb39a7b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,3 +11,6 @@ addons: - g++-4.8 notifications: email: false +script: + - npm run lint + - npm run test From fbc314a74b9cbc8a431f6a9ba3e490a75f5adcfa Mon Sep 17 00:00:00 2001 From: Paris Kasidiaris Date: Thu, 15 Dec 2016 14:05:37 +0200 Subject: [PATCH 4/4] Parallelise build --- .travis.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2eeb39a7b3..b32fc7ea3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,11 @@ language: node_js node_js: - 6 env: - - CXX=g++-4.8 + global: + - CXX=g++-4.8 + matrix: + - NPM_COMMAND=lint + - NPM_COMMAND=test addons: apt: sources: @@ -11,6 +15,4 @@ addons: - g++-4.8 notifications: email: false -script: - - npm run lint - - npm run test +script: npm run $NPM_COMMAND