Skip to content

Prettier

Install

  1. Install Prettier

    pnpm i -D prettier
    
  2. Create config file (for editors, etc.)

    echo "{}" > .prettierrc.json
    
  3. Create a .prettierignore, base it off the .gitignore

    • Vite

      node_modules
      build
      pnpm-lock.yaml
      
    • Next.js

      node_modules
      .next
      out
      build
      pnpm-lock.yaml
      
  4. Add a format script in the package.json

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

Last update: August 11, 2023
Created: June 3, 2023