mirror of
https://github.com/mikaela/mikaela.github.io/
synced 2024-11-13 23:49:26 +01:00
3.2 KiB
3.2 KiB
{{ page.excerpt }}
Automaattinen sisällysluettelo / Automatically generated Table of Contents
The packages
Installation
npm install -D -E prettier@3.3.1 prettier-plugin-nginx@1.0.3 @prettier/plugin-ruby@4.0.4 prettier-plugin-toml@2.0.1 @prettier/plugin-xml@3.4.1
or probably justpnpm install -D
if it’s not your project.- If they don’t exist already
echo "{}" > .prettierrc && touch .prettierignore
pnpm exec prettier . --write
orpnpm exec prettier . --check
.pre-commit-config.yaml
This is the file that controls pre-commit
s
behaviour.
Offline
I accidentally wrote this while updating this page to reflect me
using prettier outside of pre-commit
too nowadays.
This has the advantage that the same local environment gets reused and
dependencies are managed centrally, but assumes everyone uses pnpm,
won’t work in pre-commit
ci and may have other issues I am not thinking of as a not-coder
myself.
ci:
skip: [pnpm-prettier]
repos:
- repo: local
hooks:
- id: pnpm-prettier
name: prettier
entry: pnpm exec prettier --write
language: system
# Better handled by pretty-format-json from pre-commit-hooks.
# Remember to have *.json in .prettierignore!
exclude_types: [json]
Online
repos:
#- repo: https://github.com/pre-commit/mirrors-prettier
- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.3.1"
hooks:
- id: prettier
# Better handled by pretty-format-json from pre-commit-hooks.
# Remember to have *.json in .prettierignore!
exclude_types: [json]
additional_dependencies: [
# https://aminda.eu/n/prettier
"prettier@3.3.1",
"prettier-plugin-nginx@1.0.3",
"@prettier/plugin-ruby@4.0.4",
"prettier-plugin-toml@2.0.1",
"@prettier/plugin-xml@3.4.1",
]