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

Fix formatting of comment in paren of call expression in arrow expression #3334

Conversation

jackyho112
Copy link
Contributor

@jackyho112 jackyho112 commented Nov 28, 2017

Fixes #2853 (comment).

Fix an edge case where a comment inside the parentheses of a call expression of an arrow function expression with no bracket would have the arrow function expression, instead of the call expression, as the enclosing node. Therefore, when checking for whether there is an argument, we might get the wrong result.

For example,

const API = {
  loader: () => import('./test' /* webpackChunkName: "test" */),
};

would get formatted to

const API = {
  loader: (/* webpackChunkName: "test" */) => import("./test")
};

before this fix. But with this fix, the comment won't get moved.

Let me know if there is any improvement I could make. 😄

@azz azz merged commit a02e3b3 into prettier:master Nov 28, 2017
@azz
Copy link
Member

azz commented Nov 28, 2017

Looks good, thanks!

@azz azz added this to the 1.9 milestone Nov 28, 2017
@jackyho112 jackyho112 deleted the fix-format-of-comment-in-call-expression-param-of-arrow-expression branch November 28, 2017 16:09
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 19, 2019
@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.
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.

Comment gets moved away
2 participants