Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions javascript/packages/linter/docs/rules/erb-right-trim.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

This rule enforces the use of `-%>` for right-trimming ERB output tags (like `<%= %>`) instead of `=%>`.

Additionally, this rule enforces the use of `%>` instead of `-%>` or `=%>` when right-trimming has no effect.

## Rationale

While `=%>` can be used for right-trimming whitespace in some ERB engines (like Erubi), it is an obscure and not well-defined syntax that lacks consistent support across most ERB implementations.
Expand All @@ -26,6 +28,8 @@ The `-%>` syntax is the standard, well-documented approach for right-trimming th
<% items.each do |item| %>
<li><%= item -%></li>
<% end %>

<%# locals: () %>
```

### 🚫 Bad
Expand All @@ -45,6 +49,8 @@ The `-%>` syntax is the standard, well-documented approach for right-trimming th
<% items.each do |item| =%>
<li><%= item %></li>
<% end %>

<%# locals: () -%>
```

## References
Expand Down
Loading