Skip to content

Commit

Permalink
Fix regex in tagged-is.js to handle escaped characters properly
Browse files Browse the repository at this point in the history
  • Loading branch information
graphemecluster committed Jan 15, 2025
1 parent 0e26ba5 commit 4c0d03a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rules/tagged-is.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default {
}
if (arg.type === 'Literal' && typeof arg.value === 'string') {
return fixer.replaceText(node, `is\`${
arg.raw.slice(1, -1).replace(/\\('|")|`|\$\{/g, (match, escaped) => escaped || `\\${match}`)
arg.raw.slice(1, -1).replace(/\\(('|")|.)|`|\$\{/g, (match, escaped, quote) => quote || `\\${escaped || match}`)
}\``);
}
return null;
Expand Down

0 comments on commit 4c0d03a

Please sign in to comment.