Skip to content

Fix last comment of an if test#1042

Merged
vjeux merged 1 commit intoprettier:masterfrom
vjeux:last_if_comment
Apr 10, 2017
Merged

Fix last comment of an if test#1042
vjeux merged 1 commit intoprettier:masterfrom
vjeux:last_if_comment

Conversation

@vjeux
Copy link
Copy Markdown
Contributor

@vjeux 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

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 prettier#867
@vjeux vjeux force-pushed the last_if_comment branch from 5966c94 to 11651ed Compare April 5, 2017 17:56
@vjeux vjeux merged commit 4579660 into prettier:master Apr 10, 2017
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 21, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inline comment at end of if condition is moved outside.

1 participant