Skip to content

Upgrading prettier 2 to 3

Breaking2.8.8 → 3.9.10Breaking12Platform1New11Changed6Fixed26

BreakingUpgrade verdict

12 breaking changes and a platform requirement change.

  • Prettier no longer understands Flow type annotations written inside comments.
  • Plugin parsers no longer receive the list of parsers as a second argument.
  • The `concat` doc builder is no longer available.
  • Prettier now adds trailing commas everywhere by default.
Top 4 of 13 that need code or config changes

Node.js requirement changed in 3.0.0-alpha.0: >=10.13.0 → >=14.

Breaking12
Removes support for Flow comment types.
Removes the second argument parsers passed to parsers.parse.
parsers.parseparsers
Removes prettier.doc.builders.concat.
prettier.doc.builders.concat
Changes the default value of trailingComma to "all".
trailingComma
Removes the second argument parsers passed to parsers.parse.
parsers.parse
Removes prettier.doc.builders.concat.
prettier.doc.builders.concat
Updates the package file structure and adds an exports field to package.json.
exportspackage.json
Makes all public APIs asynchronous.
Makes textToDoc trim trailing hard lines.
textToDoc
Makes all public APIs asynchronous.
Changes the embed method of a printer to a completely new signature and adds a getVisitorKeys method.
embedgetVisitorKeys
Makes textToDoc trim trailing hard lines.
textToDoc
Platform1
Raises the minimal required Node.js version to v14.