-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into extensibility-model
- Loading branch information
Showing
627 changed files
with
17,755 additions
and
33,517 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as Lint from "tslint/lib/lint"; | ||
import * as ts from "typescript"; | ||
|
||
|
||
export class Rule extends Lint.Rules.AbstractRule { | ||
public static TRAILING_FAILURE_STRING = "Excess trailing whitespace found around type assertion."; | ||
|
||
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { | ||
return this.applyWithWalker(new TypeAssertionWhitespaceWalker(sourceFile, this.getOptions())); | ||
} | ||
} | ||
|
||
class TypeAssertionWhitespaceWalker extends Lint.RuleWalker { | ||
public visitNode(node: ts.Node) { | ||
if (node.kind === ts.SyntaxKind.TypeAssertionExpression) { | ||
const refined = node as ts.TypeAssertion; | ||
const leftSideWhitespaceStart = refined.type.getEnd() + 1; | ||
const rightSideWhitespaceEnd = refined.expression.getStart(); | ||
if (leftSideWhitespaceStart !== rightSideWhitespaceEnd) { | ||
this.addFailure(this.createFailure(leftSideWhitespaceStart, rightSideWhitespaceEnd, Rule.TRAILING_FAILURE_STRING)); | ||
} | ||
} | ||
super.visitNode(node); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.