Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Vue] Incorrect syntax error for tag-like string in template literals #16303

Open
immccn123 opened this issue May 20, 2024 · 0 comments
Open
Labels
lang:vue Issues affecting Vue type:bug Issues identifying ugly output, or a defect in the program

Comments

@immccn123
Copy link

Prettier 3.2.5
Playground link

Input:

<template>
  {{ "<this_is_a_tag_like string>" }}
</template>

Output:

SyntaxError: Unexpected closing tag "template". 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 (3:1)
  1 | <template>
  2 |   {{ "<this_is_a_tag_like string>" }}
> 3 | </template>
    | ^^^^^^^^^^^
  4 |

Expected output:

<template>
  {{ "<this_is_a_tag_like string>" }}
</template>

In this example, Prettier incorrectly interprets the string <this_is_a_tag_like string> as an HTML tag. This should be treated as a regular string within the template context. It should be a valid vue syntax.

I would appreciate it if this issue could be fixed in a future update.

@kachkaev kachkaev added type:bug Issues identifying ugly output, or a defect in the program lang:vue Issues affecting Vue labels May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang:vue Issues affecting Vue type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

2 participants