Skip to content

Conversation

@thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Jun 14, 2024

In #286 we fixed a situation in which escapes were being stripped from strings. This is because StringLiteral nodes in an expression have both escaped and unescaped values.

However, it seems that some StringLiteral nodes do not do this even though they are otherwise identical. Any StringLiteral that is the direct value of a JSX attribute does not perform any escaping.

For example, given these two JSX nodes, you will get the following as the AST:

// The first one
;<div class={"before:content-['\\\\2248']"} />

// The second one
;<div class="before:content-['\\\\2248']" />

image

So we have to detect whether or not escaping was applied originally before doing that ourselves.

tl;dr software is hard 😅

Fixes #294

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Formating adds escape backslashes again and again with each run in 0.6.5

3 participants