Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
Update rule description & failure string
Browse files Browse the repository at this point in the history
- Updated the description and failure string of prefer-while
- Updated tests accordingly
  • Loading branch information
rwaskiewicz committed May 2, 2018
1 parent 180190d commit ec8b337
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/rules/preferWhileRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class Rule extends Lint.Rules.AbstractRule {
/* tslint:disable:object-literal-sort-keys */
public static metadata: Lint.IRuleMetadata = {
ruleName: "prefer-while",
description: "Prefer while loops when instead of a for loop without an initializer and incrementor.",
description: "Prefer `while` loops instead of `for` loops without an initializer and incrementor.",
rationale: "Simplifies the readability of the loop statement, while maintaining the same functionality.",
optionsDescription: "Not configurable.",
options: null,
Expand All @@ -34,7 +34,7 @@ export class Rule extends Lint.Rules.AbstractRule {
};
/* tslint:enable:object-literal-sort-keys */

public static FAILURE_STRING = "Expected a 'while' loop instead of a 'for' loop without an initializer and incrementor";
public static FAILURE_STRING = "Prefer `while` loops instead of `for` loops without an initializer and incrementor.";

public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
const failures: Lint.RuleFailure[] = [];
Expand Down
2 changes: 1 addition & 1 deletion test/rules/prefer-while/bad-no-condition/test.ts.lint
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
for(;;) {
~~~~~~~ [Expected a 'while' loop instead of a 'for' loop without an initializer and incrementor]
~~~~~~~ [Prefer `while` loops instead of `for` loops without an initializer and incrementor.]
console.log(x);
}
2 changes: 1 addition & 1 deletion test/rules/prefer-while/bad-with-condition/test.ts.lint
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
for(;true===true;) {
~~~~~~~~~~~~~~~~~~ [Expected a 'while' loop instead of a 'for' loop without an initializer and incrementor]
~~~~~~~~~~~~~~~~~~ [Prefer `while` loops instead of `for` loops without an initializer and incrementor.]
console.log(x);
}

0 comments on commit ec8b337

Please sign in to comment.