n/prettier.md: add a section on configuration

This commit is contained in:
Aminda Suomalainen 2024-06-07 06:43:15 +03:00
parent 35d791778f
commit ef27f940b2
Signed by: Mikaela
SSH Key Fingerprint: SHA256:CXLULpqNBdUKB6E6fLA1b/4SzG0HvKD19PbIePU175Q

View File

@ -19,6 +19,7 @@ excerpt: I use them both directly, and within pre-commit
- [The packages](#the-packages)
- [Installation](#installation)
- [Configuration](#configuration)
- [`.pre-commit-config.yaml`](#pre-commit-configyaml)
- [Offline](#offline)
- [Online](#online)
@ -44,6 +45,19 @@ excerpt: I use them both directly, and within pre-commit
1. If they don't exist already `echo "{}" > .prettierrc && touch .prettierignore`
1. `pnpm exec prettier . --write` or `pnpm exec prettier . --check`
## Configuration
I do with `.editorconfig` what I can, but for example this site's `.prettierrc` looks like:
```json
{
"plugins": ["@prettier/plugin-xml"],
"overrides": [{ "files": ".prettierrc", "options": { "parser": "json" } }]
}
```
at the time of writing. It's directly from documentation excluding the plugin name, but I will want it everywhere.
## `.pre-commit-config.yaml`
This is the file that controls [`pre-commit`]s behaviour.