Input:
<%= javascript_tag do %>
const a = 1
console.log(a)
<% end %>
Output:
<%= javascript_tag do %>
const a = 1 console.log(a)
<% end %>
Expected:
<%= javascript_tag do %>
const a = 1
console.log(a)
<% end %>
Playground:
https://herb-tools.dev/playground/#DwUgvABAVghgbjAzgYwE4EsAOAXA+tmAcwgBMB7CEAPgCgIJkyA7RbCGCSARgecTIA2AUwB0AsoQAUMAJQ1QEIUxKUqQA
Additional context:
The formatter collapses newlines inside a javascript_tag do block, merging separate JavaScript statements onto a single line. This changes the semantics of the JavaScript code and can cause syntax errors depending on the statements involved.
Input:
Output:
Expected:
Playground:
https://herb-tools.dev/playground/#DwUgvABAVghgbjAzgYwE4EsAOAXA+tmAcwgBMB7CEAPgCgIJkyA7RbCGCSARgecTIA2AUwB0AsoQAUMAJQ1QEIUxKUqQA
Additional context:
The formatter collapses newlines inside a
javascript_tag doblock, merging separate JavaScript statements onto a single line. This changes the semantics of the JavaScript code and can cause syntax errors depending on the statements involved.