Skip to content

fix(eslint-plugin): [no-unused-vars] handle TSCallSignature #2336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2020
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
3 changes: 2 additions & 1 deletion packages/eslint-plugin/src/rules/no-unused-vars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ export default util.createRule<Options, MessageIds>({

return {
...rules,
'TSConstructorType, TSConstructSignatureDeclaration, TSDeclareFunction, TSEmptyBodyFunctionExpression, TSFunctionType, TSMethodSignature'(
'TSCallSignatureDeclaration, TSConstructorType, TSConstructSignatureDeclaration, TSDeclareFunction, TSEmptyBodyFunctionExpression, TSFunctionType, TSMethodSignature'(
node:
| TSESTree.TSCallSignatureDeclaration
| TSESTree.TSConstructorType
| TSESTree.TSConstructSignatureDeclaration
| TSESTree.TSDeclareFunction
Expand Down
20 changes: 20 additions & 0 deletions packages/eslint-plugin/tests/rules/no-unused-vars.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,26 @@ export function foo() {
return new Promise<Foo>();
}
`,
// https://github.com/typescript-eslint/typescript-eslint/issues/2331
{
code: `
export interface Event<T> {
(
listener: (e: T) => any,
thisArgs?: any,
disposables?: Disposable[],
): Disposable;
}
`,
options: [
{
args: 'after-used',
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
varsIgnorePattern: '^_$',
},
],
},
],

invalid: [
Expand Down