Prettier: Weird Output for: Arrow function + Ternary Operator + (long OR chained statements)

Created on 13 Jun 2017  路  1Comment  路  Source: prettier/prettier

Sorry about the issue title, couldn't think of anything else.

Prettier version: 1.4.4

Current Behavior

Input

room = room.map((row, rowIndex) => (
  row.map((col, colIndex) => (
    (rowIndex === 0 || colIndex === 0 || rowIndex === height || colIndex === width) ? 1 : 0
  ))
))

Output

room = room.map((row, rowIndex) =>
  row.map(
    (col, colIndex) =>
      rowIndex === 0 ||
        colIndex === 0 ||
        rowIndex === height ||
        colIndex === width
        ? 1
        : 0
  )
);

Expected Behavior

Shouldn't the 2nd & 3rd output line be together? i.e.:

room = room.map((row, rowIndex) =>
  row.map((col, colIndex) =>
      rowIndex === 0 ||
        colIndex === 0 ||
        rowIndex === height ||
        colIndex === width
        ? 1
        : 0
  )
);

Also, I don't know if the _OR chained statements output_ is that way by design, but that too looks weird here.

locked-due-to-inactivity bug

Most helpful comment

We shouldn't need to indent here, thanks for the report!

>All comments

We shouldn't need to indent here, thanks for the report!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dmnd picture dmnd  路  3Comments

MrSaints picture MrSaints  路  3Comments

ikatyang picture ikatyang  路  3Comments

rattrayalex picture rattrayalex  路  3Comments

jamiebuilds picture jamiebuilds  路  3Comments