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鈥檒l 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

merged 2 commits into from Nov 28, 2017


None yet
2 participants

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 approved these changes Nov 28, 2017

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

4 checks passed

codecov/patch Coverage not affected when comparing 172d34e...3a4b6d7
codecov/project 97.06% remains the same compared to 172d34e
continuous-integration/travis-ci/pr The Travis CI build passed
deploy/netlify Deploy preview ready!

This comment has been minimized.


azz commented Nov 28, 2017

Looks good, thanks!

@azz azz added this to the 1.9 milestone Nov 28, 2017

@jackyho112 jackyho112 deleted the jackyho112:fix-format-of-comment-in-call-expression-param-of-arrow-expression branch Nov 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment