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 f8ba679 commit 94e5d90
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}"',

Check failure on line 21 in test/prefer-string-raw.mjs

View workflow job for this annotation

GitHub Actions / lint-test (ubuntu-latest)

Unexpected template string expression.
{
code: String.raw`<Component attribute="a\\b" />`,
languageOptions: {
Expand Down

0 comments on commit 94e5d90

Please sign in to comment.