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
Fix: arrow-parens fixer gets tripped up with trailing comma in args #8838
Conversation
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a suggestion for simplifying things a bit.
lib/rules/arrow-parens.js
Outdated
@@ -66,7 +66,13 @@ module.exports = { | |||
*/ | |||
function fixParamsWithParenthesis(fixer) { | |||
const paramToken = sourceCode.getTokenAfter(firstTokenOfParam); | |||
const closingParenToken = sourceCode.getTokenAfter(paramToken); | |||
let closingParenToken = sourceCode.getTokenAfter(paramToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a predicate here instead of using the if statement below? Maybe something like sourceCode.getTokenAfter(paramToken, astUtils.isClosingParenToken)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great, I'm just looking for something like this. thanks~~
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for contributing!
What is the purpose of this pull request? (put an "X" next to item)
[x] Bug fix (template)
What changes did you make? (Give an overview)
fixes #8834
Is there anything you'd like reviewers to focus on?