From e16a14b5b3b5f771b10db23d36c9031d38f3119b Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 2 Oct 2015 15:15:39 -0700 Subject: [PATCH] tslint had a new release and added this rule, theirs was a little stricter --- Jakefile.js | 1 - scripts/tslint/noInferrableTypesRule.ts | 49 ------------------------- src/harness/fourslash.ts | 4 +- 3 files changed, 2 insertions(+), 52 deletions(-) delete mode 100644 scripts/tslint/noInferrableTypesRule.ts diff --git a/Jakefile.js b/Jakefile.js index 943f2eff5e..e99043d3f5 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -813,7 +813,6 @@ task("update-sublime", ["local", serverFile], function() { var tslintRuleDir = "scripts/tslint"; var tslintRules = ([ "nextLineRule", - "noInferrableTypesRule", "noNullRule", "booleanTriviaRule" ]); diff --git a/scripts/tslint/noInferrableTypesRule.ts b/scripts/tslint/noInferrableTypesRule.ts deleted file mode 100644 index cbc0162260..0000000000 --- a/scripts/tslint/noInferrableTypesRule.ts +++ /dev/null @@ -1,49 +0,0 @@ -/// -/// - - -export class Rule extends Lint.Rules.AbstractRule { - public static FAILURE_STRING_FACTORY = (type: string) => `LHS type (${type}) inferred by RHS expression, remove type annotation`; - - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new InferrableTypeWalker(sourceFile, this.getOptions())); - } -} - -class InferrableTypeWalker extends Lint.RuleWalker { - visitVariableStatement(node: ts.VariableStatement) { - node.declarationList.declarations.forEach(e => { - if ((!!e.type) && (!!e.initializer)) { - let failure: string; - switch (e.type.kind) { - case ts.SyntaxKind.BooleanKeyword: - if (e.initializer.kind === ts.SyntaxKind.TrueKeyword || e.initializer.kind === ts.SyntaxKind.FalseKeyword) { - failure = 'boolean'; - } - break; - case ts.SyntaxKind.NumberKeyword: - if (e.initializer.kind === ts.SyntaxKind.NumericLiteral) { - failure = 'number'; - } - break; - case ts.SyntaxKind.StringKeyword: - switch (e.initializer.kind) { - case ts.SyntaxKind.StringLiteral: - case ts.SyntaxKind.NoSubstitutionTemplateLiteral: - case ts.SyntaxKind.TemplateExpression: - failure = 'string'; - break; - default: - break; - } - break; - } - if (failure) { - this.addFailure(this.createFailure(e.type.getStart(), e.type.getWidth(), Rule.FAILURE_STRING_FACTORY(failure))); - } - } - }); - - super.visitVariableStatement(node); - } -} diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 3042f0c464..a846077a85 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -157,7 +157,7 @@ namespace FourSlash { return true; } - public setCancelled(numberOfCalls: number = 0): void { + public setCancelled(numberOfCalls = 0): void { ts.Debug.assert(numberOfCalls >= 0); this.numberOfCallsBeforeCancellation = numberOfCalls; } @@ -761,7 +761,7 @@ namespace FourSlash { this.raiseError(`verifyReferencesAtPositionListContains failed - could not find the item: ${JSON.stringify(missingItem)} in the returned list: (${JSON.stringify(references)})`); } - public verifyReferencesCountIs(count: number, localFilesOnly: boolean = true) { + public verifyReferencesCountIs(count: number, localFilesOnly = true) { this.taoInvalidReason = "verifyReferences NYI"; let references = this.getReferencesAtCaret();