prettier icon indicating copy to clipboard operation
prettier copied to clipboard

Preserve spaces around placeholders for template literals

Open kovsu opened this issue 2 weeks ago • 3 comments

Description

fix: #11400

Checklist

  • [x] I’ve added tests to confirm my change works.
  • [x] (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • [ ] (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • [x] I’ve read the contributing guidelines.

kovsu avatar Dec 10 '25 09:12 kovsu

Deploy Preview for prettier ready!

Built without sensitive environment variables

Name Link
Latest commit 9a41a6ce36feb1ba682d508fb4ec318296dad4ae
Latest deploy log https://app.netlify.com/projects/prettier/deploys/69393af7440f8e000841d351
Deploy Preview https://deploy-preview-18460--prettier.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Dec 10 '25 09:12 netlify[bot]

Open in StackBlitz

yarn add https://pkg.pr.new/@prettier/[email protected]
yarn add https://pkg.pr.new/@prettier/[email protected]
yarn add https://pkg.pr.new/[email protected]

commit: 73fe22c

pkg-pr-new[bot] avatar Dec 10 '25 09:12 pkg-pr-new[bot]

Deploy Preview for prettier ready!

Name Link
Latest commit 4fe3891df4ee277c2cd12ebb35f2f378ccf9f2b0
Latest deploy log https://app.netlify.com/projects/prettier/deploys/6940b664fdbe690008113e3f
Deploy Preview https://deploy-preview-18460--prettier.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Dec 10 '25 09:12 netlify[bot]

We can ignore such case, there are limitations for substitution.

Maybe https://github.com/prettier/prettier/pull/6794 can fix it.

fisker avatar Dec 11 '25 03:12 fisker

I've fixed it, but can't push due to network issues. 😭

kovsu avatar Dec 11 '25 03:12 kovsu

Still broken, but I'm going to pretend that I don't know

Prettier pr-18460 Playground link

--parser babel

Input:

css`foo :${bar} {}`

Output:

css`
  foo:${bar} {
  }
`;

fisker avatar Dec 16 '25 01:12 fisker

Still broken, but I'm going to pretend that I don't know

I can check it later

kovsu avatar Dec 16 '25 01:12 kovsu

Nah, not worth the effort. Let's wait for someone actually write it this way.

fisker avatar Dec 16 '25 01:12 fisker