From 03bb9899fa1bc9ca595fb2d4ae22b8c86869e94d Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Fri, 8 Jan 2021 13:06:04 +0100 Subject: [PATCH 1/2] Copy Hound's default Haml lint config --- .haml-lint.yml | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ .hound.yml | 2 ++ 2 files changed, 72 insertions(+) create mode 100644 .haml-lint.yml diff --git a/.haml-lint.yml b/.haml-lint.yml new file mode 100644 index 0000000000..25ceeb841e --- /dev/null +++ b/.haml-lint.yml @@ -0,0 +1,70 @@ +# Whether to ignore frontmatter at the beginning of HAML documents for +# frameworks such as Jekyll/Middleman +skip_frontmatter: false + +linters: + AltText: + enabled: false + + ClassAttributeWithStaticValue: + enabled: true + + ClassesBeforeIds: + enabled: true + + ConsecutiveComments: + enabled: true + + ConsecutiveSilentScripts: + enabled: true + max_consecutive: 2 + + EmptyScript: + enabled: true + + HtmlAttributes: + enabled: true + + ImplicitDiv: + enabled: true + + LeadingCommentSpace: + enabled: true + + LineLength: + enabled: true + max: 80 + + MultilinePipe: + enabled: true + + MultilineScript: + enabled: true + + ObjectReferenceAttributes: + enabled: true + + RuboCop: + enabled: false + + RubyComments: + enabled: true + + SpaceBeforeScript: + enabled: true + + SpaceInsideHashAttributes: + enabled: true + style: space + + TagName: + enabled: true + + TrailingWhitespace: + enabled: true + + UnnecessaryInterpolation: + enabled: true + + UnnecessaryStringOutput: + enabled: true \ No newline at end of file diff --git a/.hound.yml b/.hound.yml index 19ee0c5037..f84288e246 100644 --- a/.hound.yml +++ b/.hound.yml @@ -2,3 +2,5 @@ rubocop: config_file: .rubocop_styleguide.yml scss: config_file: .scss-lint.yml +haml: + config_file: .haml-lint.yml From b08a918ba53a2b2044808da8590e2ccaaf18350f Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Fri, 8 Jan 2021 13:06:29 +0100 Subject: [PATCH 2/2] Do not check for spaces inside the braces of hash This shuts the annoying lint error ``` Hash attribute should start with one space after the opening brace Hash attribute should end with one space before the closing brace ``` and it aligns with our existing style. See https://github.com/openfoodfoundation/openfoodnetwork/pull/6629 as an example. --- .haml-lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.haml-lint.yml b/.haml-lint.yml index 25ceeb841e..979e351be6 100644 --- a/.haml-lint.yml +++ b/.haml-lint.yml @@ -55,7 +55,7 @@ linters: SpaceInsideHashAttributes: enabled: true - style: space + style: no_space TagName: enabled: true @@ -67,4 +67,4 @@ linters: enabled: true UnnecessaryStringOutput: - enabled: true \ No newline at end of file + enabled: true