Skip to content

Commit

Permalink
Ignore String contains ${
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed May 8, 2024
1 parent 0e2a952 commit 5523316
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions rules/prefer-string-raw.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const create = context => {
if (
!raw.includes(BACKSLASH + BACKSLASH)
|| raw.includes('`')
|| raw.includes('${')
|| node.loc.start.line !== node.loc.end.line
) {
return;
Expand Down
2 changes: 2 additions & 0 deletions test/prefer-string-raw.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ test.snapshot({
b"
`,
String.raw`a = 'a\\b\u{51}c'`,
'a = "a\\\\b`"',
'a = "a\\\\b${foo}"',
{
code: String.raw`<Component attribute="a\\b" />`,
languageOptions: {
Expand Down

0 comments on commit 5523316

Please sign in to comment.