Skip to content

formatter: Diff with Prettier on comment after : ternary operator with jsx #16258

@PeterCardenas

Description

@PeterCardenas

Input

const x = (
  <>
    {x ? (
      <div />
    ) : // xxx
    x ? null : (
      <div />
    )}
  </>
);

Config

{
  "printWidth": 100,
  "tabWidth": 2,
  "useTabs": false,
  "semi": true,
  "singleQuote": true,
  "quoteProps": "as-needed",
  "jsxSingleQuote": false,
  "trailingComma": "all",
  "bracketSpacing": true,
  "bracketSameLine": false,
  "arrowParens": "always"
}

Oxfmt output

Oxfmt version: 42e9dcc7d

const x = (
  <>
    {x ? (
      <div /> // xxx
    ) : x ? null : (
      <div />
    )}
  </>
);

Oxfmt playground link

No response

Prettier output

Prettier version: 3.7.1

const x = (
  <>
    {x ? (
      <div />
    ) : // xxx
    x ? null : (
      <div />
    )}
  </>
);

Prettier playground link

No response

Additional notes

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions