Skip to content
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

Add more supervisory parens #2423

Merged
merged 1 commit into from Jul 7, 2017

Conversation

Projects
None yet
3 participants
@azz
Copy link
Member

azz commented Jul 7, 2017

With this change:

  1. Any use of % with /, *, or % will add parens on the LHS.
  2. Any combination of ==, !=, ===, !== will add parens on the LHS.
  3. x ** y ** z will become x ** (y ** z), as exponentiation is right-associative.

Closes #187

util.getPrecedence(node.operator) &&
node.operator !== "**"
) {
if (util.shouldFlatten(node.operator, node.left.operator)) {

This comment has been minimized.

Copy link
@azz

azz Jul 7, 2017

Author Member

Changing this was required due to needsParens not actually being called on the to-be-flattened expression.

@azz azz requested a review from vjeux Jul 7, 2017

@lydell

This comment has been minimized.

Copy link
Collaborator

lydell commented Jul 7, 2017

What about bitwise operators?

@azz

This comment has been minimized.

Copy link
Member Author

azz commented Jul 7, 2017

Bitwise operators are already parenthesised.

@vjeux vjeux merged commit 7e96e01 into prettier:master Jul 7, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@vjeux

This comment has been minimized.

Copy link
Collaborator

vjeux commented Jul 7, 2017

Awesome! So good to close a 3 digits issue :)

@azz azz deleted the azz:binary-parens branch Jul 7, 2017

@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.