Summary
Upgrade prettier from 2.1.2 to 3.x. This will cause formatting changes across the codebase due to updated defaults and improved formatting rules.
Current → Target
| Package |
Current |
Latest |
prettier |
2.1.2 |
3.8.1 |
eslint-plugin-prettier |
4.2.1 |
5.5.5 |
eslint-config-prettier |
8.5.0 |
10.1.8 |
Why Upgrade
- v2 is no longer maintained
- v3 has better formatting for many edge cases
- Improved TypeScript and JSX formatting
Migration Steps
- Install new versions together (eslint-prettier integration must be compatible):
yarn add --dev prettier@latest eslint-plugin-prettier@latest eslint-config-prettier@latest
- Review config changes — some defaults changed in v3:
trailingComma default changed from "es5" to "all"
- Review
.prettierrc or prettier config if one exists
- Reformat the entire codebase in a single commit:
- Commit the formatting changes separately — this makes git blame cleaner. Consider adding a
.git-blame-ignore-revs file with the reformat commit hash.
- Run
yarn ci to verify lint + tests pass with the new formatting
⚠️ Note
This will produce a large diff touching many files. It's best done:
- As a standalone PR with no other changes
- When there are few open PRs to minimize merge conflicts
Files Affected
- Nearly every
.ts/.tsx/.js file (formatting changes)
package.json — dependency versions
- Possibly
.prettierrc or prettier config
References
Summary
Upgrade
prettierfrom 2.1.2 to 3.x. This will cause formatting changes across the codebase due to updated defaults and improved formatting rules.Current → Target
prettiereslint-plugin-prettiereslint-config-prettierWhy Upgrade
Migration Steps
trailingCommadefault changed from"es5"to"all".prettierrcor prettier config if one existsnpx prettier --write ..git-blame-ignore-revsfile with the reformat commit hash.yarn cito verify lint + tests pass with the new formattingThis will produce a large diff touching many files. It's best done:
Files Affected
.ts/.tsx/.jsfile (formatting changes)package.json— dependency versions.prettierrcor prettier configReferences