Skip to content

Commit

Permalink
Fixes palantir#115 -- no-unused-variable works for static class members
Browse files Browse the repository at this point in the history
  • Loading branch information
gscshoyru committed Mar 17, 2014
1 parent aeb9477 commit 7dfb936
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Change Log
===

* [bug] `no-unused-variable` rule no longer triggers false positives for class members labeled only `static`
* [bug] `no-unused-expression` rule no longer triggers false positives for `"use strict";` expressions

v0.4.7
Expand Down
9 changes: 2 additions & 7 deletions src/rules/noUnusedVariableRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,8 @@ class NoUnusedVariablesWalker extends Lint.RuleWalker {
public visitMemberVariableDeclaration(node: TypeScript.MemberVariableDeclarationSyntax): void {
var modifiers = node.modifiers;

// if no modifier is specified, the default is public, so skip the current declaration
if (modifiers.childCount() === 0) {
this.skipVariableDeclaration = true;
}

// if an explicit 'public' modifier is specified, skip the current declaration
if (this.hasModifier(modifiers, TypeScript.SyntaxKind.PublicKeyword)) {
// unless an explicit 'private' modifier is specified, variable is public, so skip the current declaration
if (!this.hasModifier(modifiers, TypeScript.SyntaxKind.PrivateKeyword)) {
this.skipVariableDeclaration = true;
}

Expand Down
1 change: 1 addition & 0 deletions test/files/rules/nounusedvariable-class.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ class ABCD {
private mfunc4() {
//
}
static stillPublic: number;
}

0 comments on commit 7dfb936

Please sign in to comment.