Skip to content

Commit

Permalink
fix(eslint-plugin): [no-unused-vars] handle TSCallSignature (#2336)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed Aug 29, 2020
1 parent 3be125d commit c70f54f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/eslint-plugin/src/rules/no-unused-vars.ts
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
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

0 comments on commit c70f54f

Please sign in to comment.