Open manuelpuyol opened 3 years ago
vim is now supported: https://github.com/dense-analysis/ale/pull/3931
Maybe we should document in the README? Mind to open a PR?
I'm attempting to integrate erb-lint
for formatting into Neovim using https://github.com/stevearc/conform.nvim.
Is there way to silence the "report" without parsing the output manually?
By "report" I mean, for example, the following:
Linting and autocorrecting 1 files with 15 linters (11 autocorrectable)...
2 error(s) corrected in ERB files
The file gets correctly auto-fixed, but the report is appended to the top of the file.
Came here to comment the same thing as @vlasar. I would like to to using this in nvim conform with stdin mode so that it's fast but the report output injected at the top messes that up. Maybe it could have a quiet
format like rubocop has. Or possibly redirect the report output at the top to stderr instead of stdout.
@vlasar @nickpoorman I'm a bit late, so I hope you already found solution, but if not, you should be able to use conform with erb_lint
through config like that:
formatters = {
erb_lint = {
stdin = false,
tmpfile_format = ".conform.$RANDOM.$FILENAME",
command = "bundle",
args = { "exec", "erblint", "--autocorrect", "$FILENAME" },
},
},
Hope it helps!
@rrothenberger Awesome. That works great. Thank you!
Summary
erb-lint
is a great tool to keep your ERB consistent and avoid known security issues, such as rendering raw inputs.However, the linting process is usually late in the development process, typically being run during CI, which can slow down developers since they may only get notified of errors after opening a PR and getting the build to fail.
Proposal
Make
erb-lint
easy to integrate with editors (Vim, Emacs, VSCode...) so developers can have real-time feedback of the ERB they are editing.Problems
The current output that
erb-lint
provides does not contain all the necessary information to decorate editors with the exact location of linting errors. Right now, it's only possible to get the line where the error occurs instead of the whole block (line + columns).Solution
Adding a generic formatter that exposes more data about the error, such as a JSON formatter, similar to rubocop's formatter.
Exposing structured information about the errors in the file would allow better decorations for editors, like underlining the exact location of offenses.
Related
https://github.com/Shopify/erb-lint/issues/173 https://github.com/Shopify/erb-lint/pull/219 https://github.com/Shopify/erb-lint/pull/224