n/prettier.md: update for corepack

This commit is contained in:
Aminda Suomalainen 2024-06-21 07:02:31 +03:00
parent cd4aa2bf40
commit a16887e471
Signed by: Mikaela
SSH Key Fingerprint: SHA256:CXLULpqNBdUKB6E6fLA1b/4SzG0HvKD19PbIePU175Q

View File

@ -41,11 +41,12 @@ _{{ page.excerpt }}_
## Installation ## Installation
1. `npm install -D -E prettier@3.3.2 prettier-plugin-nginx@1.0.3 @prettier/plugin-ruby@4.0.4 prettier-plugin-toml@2.0.1 @prettier/plugin-xml@3.4.1 prettier-plugin-sh@0.14.0` 1. `corepack pnpm install -D -E prettier@latest prettier-plugin-nginx@latest @prettier/plugin-ruby@latest prettier-plugin-toml@latest @prettier/plugin-xml@latest prettier-plugin-sh@latest`
or probably just `pnpm install -D` if it's not your project. or probably just `corepack pnpm install -D` if it's not your project.
1. If they don't exist already 1. If they don't exist already
`echo "{}" > .prettierrc && touch .prettierignore` `echo "{}" > .prettierrc && touch .prettierignore`
1. `pnpm exec prettier . --write` or `pnpm exec prettier . --check` 1. `corepack pnpm exec prettier . --write` or
`corepack pnpm exec prettier . --check`
## Configuration ## Configuration
@ -68,11 +69,11 @@ looks like:
{ "files": ".prettierrc", "options": { "parser": "json" } }, { "files": ".prettierrc", "options": { "parser": "json" } },
{ {
"files": "conf/librewolf.overrides.cfg", "files": "conf/librewolf.overrides.cfg",
"options": { "parser": "javascript" } "options": { "parser": ".js" }
}, },
{ {
"files": "conf/autoconfig.js.online", "files": "conf/autoconfig.js.online",
"options": { "parser": "javascript" } "options": { "parser": ".js" }
} }
] ]
} }
@ -105,14 +106,14 @@ repos:
hooks: hooks:
- id: pnpm-install-dev - id: pnpm-install-dev
name: Install pnpm dev dependencies name: Install pnpm dev dependencies
entry: pnpm install -D entry: corepack pnpm install -D
language: system language: system
always_run: true always_run: true
verbose: true #verbose: true
pass_filenames: false pass_filenames: false
- id: prettier - id: prettier
name: prettier name: prettier
entry: pnpm exec prettier --cache --ignore-unknown --write entry: corepack pnpm exec prettier --cache --ignore-unknown --write
language: system language: system
# Better handled by pretty-format-json from pre-commit-hooks. # Better handled by pretty-format-json from pre-commit-hooks.
# Remember to have *.json in .prettierignore! # Remember to have *.json in .prettierignore!
@ -144,3 +145,5 @@ repos:
## Further information ## Further information
- [prettier docs install](https://prettier.io/docs/en/install) - [prettier docs install](https://prettier.io/docs/en/install)
- [corepack docs](https://nodejs.org/api/corepack.html)
- [corepack readme](https://github.com/nodejs/corepack/blob/main/README.md)