Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tslint

Package Overview
Dependencies
Maintainers
1
Versions
182
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tslint - npm Package Compare versions

Comparing version 0.4.14 to 1.0.0

.settings/com.palantir.typescript.prefs

2

build/formatters/jsonFormatter.js

@@ -14,7 +14,5 @@ var __extends = this.__extends || function (d, b) {

var failuresJSON = [];
for (var i = 0; i < failures.length; ++i) {
failuresJSON.push(failures[i].toJson());
}
return JSON.stringify(failuresJSON);

@@ -21,0 +19,0 @@ };

@@ -18,7 +18,5 @@ var __extends = this.__extends || function (d, b) {

var failureString = failure.getFailure().replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\'/g, "&#39;").replace(/\"/g, "&quot;");
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
var line = lineAndCharacter.line() + 1;
var character = lineAndCharacter.character() + 1;
output += "<file name=\"" + fileName;

@@ -25,0 +23,0 @@ output += "\"><violation begincolumn=\"" + character;

@@ -18,7 +18,5 @@ var __extends = this.__extends || function (d, b) {

var failureString = failure.getFailure();
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
var line = lineAndCharacter.line() + 1;
var character = lineAndCharacter.character() + 1;
output += fileName + "[" + line + ", " + character + "]: " + failureString + "\n";

@@ -25,0 +23,0 @@ }

@@ -19,7 +19,5 @@ var __extends = this.__extends || function (d, b) {

var ruleName = failure.getRuleName();
var lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
var line = lineAndCharacter.line() + 1;
var character = lineAndCharacter.character() + 1;
output += "(" + ruleName + ") " + fileName + "[" + line + ", " + character + "]: " + failureString + "\n";

@@ -26,0 +24,0 @@ }

@@ -25,3 +25,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var BanFunctionWalker = (function (_super) {

@@ -36,17 +35,17 @@ __extends(BanFunctionWalker, _super);

};
BanFunctionWalker.prototype.visitInvocationExpression = function (node) {
var _this = this;
var expression = node.expression;
if (expression.kind() === 212 /* MemberAccessExpression */ && expression.childCount() >= 3) {
var firstToken = expression.firstToken();
var secondToken = expression.childAt(1);
var thirdToken = expression.childAt(2);
if (expression.kind() === 213 /* MemberAccessExpression */ && TypeScript.childCount(expression) >= 3) {
var firstToken = TypeScript.firstToken(expression);
var secondToken = TypeScript.childAt(expression, 1);
var thirdToken = TypeScript.childAt(expression, 2);
var firstText = firstToken.text();
var thirdText = TypeScript.fullText(thirdToken);
if (secondToken.kind() === 76 /* DotToken */) {
this.bannedFunctions.forEach(function (bannedFunction) {
if (firstToken.text() === bannedFunction[0] && thirdToken.fullText() === bannedFunction[1]) {
var position = _this.position() + node.leadingTriviaWidth();
_this.addFailure(_this.createFailure(position, expression.width(), Rule.FAILURE_STRING_PART + firstToken.text() + "." + thirdToken.fullText()));
if (firstText === bannedFunction[0] && thirdText === bannedFunction[1]) {
var position = _this.getPosition() + TypeScript.leadingTriviaWidth(node);
var failure = _this.createFailure(position, TypeScript.width(expression), Rule.FAILURE_STRING_PART + firstText + "." + thirdText);
_this.addFailure(failure);
}

@@ -56,3 +55,2 @@ });

}
_super.prototype.visitInvocationExpression.call(this, node);

@@ -59,0 +57,0 @@ };

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var NameWalker = (function (_super) {

@@ -30,8 +29,6 @@ __extends(NameWalker, _super);

var position = this.positionAfter(node.modifiers, node.classKeyword);
this.addFailureAt(position, node.identifier.width());
this.addFailureAt(position, TypeScript.width(node.identifier));
}
_super.prototype.visitClassDeclaration.call(this, node);
};
NameWalker.prototype.visitInterfaceDeclaration = function (node) {

@@ -41,8 +38,6 @@ var interfaceName = node.identifier.text();

var position = this.positionAfter(node.modifiers, node.interfaceKeyword);
this.addFailureAt(position, node.identifier.width());
this.addFailureAt(position, TypeScript.width(node.identifier));
}
_super.prototype.visitInterfaceDeclaration.call(this, node);
};
NameWalker.prototype.isPascalCased = function (name) {

@@ -52,7 +47,5 @@ if (name.length <= 0) {

}
var firstCharacter = name.charAt(0);
return ((firstCharacter === firstCharacter.toUpperCase()) && name.indexOf("_") === -1);
};
NameWalker.prototype.addFailureAt = function (position, width) {

@@ -59,0 +52,0 @@ var failure = this.createFailure(position, width, Rule.FAILURE_STRING);

@@ -9,3 +9,2 @@ var __extends = this.__extends || function (d, b) {

var OPTION_LOWERCASE = "check-lowercase";
var Rule = (function (_super) {

@@ -24,3 +23,2 @@ __extends(Rule, _super);

exports.Rule = Rule;
var CommentWalker = (function (_super) {

@@ -32,8 +30,7 @@ __extends(CommentWalker, _super);

CommentWalker.prototype.visitToken = function (token) {
this.findFailuresForTrivia(token.leadingTrivia().toArray(), this.position());
this.findFailuresForTrivia(token.trailingTrivia().toArray(), this.position() + token.leadingTriviaWidth() + token.width());
var tokenWidth = TypeScript.width(token);
this.findFailuresForTrivia(token.leadingTrivia().toArray(), this.getPosition());
this.findFailuresForTrivia(token.trailingTrivia().toArray(), this.getPosition() + token.leadingTriviaWidth() + tokenWidth);
_super.prototype.visitToken.call(this, token);
};
CommentWalker.prototype.findFailuresForTrivia = function (triviaList, startingPosition) {

@@ -45,5 +42,7 @@ var _this = this;

var commentText = triviaItem.fullText();
var startPosition = currentPosition + 2;
var endPosition = triviaItem.fullWidth() - 2;
if (_this.hasOption(OPTION_SPACE)) {
if (!_this.startsWithSpace(commentText)) {
var leadingSpaceFailure = _this.createFailure(currentPosition, triviaItem.fullWidth(), Rule.LEADING_SPACE_FAILURE);
var leadingSpaceFailure = _this.createFailure(startPosition, endPosition, Rule.LEADING_SPACE_FAILURE);
_this.addFailure(leadingSpaceFailure);

@@ -54,3 +53,3 @@ }

if (!_this.startsWithLowercase(commentText)) {
var lowercaseFailure = _this.createFailure(currentPosition, triviaItem.fullWidth(), Rule.LOWERCASE_FAILURE);
var lowercaseFailure = _this.createFailure(startPosition, endPosition, Rule.LOWERCASE_FAILURE);
_this.addFailure(lowercaseFailure);

@@ -63,3 +62,2 @@ }

};
CommentWalker.prototype.startsWithSpace = function (commentText) {

@@ -69,12 +67,8 @@ if (commentText.length <= 2) {

}
if ((/^#(end)?region/).test(commentText.substring(2))) {
return true;
}
var firstCharacter = commentText.charAt(2);
return firstCharacter === " " || firstCharacter === "/";
};
CommentWalker.prototype.startsWithLowercase = function (commentText) {

@@ -84,3 +78,2 @@ if (commentText.length <= 2) {

}
var firstCharacterMatch = commentText.match(/^\/\/\s*(\w)/);

@@ -90,3 +83,4 @@ if (firstCharacterMatch != null) {

return firstCharacter === firstCharacter.toLowerCase();
} else {
}
else {
return true;

@@ -93,0 +87,0 @@ }

@@ -23,3 +23,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var CurlyWalker = (function (_super) {

@@ -34,6 +33,4 @@ __extends(CurlyWalker, _super);

}
_super.prototype.visitForInStatement.call(this, node);
};
CurlyWalker.prototype.visitForStatement = function (node) {

@@ -43,6 +40,4 @@ if (!this.isStatementBraced(node.statement)) {

}
_super.prototype.visitForStatement.call(this, node);
};
CurlyWalker.prototype.visitIfStatement = function (node) {

@@ -52,14 +47,10 @@ if (!this.isStatementBraced(node.statement)) {

}
_super.prototype.visitIfStatement.call(this, node);
};
CurlyWalker.prototype.visitElseClause = function (node) {
if (node.statement.kind() !== 147 /* IfStatement */ && !this.isStatementBraced(node.statement)) {
if (node.statement.kind() !== 148 /* IfStatement */ && !this.isStatementBraced(node.statement)) {
this.addFailureForNode(node, Rule.ELSE_FAILURE_STRING);
}
_super.prototype.visitElseClause.call(this, node);
};
CurlyWalker.prototype.visitDoStatement = function (node) {

@@ -69,6 +60,4 @@ if (!this.isStatementBraced(node.statement)) {

}
_super.prototype.visitDoStatement.call(this, node);
};
CurlyWalker.prototype.visitWhileStatement = function (node) {

@@ -78,22 +67,17 @@ if (!this.isStatementBraced(node.statement)) {

}
_super.prototype.visitWhileStatement.call(this, node);
};
CurlyWalker.prototype.isStatementBraced = function (node) {
var childCount = node.childCount();
var childCount = TypeScript.childCount(node);
if (childCount === 3) {
if (node.childAt(0).kind() === TypeScript.SyntaxKind.FirstPunctuation && node.childAt(1).kind() === 1 /* List */ && node.childAt(2).kind() === 71 /* CloseBraceToken */) {
if (TypeScript.childAt(node, 0).kind() === TypeScript.SyntaxKind.FirstPunctuation && TypeScript.childAt(node, 1).kind() === 1 /* List */ && TypeScript.childAt(node, 2).kind() === 71 /* CloseBraceToken */) {
return true;
}
}
return false;
};
CurlyWalker.prototype.addFailureForNode = function (node, failure) {
var leadingWidth = node.leadingTriviaWidth();
var start = this.position() + leadingWidth;
var end = node.width();
var leadingWidth = TypeScript.leadingTriviaWidth(node);
var start = this.getPosition() + leadingWidth;
var end = TypeScript.width(node);
this.addFailure(this.createFailure(start, end, failure));

@@ -100,0 +84,0 @@ };

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var EofWalker = (function (_super) {

@@ -30,3 +29,2 @@ __extends(EofWalker, _super);

};
EofWalker.prototype.handleToken = function (token) {

@@ -36,3 +34,2 @@ var lastState = this.getLastState();

var endsWithNewLine = false;
var previousToken = lastState.token;

@@ -42,13 +39,10 @@ if (previousToken !== null && this.hasNewLineAtEnd(previousToken.trailingTrivia())) {

}
if (token.hasLeadingTrivia() && !this.hasNewLineAtEnd(token.leadingTrivia())) {
endsWithNewLine = false;
}
if (!endsWithNewLine) {
this.addFailure(this.createFailure(this.position(), 1, Rule.FAILURE_STRING));
this.addFailure(this.createFailure(this.getPosition(), 1, Rule.FAILURE_STRING));
}
}
};
EofWalker.prototype.hasNewLineAtEnd = function (triviaList) {

@@ -58,3 +52,2 @@ if (triviaList.count() <= 0 || !triviaList.hasNewLine()) {

}
return triviaList.last().isNewLine();

@@ -61,0 +54,0 @@ };

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var ForInWalker = (function (_super) {

@@ -30,21 +29,17 @@ __extends(ForInWalker, _super);

};
ForInWalker.prototype.handleForInStatement = function (node) {
var statement = node.statement;
var statementKind = node.statement.kind();
if (statementKind === 147 /* IfStatement */) {
if (statementKind === 148 /* IfStatement */) {
return;
}
if (statementKind === 146 /* Block */) {
if (statementKind === 147 /* Block */) {
var blockNode = statement;
var blockStatements = blockNode.statements;
if (blockStatements.childCount() >= 1) {
var firstBlockStatement = blockStatements.childAt(0);
if (firstBlockStatement.kind() === 147 /* IfStatement */) {
if (blockStatements.childCount() === 1) {
if (TypeScript.childCount(blockStatements) >= 1) {
var firstBlockStatement = TypeScript.childAt(blockStatements, 0);
if (firstBlockStatement.kind() === 148 /* IfStatement */) {
if (TypeScript.childCount(blockStatements) === 1) {
return;
}
var ifStatement = firstBlockStatement.statement;

@@ -57,22 +52,17 @@ if (this.nodeIsContinue(ifStatement)) {

}
var position = this.position() + node.leadingTriviaWidth();
var failure = this.createFailure(position, node.width(), Rule.FAILURE_STRING);
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
var failure = this.createFailure(position, TypeScript.width(node), Rule.FAILURE_STRING);
this.addFailure(failure);
};
ForInWalker.prototype.nodeIsContinue = function (node) {
var kind = node.kind();
if (kind === 153 /* ContinueStatement */) {
if (kind === 154 /* ContinueStatement */) {
return true;
}
if (kind === 146 /* Block */) {
if (kind === 147 /* Block */) {
var blockStatements = node.statements;
if (blockStatements.childCount() === 1 && blockStatements.childAt(0).kind() === 153 /* ContinueStatement */) {
if (TypeScript.childCount(blockStatements) === 1 && TypeScript.childAt(blockStatements, 0).kind() === 154 /* ContinueStatement */) {
return true;
}
}
return false;

@@ -79,0 +69,0 @@ };

@@ -7,2 +7,4 @@ var __extends = this.__extends || function (d, b) {

};
var OPTION_USE_TABS = "tabs";
var OPTION_USE_SPACES = "spaces";
var Rule = (function (_super) {

@@ -13,14 +15,10 @@ __extends(Rule, _super);

}
Rule.prototype.isEnabled = function () {
return false;
};
Rule.prototype.apply = function (syntaxTree) {
return this.applyWithWalker(new IndentWalker(syntaxTree, this.getOptions()));
};
Rule.FAILURE_STRING = "unexpected tab width: ";
Rule.FAILURE_STRING_TABS = "tab indentation expected";
Rule.FAILURE_STRING_SPACES = "space indentation expected";
return Rule;
})(Lint.Rules.AbstractRule);
exports.Rule = Rule;
var IndentWalker = (function (_super) {

@@ -30,143 +28,21 @@ __extends(IndentWalker, _super);

_super.call(this, syntaxTree, options);
this.currentLevel = 0;
this.tabWidth = this.getOptions()[0];
}
IndentWalker.prototype.visitClassDeclaration = function (node) {
this.currentLevel += 1;
_super.prototype.visitClassDeclaration.call(this, node);
this.currentLevel -= 1;
};
IndentWalker.prototype.visitMemberVariableDeclaration = function (node) {
var firstElement;
if (node.modifiers.childCount() > 0) {
firstElement = node.modifiers.childAt(0);
} else {
firstElement = node.variableDeclarator;
if (this.hasOption(OPTION_USE_TABS)) {
this.regExp = new RegExp(" ");
this.failureString = Rule.FAILURE_STRING_TABS;
}
this.checkNodeOrToken(firstElement);
_super.prototype.visitMemberVariableDeclaration.call(this, node);
};
IndentWalker.prototype.visitMemberFunctionDeclaration = function (node) {
var firstElement;
if (node.modifiers.childCount() > 0) {
firstElement = node.modifiers.childAt(0);
} else {
firstElement = node.propertyName;
else if (this.hasOption(OPTION_USE_SPACES)) {
this.regExp = new RegExp("\t");
this.failureString = Rule.FAILURE_STRING_SPACES;
}
this.checkNodeOrToken(firstElement);
_super.prototype.visitMemberFunctionDeclaration.call(this, node);
};
IndentWalker.prototype.visitModuleDeclaration = function (node) {
this.visitList(node.modifiers);
this.visitToken(node.moduleKeyword);
this.visitOptionalNodeOrToken(node.name);
if (node.stringLiteral !== null) {
this.visitToken(node.stringLiteral);
}
this.visitToken(node.openBraceToken);
this.checkAndVisitList(node.moduleElements);
this.visitToken(node.closeBraceToken);
};
IndentWalker.prototype.visitEnumDeclaration = function (node) {
this.visitList(node.modifiers);
this.visitToken(node.enumKeyword);
this.visitToken(node.identifier);
this.visitToken(node.openBraceToken);
this.checkAndVisitSeparatedList(node.enumElements);
this.visitToken(node.closeBraceToken);
};
IndentWalker.prototype.visitSwitchStatement = function (node) {
this.currentLevel += 1;
_super.prototype.visitSwitchStatement.call(this, node);
this.currentLevel -= 1;
};
IndentWalker.prototype.visitCaseSwitchClause = function (node) {
this.checkAndVisitNodeOrToken(node.caseKeyword);
this.visitNodeOrToken(node.expression);
this.visitToken(node.colonToken);
this.checkAndVisitList(node.statements);
};
IndentWalker.prototype.visitDefaultSwitchClause = function (node) {
this.checkAndVisitNodeOrToken(node.defaultKeyword);
this.visitToken(node.colonToken);
this.checkAndVisitList(node.statements);
};
IndentWalker.prototype.checkAndVisitList = function (list) {
this.currentLevel += 1;
for (var i = 0; i < list.childCount(); i++) {
this.checkAndVisitNodeOrToken(list.childAt(i));
}
this.currentLevel -= 1;
};
IndentWalker.prototype.checkAndVisitSeparatedList = function (list) {
this.currentLevel += 1;
for (var i = 0, n = list.childCount(); i < n; i++) {
var element = list.childAt(i);
if (element.kind() === 79 /* CommaToken */ || element.kind() === 78 /* SemicolonToken */) {
this.visitNodeOrToken(element);
} else {
this.checkAndVisitNodeOrToken(element);
}
IndentWalker.prototype.visitToken = function (token) {
if (this.hasOption(OPTION_USE_TABS) || this.hasOption(OPTION_USE_SPACES)) {
var position = this.getPosition() + token.leadingTriviaWidth();
if (!token.hasLeadingComment() && token.leadingTrivia().fullText().match(this.regExp)) {
this.addFailure(this.createFailure(position, token.fullWidth(), this.failureString));
}
}
this.currentLevel -= 1;
_super.prototype.visitToken.call(this, token);
};
IndentWalker.prototype.checkAndVisitNodeOrToken = function (nodeOrToken) {
this.checkNodeOrToken(nodeOrToken);
this.visitNodeOrToken(nodeOrToken);
};
IndentWalker.prototype.checkNodeOrToken = function (nodeOrToken) {
var expectedIndentation = this.currentLevel * this.tabWidth;
var actualIndentation = this.getImmediateIndentation(nodeOrToken);
if (expectedIndentation !== actualIndentation) {
var position = this.position() + nodeOrToken.leadingTriviaWidth();
var error = Rule.FAILURE_STRING + "expected " + expectedIndentation + ", " + "got " + actualIndentation;
this.addFailure(this.createFailure(position, nodeOrToken.width(), error));
}
};
IndentWalker.prototype.getImmediateIndentation = function (element) {
var indentationCount = 0;
var triviaList = element.leadingTrivia();
var listCount = triviaList.count();
if (listCount > 0) {
var trivia = triviaList.syntaxTriviaAt(listCount - 1);
if (trivia.kind() === 4 /* WhitespaceTrivia */) {
indentationCount = this.getWhitespaceWidth(trivia.fullText());
}
}
return indentationCount;
};
IndentWalker.prototype.getWhitespaceWidth = function (whitespace) {
var width = 0;
for (var i = 0; i < whitespace.length; ++i) {
var charCode = whitespace.charCodeAt(i);
if (charCode === 9 /* tab */) {
width += 4;
} else {
width += 1;
}
}
return width;
};
return IndentWalker;
})(Lint.RuleWalker);

@@ -15,7 +15,6 @@ var __extends = this.__extends || function (d, b) {

};
Rule.FAILURE_STRING = "interface name must start with capital I";
Rule.FAILURE_STRING = "interface name must be a capitalized I";
return Rule;
})(Lint.Rules.AbstractRule);
exports.Rule = Rule;
var NameWalker = (function (_super) {

@@ -30,8 +29,6 @@ __extends(NameWalker, _super);

var position = this.positionAfter(node.modifiers, node.interfaceKeyword);
this.addFailureAt(position, node.identifier.width());
this.addFailureAt(position, TypeScript.width(node.identifier));
}
_super.prototype.visitInterfaceDeclaration.call(this, node);
};
NameWalker.prototype.startsWithI = function (name) {

@@ -41,7 +38,5 @@ if (name.length <= 0) {

}
var firstCharacter = name.charAt(0);
return (firstCharacter === "I");
};
NameWalker.prototype.addFailureAt = function (position, width) {

@@ -48,0 +43,0 @@ var failure = this.createFailure(position, width, Rule.FAILURE_STRING);

@@ -20,3 +20,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var JsdocWalker = (function (_super) {

@@ -28,8 +27,7 @@ __extends(JsdocWalker, _super);

JsdocWalker.prototype.visitToken = function (token) {
this.findFailuresForTrivia(token.leadingTrivia().toArray(), this.position());
this.findFailuresForTrivia(token.trailingTrivia().toArray(), this.position() + token.leadingTriviaWidth() + token.width());
var tokenWidth = TypeScript.width(token);
this.findFailuresForTrivia(token.leadingTrivia().toArray(), this.getPosition());
this.findFailuresForTrivia(token.trailingTrivia().toArray(), this.getPosition() + token.leadingTriviaWidth() + tokenWidth);
_super.prototype.visitToken.call(this, token);
};
JsdocWalker.prototype.findFailuresForTrivia = function (triviaList, startingPosition) {

@@ -44,7 +42,5 @@ var _this = this;

var firstLine = lines[0];
var isJsdocMatch = firstLine.match(/^\s*\/\*\*/);
if (isJsdocMatch != null) {
var lineMap = _this.getSyntaxTree().lineMap();
if (lines.length === 1) {

@@ -59,3 +55,2 @@ var firstLineMatch = firstLine.match(/^\s*\/\*\* (.* )?\*\/$/);

var indexToMatch = firstLine.indexOf("**") + lineMap.getLineAndCharacterFromPosition(currentPosition).character();
var otherLines = lines.splice(1, lines.length - 2);

@@ -75,3 +70,2 @@ jsdocPosition += firstLine.length + 1;

var lastLine = lines[lines.length - 1];
var endBlockCommentMatch = lastLine.match(/^\s*\*\/$/);

@@ -90,3 +84,2 @@ if (endBlockCommentMatch == null) {

};
JsdocWalker.prototype.addFailureAt = function (currentPosition, width, failureString) {

@@ -93,0 +86,0 @@ var failure = this.createFailure(currentPosition, width, failureString);

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var LabelPosWalker = (function (_super) {

@@ -27,5 +26,4 @@ __extends(LabelPosWalker, _super);

LabelPosWalker.prototype.visitLabeledStatement = function (node) {
var width = node.identifier.width();
var position = this.position() + node.leadingTriviaWidth();
var width = TypeScript.width(node.identifier);
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
this.isValidLabel = false;

@@ -38,3 +36,2 @@ _super.prototype.visitLabeledStatement.call(this, node);

};
LabelPosWalker.prototype.visitDoStatement = function (node) {

@@ -44,3 +41,2 @@ this.isValidLabel = true;

};
LabelPosWalker.prototype.visitForStatement = function (node) {

@@ -50,3 +46,2 @@ this.isValidLabel = true;

};
LabelPosWalker.prototype.visitForInStatement = function (node) {

@@ -56,3 +51,2 @@ this.isValidLabel = true;

};
LabelPosWalker.prototype.visitWhileStatement = function (node) {

@@ -62,3 +56,2 @@ this.isValidLabel = true;

};
LabelPosWalker.prototype.visitSwitchStatement = function (node) {

@@ -65,0 +58,0 @@ this.isValidLabel = true;

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var LabelUndefinedWalker = (function (_super) {

@@ -29,26 +28,20 @@ __extends(LabelUndefinedWalker, _super);

};
LabelUndefinedWalker.prototype.visitLabeledStatement = function (node) {
var label = node.identifier.text();
var currentScope = this.getCurrentScope();
currentScope[label] = true;
_super.prototype.visitLabeledStatement.call(this, node);
};
LabelUndefinedWalker.prototype.visitBreakStatement = function (node) {
var position = this.position() + node.leadingTriviaWidth();
this.validateLabelAt(node.identifier, position, node.breakKeyword.width());
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
this.validateLabelAt(node.identifier, position, TypeScript.width(node.breakKeyword));
_super.prototype.visitBreakStatement.call(this, node);
};
LabelUndefinedWalker.prototype.visitContinueStatement = function (node) {
var position = this.position() + node.leadingTriviaWidth();
this.validateLabelAt(node.identifier, position, node.continueKeyword.width());
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
this.validateLabelAt(node.identifier, position, TypeScript.width(node.continueKeyword));
_super.prototype.visitContinueStatement.call(this, node);
};
LabelUndefinedWalker.prototype.validateLabelAt = function (label, position, width) {
var currentScope = this.getCurrentScope();
if (label !== null && !currentScope[label.text()]) {

@@ -55,0 +48,0 @@ var failureString = Rule.FAILURE_STRING + label.text() + "'";

@@ -19,6 +19,4 @@ var __extends = this.__extends || function (d, b) {

}
return false;
};
Rule.prototype.apply = function (syntaxTree) {

@@ -31,5 +29,3 @@ var ruleFailures = [];

var disabledIntervals = this.getOptions().disabledIntervals;
var source = syntaxTree.sourceUnit().fullText();
var source = TypeScript.fullText(syntaxTree.sourceUnit());
for (var i = 0; i < lineStarts.length - 1; ++i) {

@@ -44,3 +40,2 @@ var from = lineStarts[i], to = lineStarts[i + 1];

}
return ruleFailures;

@@ -47,0 +42,0 @@ };

@@ -10,3 +10,2 @@ var __extends = this.__extends || function (d, b) {

var OPTION_PUBLIC_BEFORE_PRIVATE = "public-before-private";
var Rule = (function (_super) {

@@ -23,6 +22,5 @@ __extends(Rule, _super);

exports.Rule = Rule;
function getModifiers(isMethod, modifiers) {
var modifierStrings = modifiers.toArray().map(function (x) {
return x.firstToken().text();
var modifierStrings = modifiers.map(function (x) {
return x.text();
});

@@ -35,3 +33,2 @@ return {

}
function toString(modifiers) {

@@ -45,3 +42,2 @@ return [

}
var MemberOrderingWalker = (function (_super) {

@@ -60,3 +56,2 @@ __extends(MemberOrderingWalker, _super);

};
MemberOrderingWalker.prototype.visitMemberFunctionDeclaration = function (node) {

@@ -66,3 +61,2 @@ this.checkAndSetModifiers(node, getModifiers(true, node.modifiers));

};
MemberOrderingWalker.prototype.visitMemberVariableDeclaration = function (node) {

@@ -72,12 +66,10 @@ this.checkAndSetModifiers(node, getModifiers(false, node.modifiers));

};
MemberOrderingWalker.prototype.checkAndSetModifiers = function (node, current) {
if (!this.canAppearAfter(this.previous, current)) {
var position = this.position() + node.leadingTriviaWidth();
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
var message = "Declaration of " + toString(current) + " not allowed to appear after declaration of " + toString(this.previous);
this.addFailure(this.createFailure(position, node.width(), message));
this.addFailure(this.createFailure(position, TypeScript.width(node), message));
}
this.previous = current;
};
MemberOrderingWalker.prototype.canAppearAfter = function (previous, current) {

@@ -87,11 +79,8 @@ if (this.hasOption(OPTION_VARIABLES_BEFORE_FUNCTIONS) && previous.isMethod !== current.isMethod) {

}
if (this.hasOption(OPTION_STATIC_BEFORE_INSTANCE) && previous.isInstance !== current.isInstance) {
return Number(previous.isInstance) < Number(current.isInstance);
}
if (this.hasOption(OPTION_PUBLIC_BEFORE_PRIVATE) && previous.isPrivate !== current.isPrivate) {
return Number(previous.isPrivate) < Number(current.isPrivate);
}
return true;

@@ -98,0 +87,0 @@ };

@@ -15,7 +15,6 @@ var __extends = this.__extends || function (d, b) {

};
Rule.FAILURE_STRING = "Type decoration of 'any' is forbidden.";
Rule.FAILURE_STRING = "type decoration of 'any' is forbidden";
return Rule;
})(Lint.Rules.AbstractRule);
exports.Rule = Rule;
var NoAnyWalker = (function (_super) {

@@ -30,7 +29,6 @@ __extends(NoAnyWalker, _super);

};
NoAnyWalker.prototype.handleToken = function (token) {
if (token.kind() === 60 /* AnyKeyword */) {
var position = this.position() + token.leadingTriviaWidth();
this.addFailure(this.createFailure(position, token.width(), Rule.FAILURE_STRING));
var position = this.getPosition() + TypeScript.leadingTriviaWidth(token);
this.addFailure(this.createFailure(position, TypeScript.width(token), Rule.FAILURE_STRING));
}

@@ -37,0 +35,0 @@ };

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var NoArgWalker = (function (_super) {

@@ -29,11 +28,9 @@ __extends(NoArgWalker, _super);

var name = node.name;
var position = this.position() + node.expression.leadingTriviaWidth();
if (expression.isToken() && name.text() === "callee") {
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node.expression);
if (TypeScript.isToken(expression) && name.text() === "callee") {
var tokenExpression = expression;
if (tokenExpression.text() === "arguments") {
this.addFailure(this.createFailure(position, expression.width(), Rule.FAILURE_STRING));
this.addFailure(this.createFailure(position, TypeScript.width(expression), Rule.FAILURE_STRING));
}
}
_super.prototype.visitMemberAccessExpression.call(this, node);

@@ -40,0 +37,0 @@ };

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var NoBitwiseWalker = (function (_super) {

@@ -27,6 +26,6 @@ __extends(NoBitwiseWalker, _super);

NoBitwiseWalker.prototype.visitNode = function (node) {
if (node.kind() === 191 /* BitwiseAndExpression */ || node.kind() === 180 /* AndAssignmentExpression */ || node.kind() === 189 /* BitwiseOrExpression */ || node.kind() === 182 /* OrAssignmentExpression */ || node.kind() === 190 /* BitwiseExclusiveOrExpression */ || node.kind() === 181 /* ExclusiveOrAssignmentExpression */ || node.kind() === 202 /* LeftShiftExpression */ || node.kind() === 183 /* LeftShiftAssignmentExpression */ || node.kind() === 203 /* SignedRightShiftExpression */ || node.kind() === 184 /* SignedRightShiftAssignmentExpression */ || node.kind() === 204 /* UnsignedRightShiftExpression */ || node.kind() === 185 /* UnsignedRightShiftAssignmentExpression */ || node.kind() === 166 /* BitwiseNotExpression */) {
this.addFailure(this.createFailure(this.position() + node.leadingTriviaWidth(), node.width(), Rule.FAILURE_STRING));
var kind = node.kind();
if (kind === 192 /* BitwiseAndExpression */ || kind === 181 /* AndAssignmentExpression */ || kind === 190 /* BitwiseOrExpression */ || kind === 183 /* OrAssignmentExpression */ || kind === 191 /* BitwiseExclusiveOrExpression */ || kind === 182 /* ExclusiveOrAssignmentExpression */ || kind === 203 /* LeftShiftExpression */ || kind === 184 /* LeftShiftAssignmentExpression */ || kind === 204 /* SignedRightShiftExpression */ || kind === 185 /* SignedRightShiftAssignmentExpression */ || kind === 205 /* UnsignedRightShiftExpression */ || kind === 186 /* UnsignedRightShiftAssignmentExpression */ || kind === 167 /* BitwiseNotExpression */) {
this.addFailure(this.createFailure(this.getPosition() + TypeScript.leadingTriviaWidth(node), TypeScript.width(node), Rule.FAILURE_STRING));
}
_super.prototype.visitNode.call(this, node);

@@ -33,0 +32,0 @@ };

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var BlankLinesWalker = (function (_super) {

@@ -28,9 +27,7 @@ __extends(BlankLinesWalker, _super);

BlankLinesWalker.prototype.visitToken = function (token) {
this.findConsecutiveBlankLinesFromTriva(token.leadingTrivia().toArray(), this.position());
this.findConsecutiveBlankLinesFromTriva(token.leadingTrivia().toArray(), this.getPosition());
this.newLinesInARowSeenSoFar = 0;
this.findConsecutiveBlankLinesFromTriva(token.trailingTrivia().toArray(), this.position() + token.leadingTriviaWidth() + token.width());
this.findConsecutiveBlankLinesFromTriva(token.trailingTrivia().toArray(), this.getPosition() + TypeScript.leadingTriviaWidth(token) + TypeScript.width(token));
_super.prototype.visitToken.call(this, token);
};
BlankLinesWalker.prototype.findConsecutiveBlankLinesFromTriva = function (triviaList, currentPosition) {

@@ -45,3 +42,4 @@ var _this = this;

}
} else {
}
else {
_this.newLinesInARowSeenSoFar = 0;

@@ -48,0 +46,0 @@ }

@@ -8,3 +8,2 @@ var __extends = this.__extends || function (d, b) {

var BanRule = require("./banRule");
var Rule = (function (_super) {

@@ -11,0 +10,0 @@ __extends(Rule, _super);

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var NoConstructorVariableDeclarationsWalker = (function (_super) {

@@ -27,15 +26,16 @@ __extends(NoConstructorVariableDeclarationsWalker, _super);

NoConstructorVariableDeclarationsWalker.prototype.visitConstructorDeclaration = function (node) {
var position = this.positionAfter(node.modifiers, node.constructorKeyword, node.parameterList.openParenToken);
var list = node.parameterList.parameters;
for (var i = 0; i < list.childCount(); i++) {
var element = list.childAt(i);
if (element.kind() !== 242 /* Parameter */) {
position += element.fullWidth();
var parameterList = node.callSignature.parameterList;
var position = this.positionAfter(node.modifiers, node.constructorKeyword, parameterList.openParenToken);
var parameters = parameterList.parameters;
for (var i = 0; i < TypeScript.childCount(parameters); i++) {
var element = TypeScript.childAt(parameters, i);
if (element.kind() !== 243 /* Parameter */) {
position += TypeScript.fullWidth(element);
continue;
}
var parameter = element;
if (parameter.modifiers.childCount() > 0) {
this.addFailure(this.createFailure(position, parameter.modifiers.fullWidth(), "'" + parameter.identifier.text() + "'" + Rule.FAILURE_STRING_PART));
if (TypeScript.childCount(parameter.modifiers) > 0) {
this.addFailure(this.createFailure(position, TypeScript.fullWidth(parameter.modifiers), "'" + parameter.identifier.text() + "'" + Rule.FAILURE_STRING_PART));
}
position += parameter.fullWidth();
position += TypeScript.fullWidth(parameter);
}

@@ -42,0 +42,0 @@ _super.prototype.visitConstructorDeclaration.call(this, node);

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var NoConstructWalker = (function (_super) {

@@ -27,10 +26,9 @@ __extends(NoConstructWalker, _super);

NoConstructWalker.prototype.visitObjectCreationExpression = function (node) {
var constructorName = node.expression.fullText().trim();
var constructorName = TypeScript.fullText(node.expression).trim();
if (NoConstructWalker.FORBIDDEN_CONSTRUCTORS.indexOf(constructorName) !== -1) {
var position = this.position() + node.leadingTriviaWidth();
var width = node.newKeyword.fullWidth() + node.expression.fullWidth();
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
var width = TypeScript.fullWidth(node.newKeyword) + TypeScript.fullWidth(node.expression);
var failure = this.createFailure(position, width, Rule.FAILURE_STRING);
this.addFailure(failure);
}
_super.prototype.visitObjectCreationExpression.call(this, node);

@@ -37,0 +35,0 @@ };

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var NoDebuggerWalker = (function (_super) {

@@ -30,7 +29,6 @@ __extends(NoDebuggerWalker, _super);

};
NoDebuggerWalker.prototype.handleToken = function (token) {
if (token.kind() === 19 /* DebuggerKeyword */) {
var position = this.position() + token.leadingTriviaWidth();
this.addFailure(this.createFailure(position, token.width(), Rule.FAILURE_STRING));
var position = this.getPosition() + TypeScript.leadingTriviaWidth(token);
this.addFailure(this.createFailure(position, TypeScript.width(token), Rule.FAILURE_STRING));
}

@@ -37,0 +35,0 @@ };

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var NoDuplicateKeyWalker = (function (_super) {

@@ -32,3 +31,2 @@ __extends(NoDuplicateKeyWalker, _super);

};
NoDuplicateKeyWalker.prototype.visitSimplePropertyAssignment = function (node) {

@@ -39,9 +37,9 @@ var objectKeys = this.objectKeysStack[this.objectKeysStack.length - 1];

if (objectKeys[key]) {
var position = this.position() + node.leadingTriviaWidth();
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
var failureString = Rule.FAILURE_STRING + key + "'";
this.addFailure(this.createFailure(position, keyToken.width(), failureString));
} else {
this.addFailure(this.createFailure(position, TypeScript.width(keyToken), failureString));
}
else {
objectKeys[key] = true;
}
_super.prototype.visitSimplePropertyAssignment.call(this, node);

@@ -48,0 +46,0 @@ };

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var NoDuplicateVariableWalker = (function (_super) {

@@ -29,13 +28,11 @@ __extends(NoDuplicateVariableWalker, _super);

};
NoDuplicateVariableWalker.prototype.visitVariableDeclarator = function (node) {
var propertyName = node.propertyName, variableName = propertyName.text(), position = this.position() + propertyName.leadingTriviaWidth(), currentScope = this.getCurrentScope();
var propertyName = node.propertyName, variableName = propertyName.text(), position = this.getPosition() + TypeScript.leadingTriviaWidth(propertyName), currentScope = this.getCurrentScope();
if (currentScope.variableNames.indexOf(variableName) >= 0) {
var failureString = Rule.FAILURE_STRING + variableName + "'";
this.addFailure(this.createFailure(position, propertyName.width(), failureString));
} else {
this.addFailure(this.createFailure(position, TypeScript.width(propertyName), failureString));
}
else {
currentScope.variableNames.push(variableName);
}
_super.prototype.visitVariableDeclarator.call(this, node);

@@ -45,3 +42,2 @@ };

})(Lint.ScopeAwareRuleWalker);
var ScopeInfo = (function () {

@@ -48,0 +44,0 @@ function ScopeInfo() {

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var BlockWalker = (function (_super) {

@@ -31,29 +30,22 @@ __extends(BlockWalker, _super);

var isSkipped = this.ignoredBlocks.indexOf(node) !== -1;
if (node.statements.childCount() <= 0 && !hasCommentAfter && !hasCommentBefore && !isSkipped) {
var position = this.position() + node.leadingTriviaWidth();
var width = node.width();
if (TypeScript.childCount(node.statements) <= 0 && !hasCommentAfter && !hasCommentBefore && !isSkipped) {
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
var width = TypeScript.width(node);
this.addFailure(this.createFailure(position, width, Rule.FAILURE_STRING));
}
_super.prototype.visitBlock.call(this, node);
};
BlockWalker.prototype.visitConstructorDeclaration = function (node) {
var isSkipped = false;
for (var i = 0; i < node.parameterList.parameters.nonSeparatorCount(); i++) {
var param = node.parameterList.parameters.nonSeparatorAt(i);
for (var j = 0; j < param.modifiers.childCount(); j++) {
var modifier = param.modifiers.childAt(j).kind();
var parameters = node.callSignature.parameterList.parameters;
for (var i = 0; i < parameters.length; i++) {
var param = parameters[i];
for (var j = 0; j < TypeScript.childCount(param.modifiers); j++) {
var modifier = TypeScript.childAt(param.modifiers, j).kind();
if (modifier === 57 /* PublicKeyword */ || modifier === 55 /* PrivateKeyword */) {
isSkipped = true;
this.ignoredBlocks.push(node.block);
break;
}
}
if (isSkipped) {

@@ -63,3 +55,2 @@ break;

}
_super.prototype.visitConstructorDeclaration.call(this, node);

@@ -66,0 +57,0 @@ };

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var NoEvalWalker = (function (_super) {

@@ -28,10 +27,9 @@ __extends(NoEvalWalker, _super);

var expression = node.expression;
if (expression.isToken() && expression.kind() === 11 /* IdentifierName */) {
var firstToken = expression.firstToken();
if (TypeScript.isToken(expression) && expression.kind() === 11 /* IdentifierName */) {
var firstToken = TypeScript.firstToken(expression);
if (firstToken.text() === "eval") {
var position = this.position() + node.leadingTriviaWidth();
this.addFailure(this.createFailure(position, firstToken.width(), Rule.FAILURE_STRING));
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
this.addFailure(this.createFailure(position, TypeScript.width(firstToken), Rule.FAILURE_STRING));
}
}
_super.prototype.visitInvocationExpression.call(this, node);

@@ -38,0 +36,0 @@ };

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var NoStringLiteralWalker = (function (_super) {

@@ -30,18 +29,14 @@ __extends(NoStringLiteralWalker, _super);

};
NoStringLiteralWalker.prototype.handleElementAccessExpression = function (node) {
var argument = node.argumentExpression;
var id = argument.fullText();
var id = TypeScript.fullText(argument);
if (argument.kind() !== 14 /* StringLiteral */ || id.length < 2) {
return;
}
var unquotedString = id.substring(1, id.length - 1);
var simpleText = TypeScript.SimpleText.fromString(unquotedString);
var isValidIdentifier = TypeScript.Scanner.isValidIdentifier(simpleText, 1 /* EcmaScript5 */);
var isValidIdentifier = TypeScript.Scanner.isValidIdentifier(simpleText, 1 /* ES5 */);
if (isValidIdentifier) {
var position = this.positionAfter(node.expression, node.openBracketToken);
this.addFailure(this.createFailure(position, argument.width(), Rule.FAILURE_STRING));
this.addFailure(this.createFailure(position, TypeScript.width(argument), Rule.FAILURE_STRING));
}

@@ -48,0 +43,0 @@ };

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var NoSwitchCaseFallThroughWalker = (function (_super) {

@@ -28,24 +27,23 @@ __extends(NoSwitchCaseFallThroughWalker, _super);

var isFallingThrough = false;
var position = this.positionAfter(node.switchKeyword, node.openParenToken, node.expression, node.closeParenToken, node.openBraceToken);
var switchClauses = node.switchClauses;
for (var i = 0; i < switchClauses.childCount(); i++) {
var child = switchClauses.childAt(i);
for (var i = 0; i < switchClauses.length; i++) {
var child = switchClauses[i];
var kind = child.kind();
var fullWidth = child.fullWidth();
if (kind === 233 /* CaseSwitchClause */) {
var fullWidth = TypeScript.fullWidth(child);
if (kind === 234 /* CaseSwitchClause */) {
position += fullWidth;
var switchClause = child;
isFallingThrough = this.fallsThrough(switchClause.statements);
if (isFallingThrough && switchClause.statements.childCount() > 0 && ((switchClauses.childCount() - 1) > i)) {
if (!this.fallThroughAllowed(switchClauses.childAt(i + 1))) {
this.addFailure(this.createFailure(position - child.trailingTriviaWidth(), 1, Rule.FAILURE_STRING_PART + "'case'"));
if (isFallingThrough && switchClause.statements.length > 0 && ((switchClauses.length - 1) > i)) {
if (!this.fallThroughAllowed(switchClauses[i + 1])) {
this.addFailure(this.createFailure(position - TypeScript.trailingTriviaWidth(child), 1, Rule.FAILURE_STRING_PART + "'case'"));
}
}
} else {
}
else {
if (isFallingThrough && !this.fallThroughAllowed(child)) {
this.addFailure(this.createFailure(position - child.trailingTriviaWidth(), 1, Rule.FAILURE_STRING_PART + "'default'"));
var failureString = Rule.FAILURE_STRING_PART + "'default'";
this.addFailure(this.createFailure(position - TypeScript.trailingTriviaWidth(child), 1, failureString));
}
position += fullWidth;

@@ -56,6 +54,6 @@ }

};
NoSwitchCaseFallThroughWalker.prototype.fallThroughAllowed = function (nextCaseOrDefaultStatement) {
var childCount = nextCaseOrDefaultStatement.childCount();
var triviaList = childCount > 0 ? nextCaseOrDefaultStatement.childAt(0).leadingTrivia() : null;
var childCount = TypeScript.childCount(nextCaseOrDefaultStatement);
var firstChild = TypeScript.childAt(nextCaseOrDefaultStatement, 0);
var triviaList = childCount > 0 ? TypeScript.leadingTrivia(firstChild) : null;
if (triviaList) {

@@ -73,7 +71,6 @@ for (var i = 0; i < triviaList.count(); i++) {

};
NoSwitchCaseFallThroughWalker.prototype.fallsThrough = function (list) {
for (var i = 0; i < list.childCount(); i++) {
var nodeKind = list.childAt(i).kind();
if (nodeKind === 152 /* BreakStatement */ || nodeKind === 157 /* ThrowStatement */ || nodeKind === 150 /* ReturnStatement */) {
for (var i = 0; i < list.length; i++) {
var nodeKind = list[i].kind();
if (nodeKind === 153 /* BreakStatement */ || nodeKind === 158 /* ThrowStatement */ || nodeKind === 151 /* ReturnStatement */) {
return false;

@@ -80,0 +77,0 @@ }

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var NoTrailingCommaWalker = (function (_super) {

@@ -29,5 +28,4 @@ __extends(NoTrailingCommaWalker, _super);

var lastPosition = this.positionAfter(node.openBraceToken, propertyAssignments);
lastPosition -= propertyAssignments.trailingTriviaWidth() + 1;
if (propertyAssignments.separatorCount() === propertyAssignments.nonSeparatorCount() && propertyAssignments.nonSeparatorCount() > 0) {
lastPosition -= TypeScript.trailingTriviaWidth(propertyAssignments) + 1;
if (propertyAssignments.separatorCount() === propertyAssignments.length && propertyAssignments.length > 0) {
this.addFailure(this.createFailure(lastPosition, 1, Rule.FAILURE_STRING));

@@ -34,0 +32,0 @@ }

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var NoTrailingWhitespaceWalker = (function (_super) {

@@ -29,25 +28,18 @@ __extends(NoTrailingWhitespaceWalker, _super);

var trailingTrivia = token.trailingTrivia();
var position = this.position();
var trailingPosition = position + leadingTrivia.fullWidth() + token.width();
var position = this.getPosition();
var trailingPosition = position + token.leadingTriviaWidth() + TypeScript.width(token);
this.checkForTrailingWhitespace(leadingTrivia, position);
this.checkForTrailingWhitespace(trailingTrivia, trailingPosition);
_super.prototype.visitToken.call(this, token);
};
NoTrailingWhitespaceWalker.prototype.checkForTrailingWhitespace = function (triviaList, position) {
var start = position;
for (var i = 0; i < triviaList.count() - 1; i++) {
var trivia = triviaList.syntaxTriviaAt(i);
var nextTrivia = triviaList.syntaxTriviaAt(i + 1);
if (trivia.kind() === 4 /* WhitespaceTrivia */ && nextTrivia.kind() === 5 /* NewLineTrivia */) {
var width = trivia.fullWidth();
var failure = this.createFailure(start, width, Rule.FAILURE_STRING);
this.addFailure(failure);
}
start += trivia.fullWidth();

@@ -54,0 +46,0 @@ }

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var UnreachableWalker = (function (_super) {

@@ -29,20 +28,15 @@ __extends(UnreachableWalker, _super);

var previousReturned = this.hasReturned;
if (node.kind() === 129 /* FunctionDeclaration */) {
if (node.kind() === 130 /* FunctionDeclaration */) {
this.hasReturned = false;
}
if (this.hasReturned) {
this.hasReturned = false;
var position = this.position() + node.leadingTriviaWidth();
this.addFailure(this.createFailure(position, node.width(), Rule.FAILURE_STRING));
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
this.addFailure(this.createFailure(position, TypeScript.width(node), Rule.FAILURE_STRING));
}
_super.prototype.visitNode.call(this, node);
if (node.kind() === 129 /* FunctionDeclaration */) {
if (node.kind() === 130 /* FunctionDeclaration */) {
this.hasReturned = previousReturned;
}
};
UnreachableWalker.prototype.visitBlock = function (node) {

@@ -52,3 +46,2 @@ _super.prototype.visitBlock.call(this, node);

};
UnreachableWalker.prototype.visitCaseSwitchClause = function (node) {

@@ -58,3 +51,2 @@ _super.prototype.visitCaseSwitchClause.call(this, node);

};
UnreachableWalker.prototype.visitDefaultSwitchClause = function (node) {

@@ -64,3 +56,2 @@ _super.prototype.visitDefaultSwitchClause.call(this, node);

};
UnreachableWalker.prototype.visitIfStatement = function (node) {

@@ -70,3 +61,2 @@ _super.prototype.visitIfStatement.call(this, node);

};
UnreachableWalker.prototype.visitElseClause = function (node) {

@@ -76,5 +66,4 @@ _super.prototype.visitElseClause.call(this, node);

};
UnreachableWalker.prototype.visitOptionalNode = function (node) {
if (node != null && node.kind() === 235 /* ElseClause */) {
if (node != null && node.kind() === 236 /* ElseClause */) {
this.hasReturned = false;

@@ -84,3 +73,2 @@ }

};
UnreachableWalker.prototype.visitBreakStatement = function (node) {

@@ -90,3 +78,2 @@ _super.prototype.visitBreakStatement.call(this, node);

};
UnreachableWalker.prototype.visitContinueStatement = function (node) {

@@ -96,3 +83,2 @@ _super.prototype.visitContinueStatement.call(this, node);

};
UnreachableWalker.prototype.visitReturnStatement = function (node) {

@@ -102,3 +88,2 @@ _super.prototype.visitReturnStatement.call(this, node);

};
UnreachableWalker.prototype.visitThrowStatement = function (node) {

@@ -105,0 +90,0 @@ _super.prototype.visitThrowStatement.call(this, node);

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var UnusedExpressionWalker = (function (_super) {

@@ -29,3 +28,3 @@ __extends(UnusedExpressionWalker, _super);

this.expressionIsUnused = true;
var position = this.position() + node.leadingTriviaWidth();
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
_super.prototype.visitExpressionStatement.call(this, node);

@@ -38,25 +37,24 @@ if (this.expressionIsUnused) {

}
} else if (node.expression.kind() === 170 /* DeleteExpression */) {
}
else if (node.expression.kind() === 171 /* DeleteExpression */) {
return;
}
this.addFailure(this.createFailure(position, node.width(), Rule.FAILURE_STRING));
this.addFailure(this.createFailure(position, TypeScript.width(node), Rule.FAILURE_STRING));
}
};
UnusedExpressionWalker.prototype.visitBinaryExpression = function (node) {
_super.prototype.visitBinaryExpression.call(this, node);
switch (node.kind()) {
case 174 /* AssignmentExpression */:
case 175 /* AddAssignmentExpression */:
case 176 /* SubtractAssignmentExpression */:
case 177 /* MultiplyAssignmentExpression */:
case 178 /* DivideAssignmentExpression */:
case 179 /* ModuloAssignmentExpression */:
case 180 /* AndAssignmentExpression */:
case 181 /* ExclusiveOrAssignmentExpression */:
case 182 /* OrAssignmentExpression */:
case 183 /* LeftShiftAssignmentExpression */:
case 184 /* SignedRightShiftAssignmentExpression */:
case 185 /* UnsignedRightShiftAssignmentExpression */:
case 175 /* AssignmentExpression */:
case 176 /* AddAssignmentExpression */:
case 177 /* SubtractAssignmentExpression */:
case 178 /* MultiplyAssignmentExpression */:
case 179 /* DivideAssignmentExpression */:
case 180 /* ModuloAssignmentExpression */:
case 181 /* AndAssignmentExpression */:
case 182 /* ExclusiveOrAssignmentExpression */:
case 183 /* OrAssignmentExpression */:
case 184 /* LeftShiftAssignmentExpression */:
case 185 /* SignedRightShiftAssignmentExpression */:
case 186 /* UnsignedRightShiftAssignmentExpression */:
this.expressionIsUnused = false;

@@ -68,8 +66,7 @@ break;

};
UnusedExpressionWalker.prototype.visitPrefixUnaryExpression = function (node) {
_super.prototype.visitPrefixUnaryExpression.call(this, node);
switch (node.kind()) {
case 168 /* PreIncrementExpression */:
case 169 /* PreDecrementExpression */:
case 169 /* PreIncrementExpression */:
case 170 /* PreDecrementExpression */:
this.expressionIsUnused = false;

@@ -81,3 +78,2 @@ break;

};
UnusedExpressionWalker.prototype.visitPostfixUnaryExpression = function (node) {

@@ -87,3 +83,2 @@ _super.prototype.visitPostfixUnaryExpression.call(this, node);

};
UnusedExpressionWalker.prototype.visitBlock = function (node) {

@@ -93,3 +88,2 @@ _super.prototype.visitBlock.call(this, node);

};
UnusedExpressionWalker.prototype.visitSimpleArrowFunctionExpression = function (node) {

@@ -99,3 +93,2 @@ _super.prototype.visitSimpleArrowFunctionExpression.call(this, node);

};
UnusedExpressionWalker.prototype.visitParenthesizedArrowFunctionExpression = function (node) {

@@ -105,3 +98,2 @@ _super.prototype.visitParenthesizedArrowFunctionExpression.call(this, node);

};
UnusedExpressionWalker.prototype.visitInvocationExpression = function (node) {

@@ -111,3 +103,2 @@ _super.prototype.visitInvocationExpression.call(this, node);

};
UnusedExpressionWalker.prototype.visitConditionalExpression = function (node) {

@@ -123,3 +114,2 @@ this.visitNodeOrToken(node.condition);

var secondExpressionIsUnused = this.expressionIsUnused;
this.expressionIsUnused = firstExpressionIsUnused || secondExpressionIsUnused;

@@ -126,0 +116,0 @@ };

@@ -8,3 +8,2 @@ var __extends = this.__extends || function (d, b) {

var OPTION_CHECK_PARAMETERS = "check-parameters";
var Rule = (function (_super) {

@@ -16,6 +15,6 @@ __extends(Rule, _super);

Rule.prototype.apply = function (syntaxTree) {
var languageServiceHost = new Lint.LanguageServiceHost(syntaxTree, syntaxTree.sourceUnit().fullText());
var languageServices = new TypeScript.Services.LanguageService(languageServiceHost);
return this.applyWithWalker(new NoUnusedVariablesWalker(syntaxTree, this.getOptions(), languageServices));
var documentRegistry = ts.createDocumentRegistry();
var languageServiceHost = new Lint.LanguageServiceHost(syntaxTree, TypeScript.fullText(syntaxTree.sourceUnit()));
var languageService = ts.createLanguageService(languageServiceHost, documentRegistry);
return this.applyWithWalker(new NoUnusedVariablesWalker(syntaxTree, this.getOptions(), languageService));
};

@@ -26,6 +25,5 @@ Rule.FAILURE_STRING = "unused variable: ";

exports.Rule = Rule;
var NoUnusedVariablesWalker = (function (_super) {
__extends(NoUnusedVariablesWalker, _super);
function NoUnusedVariablesWalker(syntaxTree, options, languageServices) {
function NoUnusedVariablesWalker(syntaxTree, options, languageService) {
_super.call(this, syntaxTree, options);

@@ -35,3 +33,3 @@ this.fileName = syntaxTree.fileName();

this.skipParameterDeclaration = false;
this.languageServices = languageServices;
this.languageService = languageService;
}

@@ -45,13 +43,9 @@ NoUnusedVariablesWalker.prototype.visitImportDeclaration = function (node) {

};
NoUnusedVariablesWalker.prototype.visitVariableDeclarator = function (node) {
var propertyName = node.propertyName, variableName = propertyName.text(), position = this.position() + propertyName.leadingTriviaWidth();
var propertyName = node.propertyName, variableName = propertyName.text(), position = this.getPosition() + propertyName.leadingTriviaWidth();
if (!this.skipVariableDeclaration) {
this.validateReferencesForVariable(variableName, position);
}
_super.prototype.visitVariableDeclarator.call(this, node);
};
NoUnusedVariablesWalker.prototype.visitMethodSignature = function (node) {

@@ -62,3 +56,2 @@ this.skipParameterDeclaration = true;

};
NoUnusedVariablesWalker.prototype.visitIndexSignature = function (node) {

@@ -69,3 +62,2 @@ this.skipParameterDeclaration = true;

};
NoUnusedVariablesWalker.prototype.visitVariableStatement = function (node) {

@@ -75,40 +67,29 @@ if (this.hasModifier(node.modifiers, 47 /* ExportKeyword */)) {

}
_super.prototype.visitVariableStatement.call(this, node);
this.skipVariableDeclaration = false;
};
NoUnusedVariablesWalker.prototype.visitFunctionDeclaration = function (node) {
var variableName = node.identifier.text();
var position = this.positionAfter(node.modifiers, node.functionKeyword);
if (!this.hasModifier(node.modifiers, 47 /* ExportKeyword */)) {
this.validateReferencesForVariable(variableName, position);
}
_super.prototype.visitFunctionDeclaration.call(this, node);
};
NoUnusedVariablesWalker.prototype.visitParameter = function (node) {
var variableName = node.identifier.text();
var position = this.positionAfter(node.dotDotDotToken, node.modifiers) + node.leadingTriviaWidth();
var position = this.positionAfter(node.dotDotDotToken, node.modifiers) + TypeScript.leadingTriviaWidth(node);
if (!this.hasModifier(node.modifiers, 57 /* PublicKeyword */) && !this.skipParameterDeclaration && this.hasOption(OPTION_CHECK_PARAMETERS)) {
this.validateReferencesForVariable(variableName, position);
}
_super.prototype.visitParameter.call(this, node);
};
NoUnusedVariablesWalker.prototype.visitMemberVariableDeclaration = function (node) {
var modifiers = node.modifiers;
if (!this.hasModifier(modifiers, 55 /* PrivateKeyword */)) {
this.skipVariableDeclaration = true;
}
_super.prototype.visitMemberVariableDeclaration.call(this, node);
this.skipVariableDeclaration = false;
};
NoUnusedVariablesWalker.prototype.visitMemberFunctionDeclaration = function (node) {

@@ -118,13 +99,10 @@ var modifiers = node.modifiers;

var position = this.positionAfter(node.modifiers);
if (this.hasModifier(modifiers, 55 /* PrivateKeyword */)) {
this.validateReferencesForVariable(variableName, position);
}
_super.prototype.visitMemberFunctionDeclaration.call(this, node);
};
NoUnusedVariablesWalker.prototype.hasModifier = function (modifiers, modifierKind) {
for (var i = 0, n = modifiers.childCount(); i < n; i++) {
var modifier = modifiers.childAt(i);
for (var i = 0, n = modifiers.length; i < n; i++) {
var modifier = modifiers[i];
if (modifier.kind() === modifierKind) {

@@ -134,8 +112,6 @@ return true;

}
return false;
};
NoUnusedVariablesWalker.prototype.validateReferencesForVariable = function (name, position) {
var references = this.languageServices.getReferencesAtPosition(this.fileName, position);
var references = this.languageService.getReferencesAtPosition(this.fileName, position);
if (references.length <= 1) {

@@ -142,0 +118,0 @@ var failureString = Rule.FAILURE_STRING + "'" + name + "'";

@@ -13,6 +13,6 @@ var __extends = this.__extends || function (d, b) {

Rule.prototype.apply = function (syntaxTree) {
var languageServiceHost = new Lint.LanguageServiceHost(syntaxTree, syntaxTree.sourceUnit().fullText());
var languageServices = new TypeScript.Services.LanguageService(languageServiceHost);
return this.applyWithWalker(new NoUseBeforeDeclareWalker(syntaxTree, this.getOptions(), languageServices));
var documentRegistry = ts.createDocumentRegistry();
var languageServiceHost = new Lint.LanguageServiceHost(syntaxTree, TypeScript.fullText(syntaxTree.sourceUnit()));
var languageService = ts.createLanguageService(languageServiceHost, documentRegistry);
return this.applyWithWalker(new NoUseBeforeDeclareWalker(syntaxTree, this.getOptions(), languageService));
};

@@ -24,17 +24,15 @@ Rule.FAILURE_STRING_PREFIX = "variable '";

exports.Rule = Rule;
var NoUseBeforeDeclareWalker = (function (_super) {
__extends(NoUseBeforeDeclareWalker, _super);
function NoUseBeforeDeclareWalker(syntaxTree, options, languageServices) {
function NoUseBeforeDeclareWalker(syntaxTree, options, languageService) {
_super.call(this, syntaxTree, options);
this.fileName = syntaxTree.fileName();
this.languageServices = languageServices;
this.languageService = languageService;
this.classStartPosition = 0;
}
NoUseBeforeDeclareWalker.prototype.visitClassDeclaration = function (node) {
this.classStartPosition = this.position();
this.classStartPosition = this.getPosition();
_super.prototype.visitClassDeclaration.call(this, node);
this.classStartPosition = 0;
};
NoUseBeforeDeclareWalker.prototype.visitImportDeclaration = function (node) {

@@ -45,14 +43,12 @@ var position = this.positionAfter(node.importKeyword);

};
NoUseBeforeDeclareWalker.prototype.visitVariableDeclarator = function (node) {
var position = this.position() + node.propertyName.leadingTriviaWidth();
var position = this.getPosition() + node.propertyName.leadingTriviaWidth();
this.validateUsageForVariable(node.propertyName.text(), position);
_super.prototype.visitVariableDeclarator.call(this, node);
};
NoUseBeforeDeclareWalker.prototype.validateUsageForVariable = function (name, position) {
var _this = this;
var references = this.languageServices.getReferencesAtPosition(this.fileName, position);
var references = this.languageService.getReferencesAtPosition(this.fileName, position);
references.forEach(function (reference) {
var referencePosition = reference.minChar;
var referencePosition = reference.textSpan.start();
if (_this.classStartPosition <= referencePosition && referencePosition < position) {

@@ -59,0 +55,0 @@ var failureString = Rule.FAILURE_STRING_PREFIX + name + Rule.FAILURE_STRING_POSTFIX;

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var RequiresWalker = (function (_super) {

@@ -29,9 +28,8 @@ __extends(RequiresWalker, _super);

};
RequiresWalker.prototype.visitInvocationExpression = function (node) {
if (this.getCurrentDepth() <= 1 && node.expression.isToken()) {
if (this.getCurrentDepth() <= 1 && TypeScript.isToken(node.expression)) {
var expressionText = node.expression.text();
if (expressionText === "require") {
var position = this.position() + node.leadingTriviaWidth();
this.addFailure(this.createFailure(position, node.width(), Rule.FAILURE_STRING));
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
this.addFailure(this.createFailure(position, TypeScript.width(node), Rule.FAILURE_STRING));
}

@@ -38,0 +36,0 @@ }

@@ -11,3 +11,2 @@ var __extends = this.__extends || function (d, b) {

var OPTION_WHITESPACE = "check-whitespace";
var Rule = (function (_super) {

@@ -29,3 +28,2 @@ __extends(Rule, _super);

exports.Rule = Rule;
var BraceWalker = (function (_super) {

@@ -40,3 +38,2 @@ __extends(BraceWalker, _super);

var lastState = this.getLastState();
if (kind === 70 /* OpenBraceToken */ && lastState !== undefined) {

@@ -46,46 +43,38 @@ var lastKind = lastState.token.kind();

var lastLine = this.getLine(lastState.position);
var currentLine = this.getLine(this.position());
var position = this.position() + token.leadingTriviaWidth();
var currentLine = this.getLine(this.getPosition());
var position = this.getPosition() + TypeScript.leadingTriviaWidth(token);
if (this.hasOption(OPTION_BRACE) && currentLine !== lastLine) {
failure = this.createFailure(position, token.width(), Rule.BRACE_FAILURE_STRING);
} else if (this.hasOption(OPTION_WHITESPACE) && !this.hasTrailingWhiteSpace(lastState.token)) {
failure = this.createFailure(position, token.width(), Rule.WHITESPACE_FAILURE_STRING);
failure = this.createFailure(position, TypeScript.width(token), Rule.BRACE_FAILURE_STRING);
}
else if (this.hasOption(OPTION_WHITESPACE) && !this.hasTrailingWhiteSpace(lastState.token)) {
failure = this.createFailure(position, TypeScript.width(token), Rule.WHITESPACE_FAILURE_STRING);
}
}
}
if (failure) {
this.addFailure(failure);
}
_super.prototype.visitToken.call(this, token);
};
BraceWalker.prototype.visitElseClause = function (node) {
var lastState = this.getLastState();
var position = this.position() + node.leadingTriviaWidth();
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
if (this.hasOption(OPTION_ELSE) && lastState !== undefined && !this.hasTrailingWhiteSpace(lastState.token)) {
var failure = this.createFailure(position, node.elseKeyword.width(), Rule.ELSE_FAILURE_STRING);
var failure = this.createFailure(position, TypeScript.width(node.elseKeyword), Rule.ELSE_FAILURE_STRING);
this.addFailure(failure);
}
_super.prototype.visitElseClause.call(this, node);
};
BraceWalker.prototype.visitCatchClause = function (node) {
var lastState = this.getLastState();
var position = this.position() + node.leadingTriviaWidth();
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
if (this.hasOption(OPTION_CATCH) && lastState !== undefined && !this.hasTrailingWhiteSpace(lastState.token)) {
var failure = this.createFailure(position, node.catchKeyword.width(), Rule.CATCH_FAILURE_STRING);
var failure = this.createFailure(position, TypeScript.width(node.catchKeyword), Rule.CATCH_FAILURE_STRING);
this.addFailure(failure);
}
_super.prototype.visitCatchClause.call(this, node);
};
BraceWalker.prototype.getLine = function (position) {
return this.getSyntaxTree().lineMap().getLineAndCharacterFromPosition(position).line();
};
BraceWalker.prototype.hasTrailingWhiteSpace = function (token) {

@@ -96,3 +85,2 @@ var trivia = token.trailingTrivia();

}
var kind = trivia.syntaxTriviaAt(0).kind();

@@ -99,0 +87,0 @@ return (kind === 4 /* WhitespaceTrivia */);

@@ -12,3 +12,2 @@ var __extends = this.__extends || function (d, b) {

})(QuoteMark || (QuoteMark = {}));
var Rule = (function (_super) {

@@ -24,6 +23,4 @@ __extends(Rule, _super);

}
return false;
};
Rule.prototype.apply = function (syntaxTree) {

@@ -37,3 +34,2 @@ return this.applyWithWalker(new QuoteWalker(syntaxTree, this.getOptions()));

exports.Rule = Rule;
var QuoteWalker = (function (_super) {

@@ -44,6 +40,6 @@ __extends(QuoteWalker, _super);

var quoteMarkString = this.getOptions()[0];
if (quoteMarkString === "single") {
this.quoteMark = 0 /* SINGLE_QUOTES */;
} else {
}
else {
this.quoteMark = 1 /* DOUBLE_QUOTES */;

@@ -56,3 +52,2 @@ }

};
QuoteWalker.prototype.handleToken = function (token) {

@@ -62,5 +57,4 @@ var failure = null;

var fullText = token.fullText();
var width = token.width();
var position = this.position() + token.leadingTriviaWidth();
var width = TypeScript.width(token);
var position = this.getPosition() + TypeScript.leadingTriviaWidth(token);
var textStart = token.leadingTriviaWidth();

@@ -70,3 +64,2 @@ var textEnd = textStart + width - 1;

var lastCharacter = fullText.charAt(textEnd);
if (this.quoteMark === 0 /* SINGLE_QUOTES */) {

@@ -76,3 +69,4 @@ if (firstCharacter !== "'" || lastCharacter !== "'") {

}
} else if (this.quoteMark === 1 /* DOUBLE_QUOTES */) {
}
else if (this.quoteMark === 1 /* DOUBLE_QUOTES */) {
if (firstCharacter !== "\"" || lastCharacter !== "\"") {

@@ -83,3 +77,2 @@ failure = this.createFailure(position, width, Rule.DOUBLE_QUOTE_FAILURE);

}
if (failure) {

@@ -86,0 +79,0 @@ this.addFailure(failure);

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var RadixWalker = (function (_super) {

@@ -28,11 +27,10 @@ __extends(RadixWalker, _super);

var expression = node.expression;
if (expression.isToken() && expression.kind() === 11 /* IdentifierName */) {
var firstToken = expression.firstToken();
if (TypeScript.isToken(expression) && expression.kind() === 11 /* IdentifierName */) {
var firstToken = TypeScript.firstToken(expression);
var arguments = node.argumentList.arguments;
if (firstToken.text() === "parseInt" && arguments.childCount() < 2) {
var position = this.position() + node.leadingTriviaWidth();
this.addFailure(this.createFailure(position, node.width(), Rule.FAILURE_STRING));
if (firstToken.text() === "parseInt" && arguments.length < 2) {
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
this.addFailure(this.createFailure(position, TypeScript.width(node), Rule.FAILURE_STRING));
}
}
_super.prototype.visitInvocationExpression.call(this, node);

@@ -39,0 +37,0 @@ };

@@ -13,21 +13,3 @@ var __extends = this.__extends || function (d, b) {

Rule.prototype.apply = function (syntaxTree) {
var ruleFailures = [];
var diagnostics = syntaxTree.diagnostics();
var disabledIntervals = this.getOptions().disabledIntervals;
for (var i = 0; i < diagnostics.length; ++i) {
var diagnostic = diagnostics[i];
var diagnosticKey = diagnostic.diagnosticKey();
if (diagnosticKey === TypeScript.DiagnosticCode.Automatic_semicolon_insertion_not_allowed) {
var position = diagnostic.start();
var ruleFailure = new Lint.RuleFailure(syntaxTree, position, position, Rule.FAILURE_STRING, this.getOptions().ruleName);
if (!Lint.doesIntersect(ruleFailure, disabledIntervals)) {
ruleFailures.push(ruleFailure);
}
}
}
return ruleFailures;
return this.applyWithWalker(new SemicolonWalker(syntaxTree, this.getOptions()));
};

@@ -38,1 +20,55 @@ Rule.FAILURE_STRING = "missing semicolon";

exports.Rule = Rule;
var SemicolonWalker = (function (_super) {
__extends(SemicolonWalker, _super);
function SemicolonWalker() {
_super.apply(this, arguments);
}
SemicolonWalker.prototype.visitVariableStatement = function (node) {
var position = this.positionAfter(node.modifiers, node.variableDeclaration);
this.checkSemicolonAt(node.semicolonToken, position);
_super.prototype.visitVariableStatement.call(this, node);
};
SemicolonWalker.prototype.visitExpressionStatement = function (node) {
var position = this.positionAfter(node.expression);
this.checkSemicolonAt(node.semicolonToken, position);
_super.prototype.visitExpressionStatement.call(this, node);
};
SemicolonWalker.prototype.visitReturnStatement = function (node) {
var position = this.positionAfter(node.returnKeyword, node.expression);
this.checkSemicolonAt(node.semicolonToken, position);
_super.prototype.visitReturnStatement.call(this, node);
};
SemicolonWalker.prototype.visitBreakStatement = function (node) {
var position = this.positionAfter(node.breakKeyword, node.identifier);
this.checkSemicolonAt(node.semicolonToken, position);
_super.prototype.visitBreakStatement.call(this, node);
};
SemicolonWalker.prototype.visitContinueStatement = function (node) {
var position = this.positionAfter(node.continueKeyword, node.identifier);
this.checkSemicolonAt(node.semicolonToken, position);
_super.prototype.visitContinueStatement.call(this, node);
};
SemicolonWalker.prototype.visitThrowStatement = function (node) {
var position = this.positionAfter(node.throwKeyword, node.expression);
this.checkSemicolonAt(node.semicolonToken, position);
_super.prototype.visitThrowStatement.call(this, node);
};
SemicolonWalker.prototype.visitDoStatement = function (node) {
var position = this.positionAfter(node.doKeyword, node.statement, node.whileKeyword, node.openParenToken, node.condition, node.closeParenToken);
this.checkSemicolonAt(node.semicolonToken, position);
_super.prototype.visitDoStatement.call(this, node);
};
SemicolonWalker.prototype.visitDebuggerStatement = function (node) {
var position = this.positionAfter(node.debuggerKeyword);
this.checkSemicolonAt(node.semicolonToken, position);
_super.prototype.visitDebuggerStatement.call(this, node);
};
SemicolonWalker.prototype.checkSemicolonAt = function (token, position) {
if (token != null) {
return;
}
var adjustedPosition = (position <= this.getLimit()) ? position - 1 : position;
this.addFailure(this.createFailure(adjustedPosition, 0, Rule.FAILURE_STRING));
};
return SemicolonWalker;
})(Lint.RuleWalker);

@@ -8,3 +8,2 @@ var __extends = this.__extends || function (d, b) {

var OPTION_ALLOW_NULL_CHECK = "allow-null-check";
var Rule = (function (_super) {

@@ -23,3 +22,2 @@ __extends(Rule, _super);

exports.Rule = Rule;
var ComparisonWalker = (function (_super) {

@@ -32,3 +30,2 @@ __extends(ComparisonWalker, _super);

var position = this.positionAfter(node.left);
if (!this.isExpressionAllowed(node)) {

@@ -39,23 +36,18 @@ this.handleOperatorToken(position, node.operatorToken);

};
ComparisonWalker.prototype.isExpressionAllowed = function (node) {
var nullKeyword = 32 /* NullKeyword */;
if (this.hasOption(OPTION_ALLOW_NULL_CHECK) && (node.left.kind() === nullKeyword || node.right.kind() === nullKeyword)) {
return true;
}
return false;
};
ComparisonWalker.prototype.handleOperatorToken = function (position, operatorToken) {
var failure = null;
var operatorKind = operatorToken.kind();
if (operatorKind === 84 /* EqualsEqualsToken */) {
failure = this.createFailure(position, operatorToken.width(), Rule.EQ_FAILURE_STRING);
} else if (operatorKind === 86 /* ExclamationEqualsToken */) {
failure = this.createFailure(position, operatorToken.width(), Rule.NEQ_FAILURE_STRING);
failure = this.createFailure(position, TypeScript.width(operatorToken), Rule.EQ_FAILURE_STRING);
}
else if (operatorKind === 86 /* ExclamationEqualsToken */) {
failure = this.createFailure(position, TypeScript.width(operatorToken), Rule.NEQ_FAILURE_STRING);
}
if (failure) {

@@ -62,0 +54,0 @@ this.addFailure(failure);

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var TypedefWalker = (function (_super) {

@@ -27,13 +26,9 @@ __extends(TypedefWalker, _super);

TypedefWalker.prototype.visitCallSignature = function (node) {
this.checkTypeAnnotation("callSignature", node, node.typeAnnotation);
this.checkTypeAnnotation("call-signature", node, node.typeAnnotation);
_super.prototype.visitCallSignature.call(this, node);
};
TypedefWalker.prototype.visitIndexSignature = function (node) {
this.checkTypeAnnotation("indexSignature", node, node.typeAnnotation);
this.checkTypeAnnotation("index-signature", node, node.typeAnnotation);
_super.prototype.visitIndexSignature.call(this, node);
};
TypedefWalker.prototype.visitParameter = function (node) {

@@ -43,29 +38,22 @@ this.checkTypeAnnotation("parameter", node, node.typeAnnotation, node.identifier);

};
TypedefWalker.prototype.visitPropertySignature = function (node) {
this.checkTypeAnnotation("propertySignature", node, node.typeAnnotation, node.propertyName);
this.checkTypeAnnotation("property-signature", node, node.typeAnnotation, node.propertyName);
_super.prototype.visitPropertySignature.call(this, node);
};
TypedefWalker.prototype.visitVariableDeclaration = function (node) {
for (var i = 0, n = node.variableDeclarators.nonSeparatorCount(); i < n; i++) {
var item = node.variableDeclarators.nonSeparatorAt(i);
this.checkTypeAnnotation("variableDeclarator", node, item.typeAnnotation, item.propertyName);
for (var i = 0, n = node.variableDeclarators.length; i < n; i++) {
var item = node.variableDeclarators[i];
this.checkTypeAnnotation("variable-declarator", node, item.typeAnnotation, item.propertyName);
}
_super.prototype.visitVariableDeclaration.call(this, node);
};
TypedefWalker.prototype.visitMemberVariableDeclaration = function (node) {
var variableDeclarator = node.variableDeclarator;
this.checkTypeAnnotation("memberVariableDeclarator", variableDeclarator, variableDeclarator.typeAnnotation, variableDeclarator.propertyName);
this.checkTypeAnnotation("member-variable-declarator", variableDeclarator, variableDeclarator.typeAnnotation, variableDeclarator.propertyName);
_super.prototype.visitMemberVariableDeclaration.call(this, node);
};
TypedefWalker.prototype.checkTypeAnnotation = function (option, node, typeAnnotation, name) {
if (this.hasOption(option) && !typeAnnotation) {
var ns = name ? ": '" + name.text() + "'" : "";
var failure = this.createFailure(this.positionAfter(node), 1, "expected " + option + ns + " to have a typedef.");
var failure = this.createFailure(this.positionAfter(node), 1, "expected " + option + ns + " to have a typedef");
this.addFailure(failure);

@@ -72,0 +60,0 @@ }

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var TypedefWhitespaceWalker = (function (_super) {

@@ -27,47 +26,39 @@ __extends(TypedefWhitespaceWalker, _super);

TypedefWhitespaceWalker.prototype.visitCallSignature = function (node) {
this.checkSpace("callSignature", node, node.typeAnnotation);
this.checkSpace("call-signature", node, node.typeAnnotation);
_super.prototype.visitCallSignature.call(this, node);
};
TypedefWhitespaceWalker.prototype.visitCatchClause = function (node) {
this.checkSpace("catchClause", node, node.typeAnnotation);
this.checkSpace("catch-clause", node, node.typeAnnotation);
_super.prototype.visitCatchClause.call(this, node);
};
TypedefWhitespaceWalker.prototype.visitIndexSignature = function (node) {
this.checkSpace("indexSignature", node, node.typeAnnotation);
this.checkSpace("index-signature", node, node.typeAnnotation);
_super.prototype.visitIndexSignature.call(this, node);
};
TypedefWhitespaceWalker.prototype.visitParameter = function (node) {
this.checkSpace("parameter", node, node.typeAnnotation);
_super.prototype.visitParameter.call(this, node);
};
TypedefWhitespaceWalker.prototype.visitPropertySignature = function (node) {
this.checkSpace("propertySignature", node, node.typeAnnotation);
this.checkSpace("property-signature", node, node.typeAnnotation);
_super.prototype.visitPropertySignature.call(this, node);
};
TypedefWhitespaceWalker.prototype.visitVariableDeclarator = function (node) {
this.checkSpace("variableDeclarator", node, node.typeAnnotation);
this.checkSpace("variable-declarator", node, node.typeAnnotation);
_super.prototype.visitVariableDeclarator.call(this, node);
};
TypedefWhitespaceWalker.prototype.checkSpace = function (option, node, typeAnnotation) {
if (this.hasOption(option) && typeAnnotation) {
var typeAnnotationChildIndex = this.getTypeAnnotationIndex(node), precedingChild = this.findPrecedingChild(node, typeAnnotationChildIndex), hasLeadingWhitespace = this.hasLeadingWhitespace(precedingChild.trailingTrivia());
var typeAnnotationChildIndex = this.getTypeAnnotationIndex(node);
var precedingChild = this.findPrecedingChild(node, typeAnnotationChildIndex);
var trailingTrivia = TypeScript.trailingTrivia(precedingChild);
var hasLeadingWhitespace = this.hasLeadingWhitespace(trailingTrivia);
if (hasLeadingWhitespace !== (this.getOption(option) === "space")) {
this.addFailure(this.createFailure(this.positionAfter(precedingChild), 1, "expected " + this.getOption(option) + " in " + option + "."));
var position = this.positionAfter(precedingChild);
var message = "expected " + this.getOption(option) + " in " + option;
var failure = this.createFailure(position, 1, message);
this.addFailure(failure);
}
}
};
TypedefWhitespaceWalker.prototype.hasOption = function (option) {

@@ -78,12 +69,8 @@ var allOptions = this.getOptions();

}
var options = allOptions[0];
if (!options) {
return false;
}
return !!options[option];
};
TypedefWhitespaceWalker.prototype.getOption = function (option) {

@@ -94,33 +81,28 @@ var allOptions = this.getOptions();

}
var options = allOptions[0];
return options[option];
};
TypedefWhitespaceWalker.prototype.getTypeAnnotationIndex = function (node) {
var index = 0, current = node.childAt(index);
while (!(current instanceof TypeScript.TypeAnnotationSyntax)) {
var index = 0;
var current = TypeScript.childAt(node, index);
while (!(current instanceof TypeScript.Syntax.Concrete.TypeAnnotationSyntax)) {
index++;
current = node.childAt(index);
current = TypeScript.childAt(node, index);
}
return index;
};
TypedefWhitespaceWalker.prototype.findPrecedingChild = function (node, startIndex) {
var precedingChild, offset = 0;
var offset = 0;
var precedingChild;
while (!precedingChild) {
offset++;
precedingChild = node.childAt(startIndex - offset);
precedingChild = TypeScript.childAt(node, startIndex - offset);
}
return precedingChild;
};
TypedefWhitespaceWalker.prototype.hasLeadingWhitespace = function (trivia) {
if (trivia.count() < 1) {
return false;
} else {
}
else {
var kind = trivia.syntaxTriviaAt(0).kind();

@@ -127,0 +109,0 @@ if (kind !== 4 /* WhitespaceTrivia */ && kind !== 5 /* NewLineTrivia */) {

@@ -19,3 +19,2 @@ var __extends = this.__extends || function (d, b) {

exports.Rule = Rule;
var UseStrictWalker = (function (_super) {

@@ -29,5 +28,5 @@ __extends(UseStrictWalker, _super);

};
UseStrictWalker.prototype.visitModuleDeclaration = function (node) {
if (this.getCurrentDepth() === 2 && !(node.modifiers.childCount() > 0 && node.modifiers.childAt(0).kind() === 63 /* DeclareKeyword */)) {
var childCount = TypeScript.childCount(node.modifiers);
if (this.getCurrentDepth() === 2 && !(childCount > 0 && TypeScript.childAt(node.modifiers, 0).kind() === 63 /* DeclareKeyword */)) {
if (this.hasOption(UseStrictWalker.OPTION_CHECK_MODULE)) {

@@ -37,6 +36,4 @@ this.checkUseStrict(node, node.moduleElements);

}
_super.prototype.visitModuleDeclaration.call(this, node);
};
UseStrictWalker.prototype.visitFunctionDeclaration = function (node) {

@@ -48,19 +45,14 @@ if (this.getCurrentDepth() === 2) {

}
_super.prototype.visitFunctionDeclaration.call(this, node);
};
UseStrictWalker.prototype.checkUseStrict = function (node, syntaxList) {
var isFailure = true;
if (syntaxList.childCount() > 0) {
var firstStatement = syntaxList.childAt(0);
if (firstStatement.kind() === 149 /* ExpressionStatement */ && firstStatement.childCount() === 2) {
var firstChild = firstStatement.childAt(0);
var secondChild = firstStatement.childAt(1);
if (firstChild.isToken()) {
var firstToken = firstChild.firstToken();
if (firstToken.valueText() === UseStrictWalker.USE_STRICT_STRING) {
if (syntaxList.length > 0) {
var firstStatement = syntaxList[0];
if (firstStatement.kind() === 150 /* ExpressionStatement */ && TypeScript.childCount(firstStatement) === 2) {
var firstChild = TypeScript.childAt(firstStatement, 0);
var secondChild = TypeScript.childAt(firstStatement, 1);
if (TypeScript.isToken(firstChild)) {
var firstToken = TypeScript.firstToken(firstChild);
if (TypeScript.tokenValueText(firstToken) === UseStrictWalker.USE_STRICT_STRING) {
if (secondChild.kind() === 78 /* SemicolonToken */) {

@@ -73,3 +65,2 @@ isFailure = false;

}
if (isFailure) {

@@ -79,12 +70,10 @@ this.addUseStrictFailure(node);

};
UseStrictWalker.prototype.addUseStrictFailure = function (node) {
var position = this.position() + node.leadingTriviaWidth();
this.addFailure(this.createFailure(position, node.firstToken().width(), Rule.FAILURE_STRING));
var position = this.getPosition() + TypeScript.leadingTriviaWidth(node);
this.addFailure(this.createFailure(position, TypeScript.width(TypeScript.firstToken(node)), Rule.FAILURE_STRING));
};
UseStrictWalker.OPTION_CHECK_FUNCTION = "check-function";
UseStrictWalker.OPTION_CHECK_MODULE = "check-module";
UseStrictWalker.USE_STRICT_STRING = "use strict";
return UseStrictWalker;
})(Lint.ScopeAwareRuleWalker);

@@ -8,3 +8,2 @@ var __extends = this.__extends || function (d, b) {

var OPTION_LEADING_UNDERSCORE = "allow-leading-underscore";
var Rule = (function (_super) {

@@ -22,3 +21,2 @@ __extends(Rule, _super);

exports.Rule = Rule;
var VariableNameWalker = (function (_super) {

@@ -32,21 +30,16 @@ __extends(VariableNameWalker, _super);

var variableName = propertyName.text();
var position = this.position() + propertyName.leadingTriviaWidth();
var position = this.getPosition() + propertyName.leadingTriviaWidth();
if (!this.isCamelCase(variableName) && !this.isUpperCase(variableName)) {
this.addFailure(this.createFailure(position, propertyName.width(), Rule.FAILURE_STRING));
this.addFailure(this.createFailure(position, TypeScript.width(propertyName), Rule.FAILURE_STRING));
}
_super.prototype.visitVariableDeclarator.call(this, node);
};
VariableNameWalker.prototype.visitVariableStatement = function (node) {
for (var i = 0; i < node.modifiers.childCount(); i++) {
if (node.modifiers.childAt(i).kind() === 63 /* DeclareKeyword */) {
for (var i = 0; i < TypeScript.childCount(node.modifiers); i++) {
if (TypeScript.childAt(node.modifiers, i).kind() === 63 /* DeclareKeyword */) {
return;
}
}
_super.prototype.visitVariableStatement.call(this, node);
};
VariableNameWalker.prototype.isCamelCase = function (name) {

@@ -56,3 +49,2 @@ if (name.length <= 0) {

}
var firstCharacter = name.charAt(0);

@@ -62,3 +54,2 @@ var rest = name.substring(1);

};
VariableNameWalker.prototype.isUpperCase = function (name) {

@@ -65,0 +56,0 @@ return (name === name.toUpperCase());

@@ -13,3 +13,2 @@ var __extends = this.__extends || function (d, b) {

var OPTION_TYPECAST = "check-typecast";
var Rule = (function (_super) {

@@ -27,3 +26,2 @@ __extends(Rule, _super);

exports.Rule = Rule;
var WhitespaceWalker = (function (_super) {

@@ -33,13 +31,11 @@ __extends(WhitespaceWalker, _super);

_super.call(this, syntaxTree, options);
this.lastPosition = this.getSyntaxTree().sourceUnit().fullWidth();
this.lastPosition = TypeScript.fullWidth(this.getSyntaxTree().sourceUnit());
}
WhitespaceWalker.prototype.visitToken = function (token) {
_super.prototype.visitToken.call(this, token);
var kind = token.kind();
if ((this.hasOption(OPTION_BRANCH) && this.isBranchKind(kind)) || (this.hasOption(OPTION_SEPARATOR) && this.isSeparatorKind(kind)) || (this.hasOption(OPTION_DECL) && kind === 107 /* EqualsToken */) || (this.hasOption(OPTION_TYPE) && kind === 106 /* ColonToken */)) {
this.checkForLeadingSpace(this.position(), token.trailingTrivia());
this.checkForLeadingSpace(this.getPosition(), token.trailingTrivia());
}
};
WhitespaceWalker.prototype.visitBinaryExpression = function (node) {

@@ -49,43 +45,31 @@ var operator = node.operatorToken;

var position = this.positionAfter(node.left);
this.checkForLeadingSpace(position, node.left.trailingTrivia());
this.checkForLeadingSpace(position, TypeScript.trailingTrivia(node.left));
position += operator.fullWidth();
this.checkForLeadingSpace(position, operator.trailingTrivia());
}
_super.prototype.visitBinaryExpression.call(this, node);
};
WhitespaceWalker.prototype.visitSimpleArrowFunctionExpression = function (node) {
var position = this.positionAfter(node.identifier);
this.checkEqualsGreaterThan(node.equalsGreaterThanToken, node.identifier, position);
var position = this.positionAfter(node.parameter);
this.checkEqualsGreaterThan(node.equalsGreaterThanToken, node.parameter, position);
_super.prototype.visitSimpleArrowFunctionExpression.call(this, node);
};
WhitespaceWalker.prototype.visitParenthesizedArrowFunctionExpression = function (node) {
var position = this.positionAfter(node.callSignature);
this.checkEqualsGreaterThan(node.equalsGreaterThanToken, node.callSignature, position);
_super.prototype.visitParenthesizedArrowFunctionExpression.call(this, node);
};
WhitespaceWalker.prototype.visitConstructorType = function (node) {
var position = this.positionAfter(node.newKeyword, node.typeParameterList, node.parameterList);
this.checkEqualsGreaterThan(node.equalsGreaterThanToken, node.parameterList, position);
_super.prototype.visitConstructorType.call(this, node);
};
WhitespaceWalker.prototype.visitFunctionType = function (node) {
var position = this.positionAfter(node.typeParameterList, node.parameterList);
this.checkEqualsGreaterThan(node.equalsGreaterThanToken, node.parameterList, position);
_super.prototype.visitFunctionType.call(this, node);
};
WhitespaceWalker.prototype.checkEqualsGreaterThan = function (equalsGreaterThanToken, previousNode, position) {
if (this.hasOption(OPTION_OPERATOR)) {
this.checkForLeadingSpace(position, previousNode.trailingTrivia());
this.checkForLeadingSpace(position, TypeScript.trailingTrivia(previousNode));
position += equalsGreaterThanToken.fullWidth();

@@ -95,32 +79,25 @@ this.checkForLeadingSpace(position, equalsGreaterThanToken.trailingTrivia());

};
WhitespaceWalker.prototype.visitConditionalExpression = function (node) {
if (this.hasOption(OPTION_OPERATOR)) {
var position = this.positionAfter(node.condition);
this.checkForLeadingSpace(position, node.condition.trailingTrivia());
this.checkForLeadingSpace(position, TypeScript.trailingTrivia(node.condition));
position += node.questionToken.fullWidth();
this.checkForLeadingSpace(position, node.questionToken.trailingTrivia());
position += node.whenTrue.fullWidth();
this.checkForLeadingSpace(position, node.whenTrue.trailingTrivia());
position += TypeScript.fullWidth(node.whenTrue);
this.checkForLeadingSpace(position, TypeScript.trailingTrivia(node.whenTrue));
}
_super.prototype.visitConditionalExpression.call(this, node);
};
WhitespaceWalker.prototype.visitVariableDeclarator = function (node) {
var position = this.positionAfter(node.propertyName, node.typeAnnotation);
if (this.hasOption(OPTION_DECL) && node.equalsValueClause !== null) {
if (node.typeAnnotation !== null) {
this.checkForLeadingSpace(position, node.typeAnnotation.trailingTrivia());
} else {
this.checkForLeadingSpace(position, TypeScript.trailingTrivia(node.typeAnnotation));
}
else {
this.checkForLeadingSpace(position, node.propertyName.trailingTrivia());
}
}
_super.prototype.visitVariableDeclarator.call(this, node);
};
WhitespaceWalker.prototype.visitImportDeclaration = function (node) {

@@ -131,6 +108,4 @@ if (this.hasOption(OPTION_DECL)) {

}
_super.prototype.visitImportDeclaration.call(this, node);
};
WhitespaceWalker.prototype.visitExportAssignment = function (node) {

@@ -141,9 +116,8 @@ if (this.hasOption(OPTION_DECL)) {

}
_super.prototype.visitExportAssignment.call(this, node);
};
WhitespaceWalker.prototype.visitCastExpression = function (node) {
if (this.hasOption(OPTION_TYPECAST)) {
var position = this.position() + node.lessThanToken.fullWidth() + node.type.fullWidth() + node.greaterThanToken.fullWidth();
var typeWidth = TypeScript.fullWidth(node.type);
var position = this.getPosition() + node.lessThanToken.fullWidth() + typeWidth + node.greaterThanToken.fullWidth();
this.checkForLeadingSpace(position, node.greaterThanToken.trailingTrivia());

@@ -153,11 +127,8 @@ }

};
WhitespaceWalker.prototype.isBranchKind = function (kind) {
return (kind === 17 /* CatchKeyword */ || kind === 26 /* ForKeyword */ || kind === 28 /* IfKeyword */ || kind === 34 /* SwitchKeyword */ || kind === 42 /* WhileKeyword */ || kind === 43 /* WithKeyword */);
};
WhitespaceWalker.prototype.isSeparatorKind = function (kind) {
return (kind === 79 /* CommaToken */ || kind === 78 /* SemicolonToken */);
};
WhitespaceWalker.prototype.checkForLeadingSpace = function (position, trivia) {

@@ -168,6 +139,6 @@ var failure = null;

}
if (trivia.count() < 1) {
failure = this.createFailure(position, 1, Rule.FAILURE_STRING);
} else {
}
else {
var kind = trivia.syntaxTriviaAt(0).kind();

@@ -178,3 +149,2 @@ if (kind !== 4 /* WhitespaceTrivia */ && kind !== 5 /* NewLineTrivia */) {

}
if (failure) {

@@ -181,0 +151,0 @@ this.addFailure(failure);

Change Log
===
v1.0.0
---
* upgrade TypeScript compiler to 1.3
* **BREAKING CHANGES**
* all error messages now start with a lower-case character and do not end with a period
* all rule options are consistent in nomenclature. The `typedef` and `typedef-whitespace` rules now take in hyphenated options
* `unused-variables` rule cannot find unused private variables defined in the constructor due to a bug in 1.3 compiler
* `indent` rule has changed to only check for tabs or spaces and not enforce indentation levels
v0.4.12

@@ -5,0 +15,0 @@ ---

{
"name": "tslint",
"version": "0.4.14",
"version": "1.0.0",
"description": "a static analysis linter for TypeScript",

@@ -22,5 +22,5 @@ "bin": {

"dependencies": {
"findup-sync": "~0.1.2",
"optimist": "~0.6.0",
"underscore.string": "~2.3.3",
"findup-sync": "~0.1.2"
"underscore.string": "~2.3.3"
},

@@ -32,7 +32,9 @@ "devDependencies": {

"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-concat": "~0.5.0",
"grunt-mocha-test": "~0.6.2",
"grunt-ts": "~1.12.1",
"grunt-tslint": "~0.4.0",
"grunt-ts": "~1.7.2"
"typescript": "1.3.0"
},
"license": "Apache 2.0"
}

@@ -117,3 +117,3 @@ TSLint [![NPM version](https://badge.fury.io/js/tslint.png)](http://badge.fury.io/js/tslint) [![Builds](https://api.travis-ci.org/repositories/palantir/tslint.png?branch=master)](https://travis-ci.org/palantir/tslint)

* `forin` enforces a `for ... in` statement to be filtered with an `if` statement.*
* `indent` enforces consistent indentation levels (currently disabled).
* `indent` enforces consistent indentation with tabs or spaces.
* `interface-name` enforces the rule that interface names must begin with a capital 'I'

@@ -161,13 +161,13 @@ * `jsdoc-format` enforces basic format rules for jsdoc comments -- comments starting with `/**`

* `typedef` enforces type definitions to exist. Rule options:
* `"callSignature"` checks return type of functions
* `"indexSignature"` checks index type specifier of indexers
* `"call-signature"` checks return type of functions
* `"index-signature"` checks index type specifier of indexers
* `"parameter"` checks type specifier of parameters
* `"propertySignature"` checks return types of interface properties
* `"variableDeclarator"` checks variable declarations
* `"memberVariableDeclarator"` checks member variable declarations
* `"property-signature"` checks return types of interface properties
* `"variable-declarator"` checks variable declarations
* `"member-variable-declarator"` checks member variable declarations
* `typedef-whitespace` enforces spacing whitespace for type definitions. Each rule option requires a value of `"space"` or `"nospace"`
to require a space or no space before the type specifier's colon. Rule options:
* `"callSignature"` checks return type of functions
* `"catchClause"` checks type in exception catch blocks
* `"indexSignature"` checks index type specifier of indexers
* `"call-signature"` checks return type of functions
* `"catch-clause"` checks type in exception catch blocks
* `"index-signature"` checks index type specifier of indexers
* `use-strict` enforces ECMAScript 5's strict mode

@@ -174,0 +174,0 @@ * `check-module` checks that all top-level modules are using strict mode

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc