apply tslint rule to scripts\tslint

This commit is contained in:
Yui T
2015-11-20 16:28:58 -08:00
parent c94dcbd770
commit 97f0bfcd72
2 changed files with 14 additions and 4 deletions

View File

@@ -13,10 +13,10 @@ export class Rule extends Lint.Rules.AbstractRule {
class TypeOperatorSpacingWalker extends Lint.RuleWalker {
public visitNode(node: ts.Node) {
if (node.kind === ts.SyntaxKind.UnionType || node.kind === ts.SyntaxKind.IntersectionType) {
let types = (<ts.UnionOrIntersectionTypeNode>node).types;
const types = (<ts.UnionOrIntersectionTypeNode>node).types;
let expectedStart = types[0].end + 2; // space, | or &
for (let i = 1; i < types.length; i++) {
let currentType = types[i];
const currentType = types[i];
if (expectedStart !== currentType.pos || currentType.getLeadingTriviaWidth() !== 1) {
const failure = this.createFailure(currentType.pos, currentType.getWidth(), Rule.FAILURE_STRING);
this.addFailure(failure);