prettier-plugin-erb icon indicating copy to clipboard operation
prettier-plugin-erb copied to clipboard

Invalid erb output for long blocks

Open Pezmc opened this issue 3 years ago • 2 comments

Prettier-plugin-erb currently sometimes split the do from a block onto a new line, causing a syntax error:

ActionView::SyntaxErrorInTemplate - Encountered a syntax error while rendering template

Example input:

<%= link_to signout_path, class: "very-long-class-name-here-to-cause-line-break" do %>
  Welcome
<% end %>

Output:

<%= link_to signout_path, class: "very-long-class-name-here-to-cause-line-break"
do %> Welcome <% end %>

Full error:

ActionView::SyntaxErrorInTemplate - Encountered a syntax error while rendering template: check <%= link_to signout_path, class: "very-long-class-name-here-to-cause-line-break"
do %> Welcome <% end %>:
  app/views/layouts/application.html.erb:70

Pezmc avatar May 12 '21 11:05 Pezmc

Hey @Pezmc thanks for submitting the issue, it will be fixed in the next release.

adamzapasnik avatar May 16 '21 19:05 adamzapasnik

should be fixed in a newly released v0.2.0

adamzapasnik avatar May 25 '21 05:05 adamzapasnik