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

🐛 Bug: Escape handling is not correct #95

Open
3 tasks done
tvogel opened this issue Oct 18, 2024 · 3 comments
Open
3 tasks done

🐛 Bug: Escape handling is not correct #95

tvogel opened this issue Oct 18, 2024 · 3 comments
Labels
status: accepting prs Please, send a pull request to resolve this! type: bug Something isn't working :(

Comments

@tvogel
Copy link

tvogel commented Oct 18, 2024

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Expected

This should twice show the same string:

import dedent from "dedent"

console.log(dedent`
  This is broken:
  \\\$`);

console.log(`This is correct:
\\\$`);

Actual

It shows:

This is broken:
\\$
This is correct:
\$

Additional Info

See also: https://playcode.io/2050574

@tvogel tvogel added the type: bug Something isn't working :( label Oct 18, 2024
@JoshuaKGoldberg
Copy link
Collaborator

Fun. This is the case in all dedent string versions I've tried, including the latest (1.5.3), 1.0.0, 0.6.0, and 0.1.0.

Digging into how the the tagged templates work internally:

const tagger = (strings) => strings;

console.log(tagger`From tagger:
\\\$`);
[ 'From tagger:\n\\$' ]

Seems like a bug in escapeSpecialCharacters. cc @G-Rath, what do you think?

@JoshuaKGoldberg JoshuaKGoldberg added the status: in discussion Not yet ready for implementation or a pull request label Dec 1, 2024
@G-Rath
Copy link
Contributor

G-Rath commented Dec 1, 2024

isn't this what #69 is about? dedent is escaping the $ automatically even though it doesn't need to

@JoshuaKGoldberg
Copy link
Collaborator

👍 Fair. Since this issue has the cleaner repro, I'll mark that one as a duplicate of this. Thanks!

@JoshuaKGoldberg JoshuaKGoldberg added status: accepting prs Please, send a pull request to resolve this! and removed status: in discussion Not yet ready for implementation or a pull request labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Please, send a pull request to resolve this! type: bug Something isn't working :(
Projects
None yet
Development

No branches or pull requests

3 participants