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

Commit

Permalink
'no-multiple-variable-declaration' -> 'one-variable-per-declaration' …
Browse files Browse the repository at this point in the history
…rename (#1198) (#1199)
  • Loading branch information
jkillian committed May 3, 2016
1 parent d77aeec commit d35ee79
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ A sample configuration file with all options is available [here](https://github.
* `no-internal-module` disallows internal `module` (use `namespace` instead).
* `no-invalid-this` disallows using the `this` keyword outside of classes.
* `no-this-in-function-in-method` disallows using the `this` keyword in functions within class methods.
* `no-multiple-variable-declaration` disallows multiple variable definitions in the same statement.
* `no-namespace` disallows both internal `module`s and `namespace`, but allows ES6-style external modules.
* `allow-declarations` allows `declare namespace ... {}` to describe external APIs.
* `no-null-keyword` disallows use of the `null` keyword literal.
Expand All @@ -269,6 +268,7 @@ A sample configuration file with all options is available [here](https://github.
* `"check-finally"` checks that `finally` is on the same line as the closing brace for the preceding `try` or `catch`.
* `"check-open-brace"` checks that an open brace falls on the same line as its preceding expression.
* `"check-whitespace"` checks preceding whitespace for the specified tokens.
* `one-variable-per-declaration` disallows multiple variable definitions in the same statement.
* `quotemark` enforces consistent single or double quoted string literals. Rule options (at least one of `"double"` or `"single"` is required):
* `"single"` enforces single quotes.
* `"double"` enforces double quotes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ export class Rule extends Lint.Rules.AbstractRule {
public static FAILURE_STRING = "Forbidden multiple variable definitions in the same statement";

public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
const noMultipleVarWalker = new NoMultipleVariableDeclarationWalker(sourceFile, this.getOptions());
return this.applyWithWalker(noMultipleVarWalker);
const oneVarWalker = new OneVariablePerDeclarationWalker(sourceFile, this.getOptions());
return this.applyWithWalker(oneVarWalker);
}
}

class NoMultipleVariableDeclarationWalker extends Lint.RuleWalker {
class OneVariablePerDeclarationWalker extends Lint.RuleWalker {
public visitVariableStatement(node: ts.VariableStatement) {
const { declarationList } = node;

Expand Down
2 changes: 1 addition & 1 deletion src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
"rules/noInferrableTypesRule.ts",
"rules/noInternalModuleRule.ts",
"rules/noInvalidThisRule.ts",
"rules/noMultipleVariableDeclarationRule.ts",
"rules/noNamespaceRule.ts",
"rules/noNullKeywordRule.ts",
"rules/noReferenceRule.ts",
Expand All @@ -110,6 +109,7 @@
"rules/noVarRequiresRule.ts",
"rules/objectLiteralSortKeysRule.ts",
"rules/oneLineRule.ts",
"rules/oneVariablePerDeclarationRule.ts",
"rules/quotemarkRule.ts",
"rules/radixRule.ts",
"rules/semicolonRule.ts",
Expand Down
5 changes: 0 additions & 5 deletions test/rules/no-multiple-variable-declaration/tslint.json

This file was deleted.

5 changes: 5 additions & 0 deletions test/rules/one-variable-per-declaration/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"one-variable-per-declaration": true
}
}
2 changes: 1 addition & 1 deletion test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
"../src/rules/noInferrableTypesRule.ts",
"../src/rules/noInternalModuleRule.ts",
"../src/rules/noInvalidThisRule.ts",
"../src/rules/noMultipleVariableDeclarationRule.ts",
"../src/rules/noNamespaceRule.ts",
"../src/rules/noNullKeywordRule.ts",
"../src/rules/noReferenceRule.ts",
Expand All @@ -107,6 +106,7 @@
"../src/rules/noVarRequiresRule.ts",
"../src/rules/objectLiteralSortKeysRule.ts",
"../src/rules/oneLineRule.ts",
"../src/rules/oneVariablePerDeclarationRule.ts",
"../src/rules/quotemarkRule.ts",
"../src/rules/radixRule.ts",
"../src/rules/semicolonRule.ts",
Expand Down

0 comments on commit d35ee79

Please sign in to comment.