Add ERB Lint to lint templates (RuboCop only covers .rb)#1988
Open
maebeale wants to merge 6 commits into
Open
Conversation
RuboCop only parses .rb, so nothing checked the Ruby inside <% %> tags or the ERB/HTML conventions documented in CLAUDE.md. Add erb_lint with a conservative, fully-autocorrectable ruleset (mechanical HTML/ERB formatting plus an omakase-matching RuboCop subset), wire it into ai/lint, and run it in CI alongside RuboCop. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mechanical only: normalizes whitespace around/inside ERB tags and applies the omakase Ruby style (double quotes, brace/bracket spacing) to code inside <%= %> tags. No behavioral changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The HTML/ERB conventions are now enforced, not just documented; note that and update the ai/lint command descriptions to mention ERB Lint. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The array/hash/block brace cops default to no_space in bare RuboCop but omakase wants a space inside them; enabling the cops without pinning EnforcedStyle silently enforced the opposite, so 772 array-bracket violations went undetected. Pin the styles to omakase's values and extend the subset to the other autocorrectable rules documented in CLAUDE.md: block-brace spacing, no trailing commas, no redundant .to_s coercion, and no semicolons. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Applies the newly-covered rules — omakase array/block-brace spacing and trailing-comma removal — across templates. Mechanical only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CI installs gems into vendor/bundle (bundler-cache), so `erb_lint --lint-all` was linting third-party gem templates and failing on 237 offenses in files we don't own. RuboCop excludes vendor by default; erb_lint doesn't, so exclude it (plus node_modules and tmp) explicitly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 suggested review level: 3 Read 📖 new lint tooling + a large but purely mechanical autocorrect sweep — review the config/CI, skim the sweep
Why
RuboCop only parses
.rb, so nothing checked the Ruby inside<% %>tags or the ERB/HTML conventions documented in CLAUDE.md — they were written down but unenforced. This adds an actual ERB linter.What
erb_lintgem +.erb_lint.yml— conservative, fully-autocorrectable ruleset:.to_s, no semicolons. EnforcedStyle is pinned to omakase's values (several cops default tono_spacein bare RuboCop).ai/lint(runs alongside RuboCop;--fixautocorrects both) and CI (new step in the RuboCop workflow).Notes
SelfClosingTag,ErbSafety/better-html, i18nHardCodedString); each addition just needs its own autocorrect pass.