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

Commit

Permalink
no-unnecessary-qualifier: make it work with typescript@next (#3052)
Browse files Browse the repository at this point in the history
Seems like typescript used to return the same symbol. That was changed in [email protected] and caused the tests to fail.
This fix now compares the declarations of the symbols instead of checking the symbols for equality.
Fixes: #3047
[no-log]
  • Loading branch information
ajafff authored and jkillian committed Jul 20, 2017
1 parent c32bdc4 commit f9e162f
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion src/rules/noUnnecessaryQualifierRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function walk(ctx: Lint.WalkContext<void>, checker: ts.TypeChecker): void {

// If the symbol in scope is different, the qualifier is necessary.
const fromScope = getSymbolInScope(qualifier, accessedSymbol.flags, name.text);
return fromScope === undefined || fromScope === accessedSymbol;
return fromScope === undefined || Lint.Utils.arraysAreEqual(fromScope.declarations, accessedSymbol.declarations, (a, b) => a === b);
}

function getSymbolInScope(node: ts.Node, flags: ts.SymbolFlags, name: string): ts.Symbol | undefined {
Expand Down
1 change: 0 additions & 1 deletion test/rules/no-unnecessary-qualifier/arguments.ts.lint
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[typescript]: < 2.5.0
namespace N {
export type T = number;
export const x: N.T = 0;
Expand Down
1 change: 0 additions & 1 deletion test/rules/no-unnecessary-qualifier/test-global.ts.lint
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[typescript]: < 2.5.0
namespace N {
export type T = number;
export const x: N.T = 0;
Expand Down
1 change: 0 additions & 1 deletion test/rules/no-unnecessary-qualifier/test.ts.lint
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[typescript]: < 2.5.0
namespace N {
export type T = number;
export const x: N.T = 0;
Expand Down

0 comments on commit f9e162f

Please sign in to comment.