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

It reformats this for no reason #7

Open
nickretallack opened this issue Apr 5, 2020 · 2 comments
Open

It reformats this for no reason #7

nickretallack opened this issue Apr 5, 2020 · 2 comments
Labels
formatting Unexpected code formatting changes

Comments

@nickretallack
Copy link

Input:

// @flow
const f = x => ({a: 'a', b: 'b'}[x]);

Output:

const f = (x) =>
  ({
    a: 'a',
    b: 'b',
  }[x]);

With --no-prettier:

const f = x => ({
  a: 'a',
  b: 'b'
})[x];

It could have left that line alone.

@zxbodya
Copy link
Owner

zxbodya commented Apr 5, 2020

I suspect the issue is that recast reformats the code, and then prettier preserves the formatting. Will look into but likely there is no easy fix…

@nickretallack
Copy link
Author

The question though is why does recast bother changing the code? The AST is identical, isn't it?

@zxbodya zxbodya added the formatting Unexpected code formatting changes label Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatting Unexpected code formatting changes
Projects
None yet
Development

No branches or pull requests

2 participants