Shopify / erb_lint

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

Add none reporter and option to hide file header for better in editor support #372

Open rrothenberger opened 1 month ago

rrothenberger commented 1 month ago

Hey 👋

The goal of this PR is to make it easier to use this great tool within editors, for example using it with conform. It does that by adding a new reporter: none, which will prevent reporting any linter output to stdout, and by adding flag --no-file-header which will prevent outputting this line:

================ /path/to/file.html.erb ==================

Naming is hard, so more than happy to adjust naming.

Example: image

There is another PR with similar changes: #357, the main differences are:

I skipped specs for the reporter itself, as this just prevents outputs.


If someone found this out looking for solution for conform - even if this is not merged, you still can use erb_lint with conform, just not through stdin, example configuration:

    formatters = {
      erb_lint = {
        stdin = false,
        tmpfile_format = ".conform.$RANDOM.$FILENAME",
        command = "bundle",
        args = { "exec", "erblint", "--autocorrect", "$FILENAME" },
      },
    },