Skip to content

bug/regression: false positive for jsx returning a string #18343

@skoch13

Description

@skoch13

Prettier 3.7.1
Playground link

--parser babel

Input:

function myComponent() {

  return /* HTML */ `
    <div class="${styles.banner}">
    </div>
  `;
}

Output:

function myComponent() {
  return /* HTML */ ` <div class=${styles.banner}></div> `;
}

Expected output:

function myComponent() {
  return /* HTML */ ` <div class="${styles.banner}"></div> `;
}

Why?
Prior to version 3.7.0, the quotes were not removed. Now, it is necessary to add <!-- prettier-ignore --> for such strings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:multiparserIssues with printing one language inside another, like CSS-in-JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions