Skip to content

Commit

Permalink
feat: fix bug with arrow function return types in function-paren-newl…
Browse files Browse the repository at this point in the history
…ine (#15541)

Fixes #15091
  • Loading branch information
mdjermanovic committed Feb 8, 2022
1 parent 355b23d commit 2dc38aa
Show file tree
Hide file tree
Showing 3 changed files with 709 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/rules/function-paren-newline.js
Expand Up @@ -227,9 +227,13 @@ module.exports = {
return null;
}

const rightParen = node.params.length
? sourceCode.getTokenAfter(node.params[node.params.length - 1], astUtils.isClosingParenToken)
: sourceCode.getTokenAfter(firstToken);

return {
leftParen: firstToken,
rightParen: sourceCode.getTokenBefore(node.body, astUtils.isClosingParenToken)
rightParen
};
}

Expand Down

0 comments on commit 2dc38aa

Please sign in to comment.