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

Commit

Permalink
Fix no-unnecessary-qualifier handling of implicit arguments (#2555)
Browse files Browse the repository at this point in the history
  • Loading branch information
GoodForOneFare authored and adidahiya committed Apr 12, 2017
1 parent 8c7644a commit 6f1f1ad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/rules/noUnnecessaryQualifierRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@ class Walker extends Lint.ProgramAwareRuleWalker {
}

private symbolIsNamespaceInScope(symbol: ts.Symbol): boolean {
if (symbol.getDeclarations().some((decl) => this.namespacesInScope.some((ns) => ns === decl))) {
const symbolDeclarations = symbol.getDeclarations();
if (symbolDeclarations == null) {
return false;
} else if (symbolDeclarations.some((decl) => this.namespacesInScope.some((ns) => ns === decl))) {
return true;
}

const alias = this.tryGetAliasedSymbol(symbol);
return alias !== undefined && this.symbolIsNamespaceInScope(alias);
}
Expand Down
12 changes: 12 additions & 0 deletions test/rules/no-unnecessary-qualifier/arguments.ts.lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace N {
export type T = number;
export const x: N.T = 0;
~ [N]
export function f() {
if (arguments.length > 0) {
console.log('arguments should not break this rule');
}
}
}

[N]: Qualifier is unnecessary since 'N' is in scope.

0 comments on commit 6f1f1ad

Please sign in to comment.