Skip to content

Commit

Permalink
Merge pull request palantir#366 from gscshoyru/no-duplicate-on-types
Browse files Browse the repository at this point in the history
No duplicate variable rule no longer walks type literals
  • Loading branch information
ashwinr committed Apr 20, 2015
2 parents 56cf19f + 4201cb6 commit 0d112c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/rules/noDuplicateVariableRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ class NoDuplicateVariableWalker extends Lint.ScopeAwareRuleWalker<ScopeInfo> {
super.visitParameterDeclaration(node);
}

public visitTypeLiteral(node: ts.TypeLiteralNode): void {
// don't call super, we don't want to walk the inside of type nodes
}

public visitVariableDeclaration(node: ts.VariableDeclaration): void {
var propertyName = <ts.Identifier> node.name;
var variableName = propertyName.text;
Expand Down
6 changes: 6 additions & 0 deletions test/files/rules/duplicate-variable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,9 @@ function testArguments2(x: number, y: number): void {
var x = 1;
let y = 2;
}

var references: {[vertex: string]: any};
var dependents: {[vertex: string]: any};

function blah(arg1: {[key: string]: any, arg2: {[key:string]: any}) {
}

0 comments on commit 0d112c2

Please sign in to comment.