The current implementation of the LWC parser uses the raw interpolated attributes as is, without modification. It would be preferred to run textToDoc on them to also apply formatting to those values (i.e. change " to ')
Prettier pr-5800
Playground link
--parser lwc
--single-quote
Input:
<div data-for={foo["baz"]}></div>
Output:
SyntaxError: Unexpected closing tag "div". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (1:28)
> 1 | <div data-for={foo["baz"]}></div>
| ^
Expected behavior:
The output should format the interpolated value using prettier as well. It should look like:
<div data-for={foo['baz']}></div>
See conversation: #5800 (comment)
This issue requires the HTML parser to support quotes in interpolated attributes: #5815
The current implementation of the LWC parser uses the raw interpolated attributes as is, without modification. It would be preferred to run
textToDocon them to also apply formatting to those values (i.e. change"to')Prettier pr-5800
Playground link
Input:
Output:
Expected behavior:
The output should format the interpolated value using prettier as well. It should look like:
See conversation: #5800 (comment)
This issue requires the HTML parser to support quotes in interpolated attributes: #5815