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

trailing-comma: check for a closing parenthesis #4457

Merged
merged 1 commit into from
Jan 29, 2019
Merged
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
17 changes: 12 additions & 5 deletions src/rules/trailingCommaRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,19 @@ class TrailingCommaWalker extends Lint.AbstractWalker<Options> {
case ts.SyntaxKind.ConstructorType:
case ts.SyntaxKind.FunctionType:
case ts.SyntaxKind.CallSignature:
this.checkList(
(node as ts.SignatureDeclaration).parameters,
getChildOfKind(node, ts.SyntaxKind.CloseParenToken, this.sourceFile)!.end,
"functions",
isRestParameter,
const closingParen = getChildOfKind(
node,
ts.SyntaxKind.CloseParenToken,
this.sourceFile,
);
if (closingParen !== undefined) {
this.checkList(
(node as ts.SignatureDeclaration).parameters,
closingParen.end,
"functions",
isRestParameter,
);
}
break;
case ts.SyntaxKind.TypeLiteral:
this.checkTypeLiteral(node as ts.TypeLiteralNode);
Expand Down