Can't format vue expression with escaped html
Open
Nobody has claimed this yet.
lang:vue
- Dominant language
- JavaScript
- Stars
- 52.3k
- Forks
- 5k
- Avg merge
- 19h 2m
- Merged PRs (30d)
- 117
Description
Prettier pr-14506
Playground link
--parser vue
--trailing-comma es5
Input:
<template>
<span>
{{ a < b
? 1
: 2 }}
{{ a > b
? 1
: 2 }}
</span>
</template>
<script setup>
const a = 1, b = 2
</script>
Output:
<template>
<span>
{{ a < b
? 1
: 2 }}
{{ a > b
? 1
: 2 }}
</span>
</template>
<script setup>
const a = 1,
b = 2;
</script>
Expected behavior:
Should unescape before parse.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Vue reproduction and the linked Vue playground, then trace how the formatter parses escaped HTML entities inside template expressions. Confirm the behavior with the provided input and output; done means expressions containing < and > are parsed and formatted correctly without changing the surrounding Vue template.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100