Skip to content

Output changing between 2 options (regression?) #16897

@tiagoskaneta

Description

@tiagoskaneta

Prettier 3.4.1
Playground link

# Options (if any):
--print-width 80
--tab-width 2

Input:

function HelloWorld() {
  return (
    <div>
      <div>
        foo
        <br />
        bar{' '}
        <span className="font-semibold">
          foobar foobar foobar foobar 12345
        </span>, foobar foobar foobar
      </div>
    </div>
  )
}

function HelloWorld() {
  return (
    <div>
      <div>
        foo
        <br />
        bar{' '}
        <span className="font-semibold">foobar foobar foobar foobar 12345</span>
        , foobar foobar foobar
      </div>
    </div>
  )
}

Output:

function HelloWorld() {
  return (
    <div>
      <div>
        foo
        <br />
        bar{" "}
        <span className="font-semibold">foobar foobar foobar foobar 12345</span>
        , foobar foobar foobar
      </div>
    </div>
  );
}

function HelloWorld() {
  return (
    <div>
      <div>
        foo
        <br />
        bar{" "}
        <span className="font-semibold">
          foobar foobar foobar foobar 12345
        </span>, foobar foobar foobar
      </div>
    </div>
  );
}

Expected output:
Either one but consistently the same

Why?
The same code keeps alternating between 2 possible outputs on every execution. Both outputs are reported as invalid tho, leading to the format checking never passing. It looks like a regression on 3.4, given that the same code format was stable previously.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:idempotencyIssues with re-printing Prettier’s outputlang:jsxIssues affecting JSX (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions