From a2056934c4263ea5eed693c115d0ff691eab4900 Mon Sep 17 00:00:00 2001 From: Sarah Gibson Date: Fri, 14 Oct 2022 12:50:19 +0100 Subject: [PATCH 1/2] Add a .prettierignore file to restrict what prettier autoformats to only YAML --- .prettierignore | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000000..6dc620199a5 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,13 @@ +# 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. +# NOTE: .cff files are a type of YAML +# +**/*.md +**/*.json + +# Other file types we should always ignore as they are likely auto-generated +# +**/*.css +**/*.js \ No newline at end of file From 39e3e9dc5b5ca3570aeaa7d31649d142f68c4ba4 Mon Sep 17 00:00:00 2001 From: Sarah Gibson Date: Fri, 14 Oct 2022 12:52:44 +0100 Subject: [PATCH 2/2] Add .pre-commit-config.yaml to configure prettier as a tool to format git commits --- .pre-commit-config.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000000..adea73b73b7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +# pre-commit is a tool to perform a predefined set of tasks manually and/or +# automatically before git commits are made. pre-commit can also be run in CI +# on Pull Requests and will auto-commit corrections to the PR for consistency. +# +# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level +# +# How to install locally +# +# - pip install pre-commit +# +# Common tasks +# +# - Run on all files: pre-commit run --all-files +# - Register git hooks: pre-commit install --install-hooks +# +repos: + # Autoformat: yaml + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.0.0-alpha.1 + hooks: + - id: prettier