Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit df37be2

Browse files
authored
fix(eslint-plugin): [no-unused-vars] handle TSCallSignature (typescript-eslint#2336)
1 parent abb0617 commit df37be2

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

packages/eslint-plugin/src/rules/no-unused-vars.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ export default util.createRule<Options, MessageIds>({
8484

8585
return {
8686
...rules,
87-
'TSConstructorType, TSConstructSignatureDeclaration, TSDeclareFunction, TSEmptyBodyFunctionExpression, TSFunctionType, TSMethodSignature'(
87+
'TSCallSignatureDeclaration, TSConstructorType, TSConstructSignatureDeclaration, TSDeclareFunction, TSEmptyBodyFunctionExpression, TSFunctionType, TSMethodSignature'(
8888
node:
89+
| TSESTree.TSCallSignatureDeclaration
8990
| TSESTree.TSConstructorType
9091
| TSESTree.TSConstructSignatureDeclaration
9192
| TSESTree.TSDeclareFunction

packages/eslint-plugin/tests/rules/no-unused-vars.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,26 @@ export function foo() {
729729
return new Promise<Foo>();
730730
}
731731
`,
732+
// https://github.com/typescript-eslint/typescript-eslint/issues/2331
733+
{
734+
code: `
735+
export interface Event<T> {
736+
(
737+
listener: (e: T) => any,
738+
thisArgs?: any,
739+
disposables?: Disposable[],
740+
): Disposable;
741+
}
742+
`,
743+
options: [
744+
{
745+
args: 'after-used',
746+
argsIgnorePattern: '^_',
747+
ignoreRestSiblings: true,
748+
varsIgnorePattern: '^_$',
749+
},
750+
],
751+
},
732752
],
733753

734754
invalid: [

0 commit comments

Comments
 (0)