commit
58f4c6fcbf
4 changed files with 6 additions and 6 deletions
|
@ -52,8 +52,8 @@ function walk(ctx: Lint.WalkContext<void>, checkCatch: boolean, checkElse: boole
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tryClosingBrace = tryBlock.getLastToken(sourceFile);
|
const tryClosingBrace = tryBlock.getLastToken(sourceFile)!;
|
||||||
const catchKeyword = catchClause.getFirstToken(sourceFile);
|
const catchKeyword = catchClause.getFirstToken(sourceFile)!;
|
||||||
const tryClosingBraceLoc = sourceFile.getLineAndCharacterOfPosition(tryClosingBrace.getEnd());
|
const tryClosingBraceLoc = sourceFile.getLineAndCharacterOfPosition(tryClosingBrace.getEnd());
|
||||||
const catchKeywordLoc = sourceFile.getLineAndCharacterOfPosition(catchKeyword.getStart(sourceFile));
|
const catchKeywordLoc = sourceFile.getLineAndCharacterOfPosition(catchKeyword.getStart(sourceFile));
|
||||||
if (tryClosingBraceLoc.line === catchKeywordLoc.line) {
|
if (tryClosingBraceLoc.line === catchKeywordLoc.line) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ export class Rule extends Lint.Rules.AbstractRule {
|
||||||
function walk(ctx: Lint.WalkContext<void>): void {
|
function walk(ctx: Lint.WalkContext<void>): void {
|
||||||
ts.forEachChild(ctx.sourceFile, recur);
|
ts.forEachChild(ctx.sourceFile, recur);
|
||||||
function recur(node: ts.Node): void {
|
function recur(node: ts.Node): void {
|
||||||
if (node.kind === ts.SyntaxKind.InKeyword && node.parent!.kind === ts.SyntaxKind.BinaryExpression) {
|
if (node.kind === ts.SyntaxKind.InKeyword && node.parent.kind === ts.SyntaxKind.BinaryExpression) {
|
||||||
ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
|
ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ function walk(ctx: Lint.WalkContext<void>): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
function check(node: ts.UnaryExpression): void {
|
function check(node: ts.UnaryExpression): void {
|
||||||
if (!isAllowedLocation(node.parent!)) {
|
if (!isAllowedLocation(node.parent)) {
|
||||||
ctx.addFailureAtNode(node, Rule.POSTFIX_FAILURE_STRING);
|
ctx.addFailureAtNode(node, Rule.POSTFIX_FAILURE_STRING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ function isAllowedLocation(node: ts.Node): boolean {
|
||||||
// Can be in a comma operator in a for statement (`for (let a = 0, b = 10; a < b; a++, b--)`)
|
// Can be in a comma operator in a for statement (`for (let a = 0, b = 10; a < b; a++, b--)`)
|
||||||
case ts.SyntaxKind.BinaryExpression:
|
case ts.SyntaxKind.BinaryExpression:
|
||||||
return (node as ts.BinaryExpression).operatorToken.kind === ts.SyntaxKind.CommaToken &&
|
return (node as ts.BinaryExpression).operatorToken.kind === ts.SyntaxKind.CommaToken &&
|
||||||
node.parent!.kind === ts.SyntaxKind.ForStatement;
|
node.parent.kind === ts.SyntaxKind.ForStatement;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -180,7 +180,7 @@ namespace ts.DocumentHighlights {
|
||||||
default:
|
default:
|
||||||
// Don't cross function boundaries.
|
// Don't cross function boundaries.
|
||||||
// TODO: GH#20090
|
// TODO: GH#20090
|
||||||
return (isFunctionLike(node) && "quit") as false | "quit";
|
return isFunctionLike(node) && "quit";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue