Fix last comment of an if test #1042

Merged
merged 1 commit into from Apr 10, 2017

Conversation

Projects
None yet
1 participant
@vjeux
Collaborator

vjeux commented Mar 19, 2017

This one sucks.

The range of the test of if (a /* comment */) {} is only a and doesn't include the comment nor parenthesis. This means that we have no way to know if the comment is placed before or after the ) unless you look at the actual source and strip all the whitespace/comments characters to see if it's a )...

This happened on the babel source code twice and many times in the fb codebase. I think we need to fix it unfortunately :(

Fixes #867

Fix last comment of an if test
This one sucks.

The range of the `test` of `if (a /* comment */) {}` is only `a` and doesn't include the comment nor parenthesis. This means that we have no way to know if the comment is placed before or after the `)` unless you look at the actual source and strip all the whitespace/comments characters to see if it's a `)`...

This happened on the babel source code twice and many times in the fb codebase. I think we need to fix it unfortunately :(

Fixes #867

@vjeux vjeux merged commit 4579660 into prettier:master Apr 10, 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