Commenting out an ERB output tag by inserting a # (which is what most editors do when you toggle a comment on <%= ... %>) is a convenient way to disable a tag while debugging, but it is easy to forget and commit. This rule surfaces those leftovers so they can either be removed or restored.
The rule intentionally only recognizes the = forms. A comment like <%# hello world %> is prose and is never flagged, and neither is a divider such as <%# === Section === %>.
This rule is reported at info severity and does not fail herb lint unless you raise failLevel.
Linter Rule: Disallow commented-out ERB output tags
Rule:
erb-no-commented-out-output-tagsDescription
Flag ERB comments that look like a temporarily commented-out output tag, i.e.
<%#=,<%# =,<%#==, and<%# ==.Rationale
Commenting out an ERB output tag by inserting a
#(which is what most editors do when you toggle a comment on<%= ... %>) is a convenient way to disable a tag while debugging, but it is easy to forget and commit. This rule surfaces those leftovers so they can either be removed or restored.The rule intentionally only recognizes the
=forms. A comment like<%# hello world %>is prose and is never flagged, and neither is a divider such as<%# === Section === %>.This rule is reported at
infoseverity and does not failherb lintunless you raisefailLevel.Examples
✅ Good
🚫 Bad
References
-