See Configuration file in the docs.

Filenames

Set up a config file:

  • Main config
    • .prettierrc.json
    • prettier.config.js or .prettierrc.js
  • Ignore config
    • .prettierignore
  • Editor config
    • Prettier uses .editorconfig by default. You can ignore this with --no-editorconfig if you need it.

You might want to edit VS Code settings too if you use a Prettier extension.

Format

Main config

Example config with one rule in it:

  • .prettierrc.json
      {
        "arrowParens": "avoid"
      }
    

Some more rules.

  • .prettierrc.json
      {
        "trailingComma": "es5",
        "tabWidth": 4,
        "semi": false,
        "singleQuote": true
      }
    

Ignore config

See the Ignoring rules cheatsheet for more info.

Alternative

You can also pass command line flags to change Prettier behavior. See the [Prettier CLI][] section of the cheatsheets for more info.