From: Guillaume Lambert Date: Wed, 26 May 2021 19:27:51 +0000 (+0200) Subject: Fix: prettier pre-commit configuration X-Git-Tag: v0.7.0~9 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=dac1f24f85f7c9b12e87ca495fbcb637f0d6653c;p=releng%2Fdocs-conf.git Fix: prettier pre-commit configuration According to https://github.com/prettier/pre-commit the prettier repo to use in the pre-commit configuration file shifted to the new URL https://github.com/pre-commit/mirrors-prettier Also running this hook locally outside of the tox profile resulted in the following error: $ git commit --amend [..] gitlint...........................................................Passed prettier..........................................................Failed - hook id: prettier - exit code: 2 [error] No matching files. Patterns: .git/COMMIT_EDITMSG According to https://github.com/pre-commit/mirrors-prettier/issues/5 the reason behind is that prettier can not perform at the [commit-msg] stage and only at the [commit] stage. Forcing the stage parameter to [commit] in the hook configuration managed to fix the issue. Signed-off-by: Guillaume Lambert Change-Id: I1991d5dbab8c6d4ad83e3466fdd4a7bc3cfc865a --- diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3bf54d6..318d59c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,10 +13,11 @@ repos: hooks: - id: gitlint - - repo: https://github.com/prettier/pre-commit + - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.1.2 hooks: - id: prettier + stages: [commit] - repo: https://github.com/ambv/black rev: stable