Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/eslint-plugin/lib/rules/no-unused-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ module.exports = Object.assign({}, baseRule, {
},
'*[declare=true] Identifier'(node) {
context.markVariableAsUsed(node.name);
const scope = context.getScope();
const { variableScope } = scope;
if (variableScope !== scope) {
const superVar = variableScope.set.get(node.name);
if (superVar) superVar.eslintUsed = true;
}
}
});
}
Expand Down
7 changes: 7 additions & 0 deletions packages/eslint-plugin/tests/lib/rules/no-unused-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,13 @@ declare namespace Foo {
declare var Foo: {
new (value?: any): Object,
foo(): string
}
`,
// https://github.com/typescript-eslint/typescript-eslint/issues/106
`
declare class Foo {
constructor(value?: any): Object;
foo(): string;
}
`,
`
Expand Down