Lint all servicesSources

This commit is contained in:
Andy Hanson
2016-05-25 06:32:55 -07:00
parent 7173fa8d02
commit bd633c828f
15 changed files with 348 additions and 360 deletions

View File

@@ -28,8 +28,15 @@ class IncrementDecrementWalker extends Lint.RuleWalker {
}
visitIncrementDecrement(node: ts.UnaryExpression) {
if (node.parent && (node.parent.kind === ts.SyntaxKind.ExpressionStatement ||
node.parent.kind === ts.SyntaxKind.ForStatement)) {
if (node.parent && (
// Can be a statement
node.parent.kind === ts.SyntaxKind.ExpressionStatement ||
// Can be directly in a for-statement
node.parent.kind === ts.SyntaxKind.ForStatement ||
// Can be in a comma operator in a for statement (`for (let a = 0, b = 10; a < b; a++, b--)`)
node.parent.kind === ts.SyntaxKind.BinaryExpression &&
(<ts.BinaryExpression>node.parent).operatorToken.kind === ts.SyntaxKind.CommaToken &&
node.parent.parent.kind === ts.SyntaxKind.ForStatement)) {
return;
}
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.POSTFIX_FAILURE_STRING));