Add parenthesis for binary operators #1153

Merged
merged 1 commit into from Apr 11, 2017

Conversation

Projects
None yet
4 participants
@vjeux
Collaborator

vjeux commented Apr 7, 2017

Fixes #872

@lydell

This comment has been minimized.

Show comment
Hide comment
@lydell

lydell Apr 7, 2017

Collaborator

What about mixing binary operators with other binary operators?

Collaborator

lydell commented Apr 7, 2017

What about mixing binary operators with other binary operators?

@vjeux

This comment has been minimized.

Show comment
Hide comment
@vjeux

vjeux Apr 7, 2017

Collaborator

I'm a bit worried that people that do write a lot of binary operators would be annoyed by this. But it's very unclear how precedence work for them. I just looked at a piece of code I wrote many years ago and I over-parenthesized!

https://github.com/jDataView/jDataView/blob/master/src/jdataview.js#L562-L564

I'll update this PR.

Collaborator

vjeux commented Apr 7, 2017

I'm a bit worried that people that do write a lot of binary operators would be annoyed by this. But it's very unclear how precedence work for them. I just looked at a piece of code I wrote many years ago and I over-parenthesized!

https://github.com/jDataView/jDataView/blob/master/src/jdataview.js#L562-L564

I'll update this PR.

@vjeux vjeux changed the title from Add parenthesis when mixing math and binary operators to Add parenthesis for binary operators Apr 7, 2017

@vjeux

This comment has been minimized.

Show comment
Hide comment
@vjeux

vjeux Apr 7, 2017

Collaborator

Done

Collaborator

vjeux commented Apr 7, 2017

Done

tests/binary_math/jsfmt.spec.js
@@ -0,0 +1 @@
+run_spec(__dirname);

This comment has been minimized.

@existentialism

existentialism Apr 7, 2017

Collaborator

Should we add babylon?

@existentialism

existentialism Apr 7, 2017

Collaborator

Should we add babylon?

This comment has been minimized.

@vjeux

vjeux Apr 7, 2017

Collaborator

Sure. I don't expect babylon to be anything different here tbh

@vjeux

vjeux Apr 7, 2017

Collaborator

Sure. I don't expect babylon to be anything different here tbh

@jlongster

This comment has been minimized.

Show comment
Hide comment
@jlongster

jlongster Apr 11, 2017

Member

👍 Sounds good to me!

Member

jlongster commented Apr 11, 2017

👍 Sounds good to me!

@vjeux vjeux merged commit 636d1af into prettier:master Apr 11, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment