From 935f3a20e0c58f292adf4b859458f94710b2f4ef Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Fri, 7 Aug 2020 11:21:48 -0400 Subject: [PATCH] Add prettier for auto formatting It appears that we inconsistently use 2 and 4 space indents for YAML however 2 space indents appear to be the dominant one in practice so set config to that so that the least amount of changes happen when prettier is applied. This patch is also a preparation patch for RELENG-152 as the automation we want to add for managing JJB updates when branch cutting requires a consistent formatting of the YAML files so that auto-generated output can match appropriately with minimal formatting changes. Issue: RELENG-152 Change-Id: Ie35521de0378b7892f06ff7f36d470847c78989f Signed-off-by: Thanh Ha --- .editorconfig | 2 +- .pre-commit-config.yaml | 13 +++++++++---- .yamllint | 1 - 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.editorconfig b/.editorconfig index 5eb4e678e..f042ae5fc 100644 --- a/.editorconfig +++ b/.editorconfig @@ -21,5 +21,5 @@ indent_size = 4 max_line_length = 80 [*.yaml] -indent_size = 4 +indent_size = 2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 13f206b2d..9f5aa4ad1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,6 +6,11 @@ repos: - id: check-json - id: trailing-whitespace + - repo: https://github.com/prettier/prettier + rev: 2.0.5 + hooks: + - id: prettier + - repo: https://github.com/jorisroovers/gitlint rev: v0.13.1 hooks: @@ -16,10 +21,10 @@ repos: hooks: - id: shellcheck exclude: > - (?x)^( - jjb/global-jjb/.*| - jenkins-config/.* - )$ + (?x)^( + jjb/global-jjb/.*| + jenkins-config/.* + )$ - repo: https://github.com/ambv/black rev: stable diff --git a/.yamllint b/.yamllint index 74bbf1a30..93ca0092e 100644 --- a/.yamllint +++ b/.yamllint @@ -10,4 +10,3 @@ rules: max: 120 ignore: | packer - -- 2.36.6