Back to Prettier

7161

changelog_unreleased/javascript/7161.md

3.9.0699 B
Original Source

Stabilize comment around break and continue in no-semi mode (#7161 by @thorn0, @fisker)

<!-- prettier-ignore -->
jsx
// Input
for (;;) {
  if (condition) {
    break; // breaking comment

    (possibleArray || []).sort()
  }
}

// Prettier stable (--no-semi, first format)
for (;;) {
  if (condition) {
    break // breaking comment

    ;(possibleArray || []).sort()
  }
}

// Prettier stable (--no-semi, second format)
for (;;) {
  if (condition) {
    break // breaking comment
    ;(possibleArray || []).sort()
  }
}

// Prettier main (--no-semi, both first and second format)
for (;;) {
  if (condition) {
    break; // breaking comment

    (possibleArray || []).sort();
  }
}