Skip to content

Prettier how-to

Format the tree with Prettier 3. ESLint does not own formatting.

Install

bash
pnpm add -D prettier
FileRole
.prettierrcOptions
.prettierignoreBuild outputs, lockfiles, nested packages, VitePress dist/cache

Commands

bash
pnpm run format         # write
pnpm run format:check   # CI / read-only
pnpm exec prettier --write path/to/file.tsx

Implementation examples

Example .prettierrc

json
{
  "trailingComma": "es5",
  "singleQuote": true,
  "printWidth": 120,
  "tabWidth": 2,
  "semi": true,
  "arrowParens": "avoid"
}

Package scripts

json
{
  "scripts": {
    "format": "prettier --write .",
    "format:check": "prettier --check ."
  }
}

Disable ESLint formatting conflicts

js
import prettier from 'eslint-config-prettier/flat';

export default defineConfig([
  // …next configs
  prettier,
]);

Agent / CI

IntegrationBehaviour
Agent PostToolUseFormat the single edited file
CIformat:check inside the quality gate

Relationship to ESLint

eslint-config-prettier turns off rules that conflict with Prettier.

Frontend Corner — agent ops, tooling, and decision records