Skip to content

Commit b8f84d1

Browse files
committed
feature: @putout/plugin-remove-useless-escape: template: \$( -> $(
1 parent de07c4a commit b8f84d1

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

packages/plugin-remove-useless-escape/lib/remove-useless-escape.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ export const traverse = ({push}) => ({
2929
for (const tmpl of path.node.quasis) {
3030
const {raw} = tmpl.value;
3131

32-
if (raw.includes('$'))
32+
if (raw.includes('${'))
3333
return;
3434

35+
if (raw.includes('{('))
36+
return push(path);
37+
3538
if (isEscaped(raw))
3639
return push(path);
3740

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
const a = '${';
22
const b = '{';
3+
const c = `grep -qF -- "$(${nodeEncode})" ../README.md`;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
const a = '\$\{';
22
const b = '\{';
3+
const c = `grep -qF -- "\$(${nodeEncode})" ../README.md`;

0 commit comments

Comments
 (0)