I've been checking out the formatter and it's really interesting - so far I've come across only two things that I'm on the fence about.
The first is with really long classes which I think is actually probably fine, I just wasn't expecting it, but the second is with code like this:
# views/kaminari/_last_page.html
<%# locals: (url:, current_page:, total_pages:, per_page:, remote:) %>
<li class="<%= class_names("page-item user-select-none", disabled: current_page.first?) %>">
<%=
link_to(
sanitize(t("views.pagination.first")),
url,
remote:,
class: "page-link",
tabindex: current_page.first? ? -1 : nil
)
%>
</li>
This is how I have laid the template out, which RubyMine and erb_lint both are happy with - but Herb wants to squash it:
<%# locals: (url:, current_page:, total_pages:, per_page:, remote:) %>
<li class="<%= class_names("page-item user-select-none", disabled: current_page.first?) %>">
<%= link_to(
sanitize(t("views.pagination.first")),
url,
remote:,
class: "page-link",
tabindex: current_page.first? ? -1 : nil
) %>
</li>
erb_lint does not care about this, but RubyMine then wants to indent everything:
<%# locals: (url:, current_page:, total_pages:, per_page:, remote:) %>
<li class="<%= class_names("page-item user-select-none", disabled: current_page.first?) %>">
<%= link_to(
sanitize(t("views.pagination.first")),
url,
remote:,
class: "page-link",
tabindex: current_page.first? ? -1 : nil
) %>
</li>
after which Herb, RubyMine, and erb_lint all agree again.
I'm not super worried about all three tools disagreeing because that's the point of picking a formatter, but personally for this kind of code I think I prefer having more lines and balanced on both sides to make it clear where the "block of Ruby" begins and ends
Ultimately I'm wondering if this is something you'd be open to support either configuring or doing something like what Prettier does w/ objects whereby if Herb saw the newline after the opening <%, it'd keep it.
I've been checking out the formatter and it's really interesting - so far I've come across only two things that I'm on the fence about.
The first is with really long classes which I think is actually probably fine, I just wasn't expecting it, but the second is with code like this:
This is how I have laid the template out, which RubyMine and
erb_lintboth are happy with - but Herb wants to squash it:erb_lintdoes not care about this, but RubyMine then wants to indent everything:after which Herb, RubyMine, and
erb_lintall agree again.I'm not super worried about all three tools disagreeing because that's the point of picking a formatter, but personally for this kind of code I think I prefer having more lines and balanced on both sides to make it clear where the "block of Ruby" begins and ends
Ultimately I'm wondering if this is something you'd be open to support either configuring or doing something like what Prettier does w/ objects whereby if Herb saw the newline after the opening
<%, it'd keep it.