Open hmajoros opened 4 years ago
👍
The codemod also fails if the <
is in a comment:
ex.
/**
I'm not sure where the best place to fix this is, but I recreated in https://github.com/ember-template-lint/ember-template-recast/pull/208. I created an issue upstream with more detail: https://github.com/ember-template-lint/ember-template-recast/issues/207
This codemod should not be running on JavaScript files at all...
@rwjblue fwiw, it would be really nice to be able to run these on rendering tests instead of needing to migrate those manually to angle-brackets syntax.
The codemod actually works almost unexpectedly well in JS files containing templates, but with a few snags
If we do want to support running on JS (which seems like a win for rendering tests), we probably need to just make this very slightly smarter and have it check on the context to guarantee that the string being parsed is one that's being passed as an arg to the hbs
"function".
I've been running the codemod on all of my project's rendering tests, ala anything that has
We've actually had pretty good success for the most part, but I have noticed a fun / interesting bug: If you test JS file contains the character
<
inside a string, or inside a comment block, the codemod seemingly attempts to parse this as HTML & blows up. A few examples we had were things like:Our workaround has been to just delete the characters
<
and>
from any string / comment, run codemod, then add the characters back. Would be great is the codemod could be configured to only run on the actualhbs
blocks inside the test instead of the entire file.