Use prettier for automatic formatting for YAML 41/16141/3
authorThanh Ha <zxiiro@gmail.com>
Wed, 10 Jul 2019 02:12:48 +0000 (22:12 -0400)
committerThanh Ha <zxiiro@gmail.com>
Fri, 12 Jul 2019 14:42:03 +0000 (10:42 -0400)
No more debate on style formatting, prettier is an opinionated
style formatter that will automatically format to the right
style.

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

.coafile
.pre-commit-config.yaml [new file with mode: 0644]
tox.ini

index 44f6215..c0e13b0 100644 (file)
--- a/.coafile
+++ b/.coafile
@@ -44,10 +44,3 @@ files = **.sh
 shell = bash
 indent_size = 4
 use_spaces = yeah
-
-[all.YAML]
-bears = YAMLLintBear
-files = **.yaml, **.yml
-document_start = True
-yamllint_config = yamllint.conf
-
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644 (file)
index 0000000..a496135
--- /dev/null
@@ -0,0 +1,11 @@
+---
+repos:
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    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 bcde1a5..54b2761 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -6,8 +6,9 @@ envlist =
   jjb,
   jjb-compare-xml,
   jjb-latest,
-  jjb-version
-  license
+  jjb-version,
+  license,
+  pre-commit
 skipsdist = true
 passenv = TOX_WORK_DIR
 toxworkdir = {env:TOX_WORK_DIR:/tmp/v}
@@ -63,6 +64,11 @@ commands = python {toxinidir}/check_jjb_version.py
 deps = lftools
 commands = lftools license check-dir -r '.+' shell
 
+[testenv:pre-commit]
+deps = pre-commit
+commands =
+    pre-commit run --all-files
+
 #########
 # Tools #
 #########