Use prettier for auto formatting of JSON/YAML 43/16143/1
authorThanh Ha <zxiiro@gmail.com>
Wed, 10 Jul 2019 02:24:40 +0000 (22:24 -0400)
committerThanh Ha <zxiiro@gmail.com>
Wed, 10 Jul 2019 02:27:13 +0000 (22:27 -0400)
No more debate on which style to use, prettier is an opinionated
style formatter for JSON and YAML files.

Also standardize the pre-commit env name with other lfit projects.

Signed-off-by: Thanh Ha <zxiiro@gmail.com>
Change-Id: I2655382ba6fb099970418475ad4cf939b11752e5

.pre-commit-config.yaml
tox.ini

index ce05348..a496135 100644 (file)
@@ -1,6 +1,11 @@
 ---
 repos:
   - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v1.3.0
+    rev: v2.2.1
     hooks:
       - id: trailing-whitespace
+
+  - repo: https://github.com/prettier/prettier
+    rev: 1.18.2
+    hooks:
+      - id: prettier
diff --git a/tox.ini b/tox.ini
index d9ac9b4..d481df6 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,16 +1,10 @@
 [tox]
 minversion = 1.6
 envlist =
-    check-hooks,
-    coala
+    coala,
+    pre-commit
 skipsdist = true
 
-[testenv:check-hooks]
-deps = pre-commit~=1.11.2
-commands =
-    pre-commit install
-    pre-commit run --all-files
-
 [testenv:coala]
 basepython = python3
 deps =
@@ -37,6 +31,12 @@ whitelist_externals = echo
 deps = -rrequirements.txt
 commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck
 
+[testenv:pre-commit]
+deps = pre-commit
+commands =
+    pre-commit install
+    pre-commit run --all-files
+
 [testenv:reno]
 deps = -rdocs/requirements.txt
 commands = reno {posargs:--help}