Files
test-repo/changelog_unreleased/javascript/pr-7889.md
T

787 B

Further improve method chain breaking heuristic (#7889 by @thorn0)

A method chain now is always split onto multiple lines if:

  • it's an expression statement and all its arguments are literals or UPPERCASE_CONSTANTs (the "fluent configuration" pattern),
  • any call but the first one has more than two arguments, or
  • the chain starts with a constructor call.
// Input
cy.get(".ready")
  .should("have.text", "FOO")
  .should("have.css", "color", "#aaa");

// Prettier stable
cy.get(".ready").should("have.text", "FOO").should("have.css", "color", "#aaa");

// Prettier master
cy.get(".ready")
  .should("have.text", "FOO")
  .should("have.css", "color", "#aaa");