Open fiddlerwoaroof opened 4 months ago
Actually, I just realized this is a macro issue: the LET
binding isn't active while the with-html macro is being expanded. So, as implemented, *always-quote*
, has to be set with SETF
before any invocation of with-html
I looked into reporting this as a bug on Prettier, but it's been a known bug since 2020: https://github.com/angular/angular/issues/36932.
In principle I'd be willing to change the handling of attribute values for better parser compatibility, but I'm hesitant to do it for just one parser.
I wonder if there's a way to make always-quote work with a LET binding. I didn't quite follow the macroexpansion, but it's a bit surprising to me that this variable affects macroexpansion rather than being used by the generated code: is there a performance concern?
As far as prettier goes: I understand not wanting to adjust the behavior for a single parse but prettier is the de facto standard tool for reformatting HTML and other languages found in frontend codebases. If there's a single tool to target, I think prettier would be it.
I've change the default behavior to always quote attributes with slashes. I'm leaving this issue open for the moment to think about how and if always-quote should have a run-time effect.
*always-quote*
is ignored for some sorts of tags. This causes issues with other tools (such as prettier) that don't like attribute values with slashes.