Prettier
Prerequisites:
Install Prettier
Configure Prettier
Create a prettier.config.mjs (or .prettierrc.mjs) at the repository root:
Options
The preset is exported as prettierConfig and is meant to be used as-is, then overridden selectively.
Option | Default | Why it exists |
|---|---|---|
|
| Keep diffs readable by default. |
|
| Consistent JS/TS quoting. |
|
| Consistent JSX quoting. |
|
| Avoid ASI edge cases in mixed toolchains. |
|
| Cleaner diffs when adding/removing lines. |
|
| Stable output across OSes/CI. |
|
| Matches our JS/TS conventions. |
| array | Enforce stable import grouping + sorting. |
| array | Import sorting, |
| array | Per-file parser + Markdown |
Add scripts
Troubleshooting
Import sorting doesn’t work: ensure you have the peer dependency
@trivago/prettier-plugin-sort-importsinstalled (same forprettier-plugin-packagejsonandprettier-plugin-tailwindcss).Markdown wraps differently than code: Markdown files use an override with
printWidth: 100andproseWrap: "always".