Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-format YAML with prettier and pre-commit #2728

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions .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
13 changes: 13 additions & 0 deletions .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