Compare commits

..

5 Commits

6 changed files with 122 additions and 28 deletions

View File

@ -5,6 +5,7 @@
# See https://pre-commit.com for more information
# See https://pre-commit.ci for more information
ci:
skip: [pnpm-prettier]
# I don't need so many duplicated notifications on the same thing as I keep
# autoupdating manually too. Besides it just creates extra branch I never
# touch.
@ -73,16 +74,26 @@ repos:
- id: reuse
exclude: ^.cache\/.*$
- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.3.0"
# - repo: https://github.com/rbubley/mirrors-prettier
# rev: "v3.3.1"
# hooks:
# - id: prettier
# additional_dependencies: [
# # https://www.npmjs.com/package/prettier
# "prettier@3.3.1",
# # https://www.npmjs.com/package/@prettier/plugin-xml
# "@prettier/plugin-xml@3.4.1",
# ]
- repo: local
hooks:
- id: prettier
additional_dependencies: [
# https://www.npmjs.com/package/prettier
"prettier@3.2.5",
# https://www.npmjs.com/package/@prettier/plugin-xml
"@prettier/plugin-xml@3.4.1",
]
- id: pnpm-prettier
name: prettier
entry: pnpm exec prettier --cache --ignore-unknown --write
language: system
# Better handled by pretty-format-json from pre-commit-hooks.
# Remember to have *.json in .prettierignore!
exclude_types: [json]
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: "2.7.3"

View File

@ -0,0 +1 @@
{}

View File

@ -25,7 +25,16 @@ $monospace-font-family: ui-monospace, "Liberation Mono", Cousine, "Courier New",
* {
color: revert !important;
overflow-wrap: break-word !important;
/* Funny trick for multiple columned pages with automatic column count
column-width: 78ch !important;
*/
/* begin https://clagnut.com/blog/2395/ */
hyphens: auto !important;
hyphenate-limit-chars: 6 3 3 !important;
hyphenate-limit-lines: 2 !important;
hyphenate-limit-last: always !important;
hyphenate-limit-zone: 8% !important;
/* end https://clagnut.com/blog/2395/ */
// Experimental trick to make all emojis text if supported.
font-variant-emoji: text;
}
@ -34,6 +43,12 @@ a {
text-decoration: underline !important;
}
// .page-content {
// width: 100% !important;
// max-width: 78ch !important;
// margin: 0 auto !important;
// }
// Monospace preferred for code
code,
pre {
@ -50,6 +65,10 @@ code {
*:not(a) {
border-color: #000000 !important;
}
.ftf-dma-note {
max-width: 78ch !important;
margin: 0 auto !important;
}
}
// Overrides for dark themes
@ -66,6 +85,8 @@ code {
color: #ffb700 !important;
border-color: #ffb700 !important;
background-color: #000000 !important;
max-width: 78ch !important;
margin: 0 auto !important;
}
}

View File

@ -1,13 +1,35 @@
---
layout: mini
permalink: /n/prettier.html
sitemap: false
sitemap: true
robots: noai
lang: en
title: Prettier packages I use
excerpt: I use them both directly, and within pre-commit
---
Links to prettier packages I use with `pre-commit` for easier checking of
latest versions for manual updates, especially when autoupdate uses unstable
versions.
**{{ page.excerpt }}**
<!-- editorconfig-checker-disable -->
<!-- prettier-ignore-start -->
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
<em lang="fi">Automaattinen sisällysluettelo</em> / <em lang="en">Automatically generated Table of Contents</em>
- [The packages](#the-packages)
- [Installation](#installation)
- [`.pre-commit-config.yaml`](#pre-commit-configyaml)
- [Offline](#offline)
- [Online](#online)
- [Further information](#further-information)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- prettier-ignore-end -->
<!-- editorconfig-checker-enable -->
## The packages
- [prettier](https://www.npmjs.com/package/prettier)
- [prettier-plugin-nginx](https://www.npmjs.com/package/prettier-plugin-nginx)
@ -15,21 +37,60 @@ versions.
- [prettier-plugin-toml](https://www.npmjs.com/package/prettier-plugin-toml)
- [@prettier/plugin-xml](https://www.npmjs.com/package/@prettier/plugin-xml)
## sample pre-commit-config.yaml
## Installation
1. `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 just `pnpm install -D` if it's not your project.
1. If they don't exist already `echo "{}" > .prettierrc && touch .prettierignore`
1. `pnpm exec prettier . --write` or `pnpm 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.
[`pre-commit`]: https://pre-commit.com
[`pre-commit` ci]: https://pre-commit.ci
```yaml
ci:
skip: [pnpm-prettier]
repos:
- repo: local
hooks:
- id: pnpm-prettier
name: prettier
entry: pnpm exec prettier --cache --ignore-unknown --write
language: system
# Better handled by pretty-format-json from pre-commit-hooks.
# Remember to have *.json in .prettierignore!
exclude_types: [json]
```
### Online
```yaml
repos:
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v4.0.0-alpha.8"
#- repo: https://github.com/pre-commit/mirrors-prettier
- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.3.1"
hooks:
- id: prettier
#exclude_types: [json]
# 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.1.1",
"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.2.2",
"@prettier/plugin-xml@3.4.1",
]
```
## Further information
- [prettier docs install](https://prettier.io/docs/en/install)

2
package.json vendored
View File

@ -1,6 +1,6 @@
{
"devDependencies": {
"@prettier/plugin-xml": "3.4.1",
"prettier": "3.3.0"
"prettier": "3.3.1"
}
}

16
pnpm-lock.yaml generated vendored
View File

@ -9,10 +9,10 @@ importers:
devDependencies:
"@prettier/plugin-xml":
specifier: 3.4.1
version: 3.4.1(prettier@3.3.0)
version: 3.4.1(prettier@3.3.1)
prettier:
specifier: 3.3.0
version: 3.3.0
specifier: 3.3.1
version: 3.3.1
packages:
"@prettier/plugin-xml@3.4.1":
@ -35,10 +35,10 @@ packages:
integrity: sha512-wy3mC1x4ye+O+QkEinVJkPf5u2vsrDIYW9G7ZuwFl6v/Yu0LwUuT2POsb+NUWApebyxfkQq6+yDfRExbnI5rcw==,
}
prettier@3.3.0:
prettier@3.3.1:
resolution:
{
integrity: sha512-J9odKxERhCQ10OC2yb93583f6UnYutOeiV5i0zEDS7UGTdUt0u+y8erxl3lBKvwo/JHyyoEdXjwp4dke9oyZ/g==,
integrity: sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg==,
}
engines: { node: ">=14" }
hasBin: true
@ -50,10 +50,10 @@ packages:
}
snapshots:
"@prettier/plugin-xml@3.4.1(prettier@3.3.0)":
"@prettier/plugin-xml@3.4.1(prettier@3.3.1)":
dependencies:
"@xml-tools/parser": 1.0.11
prettier: 3.3.0
prettier: 3.3.1
"@xml-tools/parser@1.0.11":
dependencies:
@ -63,6 +63,6 @@ snapshots:
dependencies:
regexp-to-ast: 0.5.0
prettier@3.3.0: {}
prettier@3.3.1: {}
regexp-to-ast@0.5.0: {}