Added lints for ERB templates #609
Reference in New Issue
Block a user
Delete Branch "erblint"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR adds lints to the ERB templates. Yes,
erblintis not perfect, however currently it is the only solution that exists and works.I fixed existing errors and added
erblintstep to the CI.Thanks for the cleanup! Just left a few potential suggestions.
@@ -55,2 +55,4 @@run: bin/rubocop -f github- name: Lint templates for consistent stylerun: ./bin/erblint ./app/**/*.erbCould we keep this all in a single
lintjob with multiple steps to lint Ruby and ERB?Also, is there a reason we're not calling
./bin/erblint --lint-all?@@ -43,6 +43,7 @@ group :development, :test dogem "dotenv-rails"gem "letter_opener"gem "i18n-tasks"gem "erb_lint"What do you think of adding a
.erb-lint.ymlfile for a bit more explicitness and integrating with our Rubocop setup?@@ -55,2 +55,4 @@run: bin/rubocop -f github- name: Lint templates for consistent stylerun: ./bin/erblint ./app/**/*.erb@zachgoll I merged two tasks into one. I prefer calling
./bin/erblint ./app/**/*.erbbecause of explicitness, but--lint-allalso makes sense, updated.@@ -43,6 +43,7 @@ group :development, :test dogem "dotenv-rails"gem "letter_opener"gem "i18n-tasks"gem "erb_lint"@zachgoll Yes, I forget about the config for the
erblint. At the same time, I am completely against enabling all Rubocop rules forerblint. I tried doing this locally, and I got about 3500 errors with only 3000 auto-correctable. Besides this, some HTML tags started to look really strange after the automatic correction.@@ -43,6 +43,7 @@ group :development, :test dogem "dotenv-rails"gem "letter_opener"gem "i18n-tasks"gem "erb_lint"I added
.erb-lint.yml, please check.@@ -43,6 +43,7 @@ group :development, :test dogem "dotenv-rails"gem "letter_opener"gem "i18n-tasks"gem "erb_lint"Sounds good, and very understandable on the rubocop integration. I'm all for auto checks, but not if it's going to slow us down too much.
Looks good! Thanks again for the cleanup 👍
@igor-alexandrov looks like the
--lint-allpicked up vendor code. Could probably add to the config:??
erblintcan be tricky. I prefer to have a very explicit call that will only lint files inside of an./appfolder.Very nice addition
with the linters growing in the CI (in the future we could have i18n-tasks, eslint etc) I usually add to my project a small utility to run them all in a single command
something like that in
bin/lint@adrienpoly I will open a new PR for this. Thank you for this suggestion.