---
title: "Prettier"
description: "Prettier formats code, both JavaScript and CSS, preferably on Save."
canonical_url: "https://www.codex.republic.se/writing-code/prettier"
section: "Pages"
---

# Prettier

[Prettier](https://prettier.io/) formats code, both JavaScript and CSS, preferably on Save.

Prettier is installed with `npm install` in each project and controlled by a couple of configuration files in the repository.

- `.prettierrc.json`
- `.prettierignore`

## PhpStorm settings

You can also run the following to format with Prettier:

- `⌥ ⌘ L` to manually format the code, and
- `⇧ ⌥⌘ L` to display formatting options.

But also, the option to check "On save" in Prettier, seems to work well if you remember sneaking in a `// prettier-ignore` or `// eslint-disable-next-line xx-xxx` here and there to get what you want.

... Jump to the next "error" by pressing F2.

---

- [ .prettierrc.json ](/writing-code/prettier/prettierrc-json)
- [ .prettierignore ](/writing-code/prettier/prettierignore)
