Use the CommentSyntax linter
mainThe CommentSyntax linter enforces correct ERB comment syntax. It flags Ruby-style comments (<% # comment %>) which are technically invalid in ERB and can cause parsing failures, recommending the ERB-specific syntax (<%# comment %>) instead. Multi-line comments using standard Ruby syntax inside ERB tags are acceptable.
Bad ❌
<% # This is a Ruby comment %>
Good ✅
<%# This is an ERB comment %>
Good ✅
<%
# This is a multi-line ERB comment.
%>