Skip to content

Commit

Permalink
pre-commit: setup pre-commit config to run prettier on YAML files
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Nov 5, 2021
1 parent a53ecff commit 31a28e1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# pre-commit is a tool to perform a predefined set of tasks manually and/or
# automatically before git commits are made.
#
# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level
#
# Common tasks
#
# - Run on all files: pre-commit run --all-files
# - Register git hooks: pre-commit install --install-hooks
#
repos:
# FIXME: Consider adding more, for example by looking at those configured for
# TLJH in https://github.com/jupyterhub/the-littlest-jupyterhub/blob/main/.pre-commit-config.yaml

# Autoformat: markdown, yaml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.4.1
hooks:
- id: prettier
15 changes: 15 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Helm chart's templates aren't pure YAML files
**/templates/

# It would be trouble if we had two automatic formatters on the same files. This
# could happen if we would auto-format the sops generated files with prettier.
secrets/**/*
**/secrets.yaml
!secrets/config/hubs/schema.yaml

# To create a minimal change suggestion, prettier was introduced to auto-format
# the YAML files only. It is absolutely reasonable to auto-format markdown files
# and json files as well, but for now, let's make prettier only auto-format
# YAML.
**/*.md
**/*.json

0 comments on commit 31a28e1

Please sign in to comment.