-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Added condition for '+' case. #13115
Conversation
I am not sure how to update the test, so, if the test needs to be updated, I would appreciate knowing how to update it. |
@t-mangoe Thank you for working on this! I've pushed a commit to add tests. If you will contribute to Prettier again, please add tests with to refer my commit. |
|
No, just add the |
@fisker |
@@ -1,3 +1,6 @@ | |||
foo(_a).bar().leet(); | |||
foo(-a).bar().leet(); | |||
foo(+a).bar().leet(); | |||
foo(~a).bar().leet(); | |||
foo(++a).bar().leet(); |
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.
I assume we are going to treat a++
the same, please add test for it.
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.
I added tests for a++
and a--
.
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.
Looks good to me, thank you!
Sorry, missed this. I'd use const simpleOperators = new Map([
'UnaryExpression', new Set(['!', '-', '+', '~']),
// To prevent unexpected operators add in future
'UpdateExpression', new Set(['++', '--']),
]);
if (simpleOperators.has(node.type) && simpleOperators.get(node.type).has(node.operator)) {
// ...
} |
Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
Description
this PR fixes the issue #13018
Fix #13018
Checklist
docs/
directory).changelog_unreleased/*/XXXX.md
file followingchangelog_unreleased/TEMPLATE.md
.✨Try the playground for this PR✨