Skip to content

Formatter: Punctuation after ERB #931

Description

@adrianthedev

Input:

<div class="py-6 min-h-24">
  <div class="px-6 space-y-4">
    <h3>What a nice new tool 👋</h3>

    Go to <%= link_to "new comment", avo.new_resources_comment_path %>, <%= link_to 'the first user', avo.resources_user_path(1) %>, or <%= link_to 'hey on main app', main_app.hey_path %>.

    <p>
      You can edit this file here <code class="p-1 rounded-sm bg-gray-500 text-white text-sm">app/views/avo/tools/custom_tool.html.erb</code>.
    </p>
  </div>
</div>

Output:

<h3>What a nice new tool 👋</h3>
Go to
<%= link_to "new comment", avo.new_resources_comment_path %>
,
<%= link_to 'the first user', avo.resources_user_path(1) %>
, or
<%= link_to 'hey on main app', main_app.hey_path %>
.

Expected:

<h3>What a nice new tool 👋</h3>
Go to
<%= link_to "new comment", avo.new_resources_comment_path %>,
<%= link_to 'the first user', avo.resources_user_path(1) %>, or
<%= link_to 'hey on main app', main_app.hey_path %>.
# .herb.yml
linter:
  enabled: true

formatter:
  enabled: true
  maxLineLength: 120
  indentWidth: 2

  rewriter:
    pre:
      - tailwind-class-sorter

Playground:

https://herb-tools.dev/playground?tab=format#DwEwlgbgBAxgNgQwM5ILwCIAOBPAtANigFswA7XAC1wCYAWdAPgCgopRJZEUNMAPAqEkwIYAU1x56zVq2AUAzAwDqFBABcoCKKTBjtogO5Q1AexNwogXg3A0jvAA9AuYsZAcRPH3wAKSoocMgDWAPqmUOikhrAmRESipGroADSaECYAdBEGQQBOokgmAK7ZYkhBMNGx8UHCahRQXgzJ3r7+pMGhAOS1olAAZmDZSBoFSKLZHckIqWm5+UUlQSNj1eoUABQAjACU9Y1QJtlsPn6BIe4dFKLY+6TECGSamJgTd2RBCE9pl9grtbtpTGcskw0hkrAAmoVYAhbqJwBpamAkH0wHAepdcmxyiAevBkGgsLgNlBsoVSDiQLgkEQoAAjADmuHp2QQeAArAAGDnGUS8NS4AwUMBqHoivlUoiMD6YOwQMCGJB2KYmOymcyKmAjUxEM7mL5qIhwNJjWn2bGiBgAsH2EHOezgCDMe2QBhAA

Additional context:

I love the fact that we have a formatter and everything, but I find the way that it formats the commas and other punctuation on a new line a bit unpleasant to look at and difficult to parse by a human.

Am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions