Shopify / erb_lint

Lint your ERB or HTML files
MIT License
676 stars 122 forks source link

Adding ERBLint to a new rails 7.2 app with .erb-lint.yml from Readme results in a parsing error when running erblint #359

Open sebastianiorga opened 4 months ago

sebastianiorga commented 4 months ago

I made a fresh rails app 7.2 and just added erb_lint and better_html to it. When I run bundle exec erblint I get

warning: parser/current is loading parser/ruby33, which recognizes 3.3.4-compliant syntax, but you are running 3.3.3.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
error parsing config: (.erb-lint.yml): mapping values are not allowed in this context at line 2 column 8

I played around a bit and this error replicates when doing YAML.safe_load(File.read(FILE_PATH)) but it parses fine when doing YAML.safe_load_file(FILE_PATH). Even if I monkeypatch the gem use safe_load_file there are then more errors that don't really make sense(it complains about deep_stringify_keys being missing but I see you are loading activesupport...)

Versions and yml files

better_html (2.1.1)
erb_lint (0.5.0)
rails (7.2.0.beta3)
ruby-3.3.3
Ubuntu 20.04.6 LTS in WSL2, running commands via zsh

# .erb-lint.yml
---
linters:
  ErbSafety:
    enabled: true
  Rubocop:
    enabled: true
    rubocop_config:
      inherit_from:
        - .rubocop.yml
  BetterHtml:
    enabled: true

# .better-html.yml
allow_single_quoted_attributes: false

# .rubocop.yml
# Omakase Ruby styling for Rails
inherit_gem: { rubocop-rails-omakase: rubocop.yml }

# Overwrite or add rules to create your own house style
#
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
# Layout/SpaceInsideArrayLiteralBrackets:
#   Enabled: false