Recipe

Prettier Setup

Zero-config opinionated code formatting for every project. Install once, format on save, never argue about style again.

prettierformattingtooling

01 Install

Add Prettier as a dev dependency in your project root.

npm install --save-dev prettier

02 Configuration

Create a .prettierrc at your project root. This is the Meridian house config.

{
  "semi": true,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "all",
  "printWidth": 100,
  "bracketSpacing": true,
  "arrowParens": "always"
}

03 Ignore file

Add a .prettierignore to skip generated or vendored code.

node_modules
dist
.next
coverage
pnpm-lock.yaml

04 Package scripts

Wire up format and check commands in package.json.

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

05 Editor integration

Install the Prettier extension for your editor and enable format-on-save. For VS Code, add to settings.json:

{
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true
}