Skip to content

Removes newline character in .includes() inside classNames #426

Description

@danteissaias

What version of prettier-plugin-tailwindcss are you using?

0.6.9

What version of Tailwind CSS are you using?

3.4.1

What version of Node.js are you using?

22.21.1

What package manager are you using?

pnpm

What operating system are you using?

macOS

Reproduction URL

https://github.com/danteissaias/prettier-plugin-tailwindcss-bug-repro

Describe your issue

Given the following code:

className={classNames(
  "bg-red-500",
  value.includes("\n") ? "pt-2" : "pt-1"
)}

The classes are already properly sorted. However, when formatting with prettier-plugin-tailwindcss, the \n character inside .includes() is removed. This results in the following code:

className={classNames(
  "bg-red-500",
  value.includes(" ") ? "pt-2" : "pt-1"
)}

Expected behavior: Prettier should not remove the newline character.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions