Skip to content

Commit

Permalink
no-any: remove fixer, amend error message (palantir#3486)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajafff authored Nov 16, 2017
1 parent 53a864e commit cbdcfb5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
6 changes: 2 additions & 4 deletions src/rules/noAnyRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ export class Rule extends Lint.Rules.AbstractRule {
};
/* tslint:enable:object-literal-sort-keys */

public static FAILURE_STRING = "Type declaration of 'any' loses type-safety. " +
"Consider replacing it with a more precise type, the empty type ('{}'), " +
"or suppress this occurrence.";
public static FAILURE_STRING = "Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.";

public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
return this.applyWithFunction(sourceFile, walk);
Expand All @@ -47,7 +45,7 @@ function walk(ctx: Lint.WalkContext<void>) {
return ts.forEachChild(ctx.sourceFile, function cb(node: ts.Node): void {
if (node.kind === ts.SyntaxKind.AnyKeyword) {
const start = node.end - 3;
return ctx.addFailure(start, node.end, Rule.FAILURE_STRING, new Lint.Replacement(start, 3, "{}"));
return ctx.addFailure(start, node.end, Rule.FAILURE_STRING);
}
return ts.forEachChild(node, cb);
});
Expand Down
11 changes: 0 additions & 11 deletions test/rules/no-any/test.ts.fix

This file was deleted.

2 changes: 1 addition & 1 deletion test/rules/no-any/test.ts.lint
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ let a: any = 2, // error
let {a: c, b: d}: {c: any, d: number} = {c: 99, d: 100}; // error
~~~ [0]

[0]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type, the empty type ('{}'), or suppress this occurrence.
[0]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.

0 comments on commit cbdcfb5

Please sign in to comment.