Skip to content

Commit

Permalink
Merge pull request #7 from RobotlegsJS/tslint
Browse files Browse the repository at this point in the history
Update TSLint rules
  • Loading branch information
tiagoschenkel authored Sep 15, 2017
2 parents 53838cf + c440075 commit a4b98c9
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 32 deletions.
19 changes: 15 additions & 4 deletions src/robotlegs/bender/utilities/macrobot/impl/AbstractMacro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 && (<IAsyncCommand>command).registerCompleteCallback(this.commandCompleteHandler.bind(this));

if (isAsync) {
(<IAsyncCommand>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);
}
Expand Down
75 changes: 47 additions & 28 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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,
Expand All @@ -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",
Expand Down

0 comments on commit a4b98c9

Please sign in to comment.