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

Why add whitespace between % and # in comments?

Open evenreven opened this issue 3 years ago • 2 comments

This plugin adds whitespace between <% and # in comments, like this <% # Comment %>. In the old days, whitespace before the # was not only actively discouraged, but would potentially screw up HTML rendering. The most correct syntax was <%# Comment %>. This is also the syntax examples in the official Rails API to this day. I hadn't even seen the whitespace variant until today.

More subjective data point: I find the whitespace makes the file harder to parse with my eyes. I'm used to looking for the character following the %. Whitespace means ruby block, = means output/render, and # means comment. Having whitespace in comments too makes it harder to scan.

Is there a different reason for this standard I don't know about?

evenreven avatar May 17 '21 21:05 evenreven

hey @evenreven that's a bug, thanks for reporting it.

adamzapasnik avatar May 17 '21 21:05 adamzapasnik

should be fixed in a newly released v0.2.0

adamzapasnik avatar May 25 '21 05:05 adamzapasnik