Fix problems with prettier v3.6.0+#408
Conversation
|
Can I get opinions please @NullVoxPopuli @gitKrystan The failure is with // config > semi: false > it formats ../cases/gts/implied-export-default-satisfies.gts
import type { TemplateOnlyComponent } from "@ember/component/template-only"
;<template>
Implied Export Default with Satisfies
</template> satisfies TemplateOnlyComponent |
|
Is there a problem switching to |
|
Is it causing parse failure? |
|
There were quite a few problems with how tagged templates ended up formatting, breaking our expectations of how a template tag should be output. Some examples comparing the two approaches. We have about 80 test cases for these idiosyncrasies that fail when using the tagged template approach. My problem was I didn't fully understand what |
|
I think the comment was for keeping overall character length the same? |
|
@fisker I do have a question actually On versions 3.6.0, 3.6.1 and 3.6.2 our |
Yeah partly that, and partly because the formatting around an |
|
Ready for review. All work as expected. |
|
can we add all those minor versions to CI? @embroider/try should help out, like how we do with library testing |
|
|
||
| return ( | ||
| (commentStart === start && commentEnd === end) || | ||
| (commentStart === start + 1 && commentEnd === end - 1) || |
There was a problem hiding this comment.
what do 1 and 7 represent?
There was a problem hiding this comment.
The offsets from the original template don't always match the offsets of the AST comments due to the prefix and suffix.
start + 1 = {
start + 7 = static{
end - 1 = }
eg template start is 14 in a class component. AST sees /*the template */ so starts at 21. So bump the template start to 21 to account for static{ before the comment begins and we can match.
We should, better in a different PR though |
estree plugin use the same function for |
Supercedes #407
Closes #406