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

Revert "Print \x and \u escapes in strings and regexes lowercase (#522)" #574

Merged
merged 1 commit into from
Feb 2, 2017

Conversation

lydell
Copy link
Member

@lydell lydell commented Feb 2, 2017

This reverts commit 7148184.

There are four types of literals where escapes were normalized:

  1. Strings ('\xAb' and "\xAb")
  2. Regexes (/\xAb/)
  3. Untagged template literals (`\xAb`)
  4. Tagged template literals (tag`\xAb`)

However, changing the case of the escapes alters the runtime behavior of
in two of the above cases.

/\xAb/.source === '\\xAb' // true
String.raw`\xAb` === '\\xAb' // true

So for regexes and tagged template literals the escapes must not be
changed. Instead of enforcing lowercase escapes in only 50% of the
different cases, it was decided not to bother with escapes at all.

Closes #562.

…ttier#522)"

This reverts commit 7148184.

There are four types of literals where escapes were normalized:

1. Strings ('\xAb' and "\xAb")
2. Regexes (/\xAb/)
3. Untagged template literals (`\xAb`)
4. Tagged template literals (tag`\xAb`)

However, changing the case of the escapes alters the runtime behavior of
in two of the above cases.

```js
/\xAb/.source === '\\xAb' // true
String.raw`\xAb` === '\\xAb' // true
```

So for regexes and tagged template literals the escapes must not be
changed. Instead of enforcing lowercase escapes in only 50% of the
different cases, it was decided not to bother with escapes at all.

Closes prettier#562.
@vjeux vjeux merged commit 69b7bd3 into prettier:master Feb 2, 2017
@lydell lydell deleted the revert-escape-normalization branch February 2, 2017 17:58
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 19, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants