flowts icon indicating copy to clipboard operation
flowts copied to clipboard

It reformats this for no reason

Open nickretallack opened this issue 5 years ago • 2 comments

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.

nickretallack avatar Apr 05 '20 06:04 nickretallack

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…

zxbodya avatar Apr 05 '20 09:04 zxbodya

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

nickretallack avatar Apr 05 '20 19:04 nickretallack