Fix: prettier pre-commit configuration 19/67819/4
authorGuillaume Lambert <guillaume.lambert@orange.com>
Wed, 26 May 2021 19:27:51 +0000 (21:27 +0200)
committerGuillaume Lambert <guillaume.lambert@orange.com>
Wed, 26 May 2021 21:27:45 +0000 (23:27 +0200)
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 <guillaume.lambert@orange.com>
Change-Id: I1991d5dbab8c6d4ad83e3466fdd4a7bc3cfc865a

.pre-commit-config.yaml

index 3bf54d6..318d59c 100644 (file)
@@ -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