Skip to content

Commit

Permalink
Don't check declared vars in the unused-variable-rule
Browse files Browse the repository at this point in the history
  • Loading branch information
DickvdBrink committed May 13, 2015
1 parent b08678f commit 8d73fae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/rules/noUnusedVariableRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ class NoUnusedVariablesWalker extends Lint.RuleWalker {

// skip exported variables
public visitVariableStatement(node: ts.VariableStatement): void {
if (this.hasModifier(node.modifiers, ts.SyntaxKind.ExportKeyword)) {
if (this.hasModifier(node.modifiers, ts.SyntaxKind.ExportKeyword) ||
this.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)) {
this.skipVariableDeclaration = true;
}

Expand Down
2 changes: 2 additions & 0 deletions test/files/rules/nounusedvariable-var.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ try {
} catch (e) {
// e is unused but that's still ok
}

declare var tmp: any;

0 comments on commit 8d73fae

Please sign in to comment.