Skip to content

plugin/single_quotes changes strings that have single-quotes inside #86

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

Closed
boris-petrov opened this issue May 17, 2022 · 3 comments · Fixed by #87
Closed

plugin/single_quotes changes strings that have single-quotes inside #86

boris-petrov opened this issue May 17, 2022 · 3 comments · Fixed by #87

Comments

@boris-petrov
Copy link
Contributor

Using @prettier/plugin-ruby 3.1.2 and syntax_tree 2.6.0. A string like x = "asd'qwe" is changed to x = 'asd\'qwe' which I believe is worse. Is it possible to somehow configure plugin/single_quotes? Or change the default so it doesn't do that? 😄

@kddnewton
Copy link
Member

Hmm I see what you mean. Feel like a contribution? You would need to change this line: https://github.com/ruby-syntax-tree/syntax_tree/blob/main/lib/syntax_tree/node.rb#L8406.

@nickhall
Copy link

For the record, I'm seeing the same behavior when double quotes are enclosed in single quotes, so something like x = 'a "string"' would become x = "a \"string\""

@boris-petrov
Copy link
Contributor Author

I think I've also fixed this case with the PR.

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 a pull request may close this issue.

3 participants