Skip to content

Commit

Permalink
Replace deprecated erblint/erb-lint with preferred erb_lint (#127)
Browse files Browse the repository at this point in the history
The `erb_lint` gem has officially standardized on `erb_lint` as the
preferred binary and `.erb_lint.yml` as the configuration file. The
`erblint` and `erb-lint` spellings are deprecated.

Update nextgen's erb_lint generator to follow the new conventions.
  • Loading branch information
mattbrictson authored Oct 18, 2024
1 parent db43536 commit 6b59618
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Nextgen can install and configure your choice of these recommended gems:
- [bundler-audit](https://github.com/rubysec/bundler-audit)
- [capybara-lockstep](https://github.com/makandra/capybara-lockstep)
- [dotenv](https://github.com/bkeepers/dotenv)
- [erb_lint](https://github.com/Shopify/erb-lint)
- [erb_lint](https://github.com/Shopify/erb_lint)
- [factory_bot_rails](https://github.com/thoughtbot/factory_bot_rails)
- [good_migrations](https://github.com/testdouble/good-migrations)
- [letter_opener](https://github.com/ryanb/letter_opener)
Expand Down
2 changes: 1 addition & 1 deletion config/generators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dotenv:
description: "Install dotenv gem and add .env.sample"

erb_lint:
prompt: "ERB Lint"
prompt: "erb_lint"
description: "Install erb_lint gem and correct existing issues"
requires: frontend

Expand Down
4 changes: 2 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Which optional enhancements would you like to add?
⬡ Bundler Audit
⬡ capybara-lockstep
⬡ dotenv
ERB Lint
erb_lint
⬡ ESLint
⬡ Factory Bot
⬡ GitHub PR template
Expand Down Expand Up @@ -132,7 +132,7 @@ Which optional enhancements would you like to add?
⬢ Bundler Audit
⬢ capybara-lockstep
⬢ dotenv
ERB Lint
erb_lint
⬢ ESLint
⬢ Factory Bot
⬢ GitHub PR template
Expand Down
10 changes: 5 additions & 5 deletions lib/nextgen/generators/erb_lint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
say_git "Install erb_lint"
install_gem "erb_lint", group: :development, require: false
binstub "erb_lint"
template ".erb-lint.yml.tt"
template ".erb_lint.yml.tt"

say_git "Add erblint to default rake task"
copy_file "lib/tasks/erblint.rake"
add_lint_task "erblint"
say_git "Add erb_lint to default rake task"
copy_file "lib/tasks/erb_lint.rake"
add_lint_task "erb_lint"

say_git "Auto-correct any existing issues"
run "bin/erblint --lint-all -a", capture: true
run "bin/erb_lint --lint-all -a", capture: true
6 changes: 3 additions & 3 deletions lib/nextgen/generators/rubocop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
say_git "Replace .rubocop.yml"
template ".rubocop.yml", context: binding, force: true

if File.exist?(".erb-lint.yml")
say_git "Regenerate .erb-lint.yml with rubocop support"
template ".erb-lint.yml", force: true
if File.exist?(".erb_lint.yml")
say_git "Regenerate .erb_lint.yml with rubocop support"
template ".erb_lint.yml", force: true
end

say_git "Add rubocop to default rake task"
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions template/.overcommit.yml.tt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ PreCommit:
BundleCheck:
enabled: true

<% if File.exist?(".erb-lint.yml") -%>
<% if File.exist?(".erb_lint.yml") -%>
ErbLint:
enabled: true
required_executable: bundle
command: ["bundle", "exec", "erblint"]
command: ["bundle", "exec", "erb_lint"]
include: "**/*.html.erb"
<% end -%>

Expand Down
13 changes: 13 additions & 0 deletions template/lib/tasks/erb_lint.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

desc "Run erb_lint"
task :erb_lint do
sh "bin/erb_lint --lint-all"
end

namespace :erb_lint do
desc "Autocorrect erb_lint offenses"
task :autocorrect do
sh "bin/erb_lint --lint-all -a"
end
end
13 changes: 0 additions & 13 deletions template/lib/tasks/erblint.rake

This file was deleted.

0 comments on commit 6b59618

Please sign in to comment.