prettier icon indicating copy to clipboard operation
prettier copied to clipboard

Improve string print perfomance

Open fisker opened this issue 1 year ago • 0 comments

Description

We already stop unescaping characters in #16563.

It makes sense to skip makeString() when the original quote matches the desired quote.

However, this will make the following code

const foo = "\"\'"

untouched when using --no-single-quote, but unescape " when using --single-quote.

I think it's acceptable. What do you think? @sosukesuzuki @kachkaev

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.

Try the playground for this PR

fisker avatar Oct 18 '24 10:10 fisker