From eecbb2a0a714893ef53a2cec0966a041e0cfec19 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Fri, 15 Sep 2017 11:04:53 +0200 Subject: [PATCH 1/2] update tslint rules --- tslint.json | 75 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 28 deletions(-) diff --git a/tslint.json b/tslint.json index 80daf3f..3c951e2 100644 --- a/tslint.json +++ b/tslint.json @@ -1,20 +1,34 @@ { "rules": { "class-name": true, - "comment-format": [true, "check-space"], + "comment-format": [ + true, + "check-space" + ], "curly": true, "eofline": true, "forin": true, - "indent": [true, "spaces"], + "indent": [ + true, + "spaces" + ], "label-position": true, - "label-undefined": true, - "max-line-length": [true, 140], + "max-line-length": [ + true, + 140 + ], "member-access": true, "member-ordering": [ - true, - "public-before-private", - "static-before-instance", - "variables-before-functions" + true, { + "order": [ + "static-field", + "instance-field", + "constructor", + "public-instance-method", + "protected-instance-method", + "private-instance-method" + ] + } ], "no-arg": true, "no-bitwise": true, @@ -28,12 +42,10 @@ ], "no-construct": true, "no-debugger": true, - "no-duplicate-key": true, "no-duplicate-variable": true, "no-empty": true, "no-eval": true, - "no-inferrable-types": true, - "no-internal-module": true, + "no-inferrable-types": false, "no-shadowed-variable": true, "no-string-literal": true, "no-switch-case-fall-through": false, @@ -51,26 +63,33 @@ "check-else", "check-whitespace" ], - "quotemark": [true, "double", "avoid-escape"], - "radix": true, - "semicolon": true, - "trailing-comma": false, - "triple-equals": [true, "allow-null-check"], + "quotemark": [ + true, + "double", + "avoid-escape" + ], + "radix":true, + "semicolon": [ + true, + "always" + ], + "trailing-comma": [ + false + ], + "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", - "check-format", - "allow-leading-underscore", - "allow-trailing-underscore" + "call-signature":"nospace", + "index-signature":"nospace", + "parameter":"nospace", + "property-declaration":"nospace", + "variable-declaration":"nospace" + } ], + "variable-name": false, "whitespace": [ true, "check-branch", From c440075611615f7860b46394c6c19ca0305f09f8 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Fri, 15 Sep 2017 11:08:01 +0200 Subject: [PATCH 2/2] adhere to tslint rules --- .../utilities/macrobot/impl/AbstractMacro.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/robotlegs/bender/utilities/macrobot/impl/AbstractMacro.ts b/src/robotlegs/bender/utilities/macrobot/impl/AbstractMacro.ts index 2e33823..15e47ac 100644 --- a/src/robotlegs/bender/utilities/macrobot/impl/AbstractMacro.ts +++ b/src/robotlegs/bender/utilities/macrobot/impl/AbstractMacro.ts @@ -68,7 +68,9 @@ export abstract class AbstractMacro extends AsyncCommand implements IMacro { let payloads: ISubCommandPayload[] = mapping.payloads; let hasPayloads: boolean = payloads.length > 0; - hasPayloads && this.mapPayloads(payloads); + if (hasPayloads) { + this.mapPayloads(payloads); + } if (mapping.guards.length === 0 || guardsApprove(mapping.guards, this._injector)) { command = mapping.getOrCreateCommandInstance(this._injector); @@ -80,14 +82,23 @@ export abstract class AbstractMacro extends AsyncCommand implements IMacro { } } - hasPayloads && this.unmapPayloads(payloads); + if (hasPayloads) { + this.unmapPayloads(payloads); + } if (command && mapping.executeMethod) { let isAsync: boolean = command.constructor.prototype.registerCompleteCallback !== undefined; - isAsync && (command).registerCompleteCallback(this.commandCompleteHandler.bind(this)); + + if (isAsync) { + (command).registerCompleteCallback(this.commandCompleteHandler.bind(this)); + } + let executeMethod: Function = command[mapping.executeMethod]; executeMethod.apply(command); - !isAsync && this.commandCompleteHandler(true); + + if (!isAsync) { + this.commandCompleteHandler(true); + } } else { this.commandCompleteHandler(true); }