Skip to content

Commit 4d9d697

Browse files
committed
feature: @putout/plugin-regexp: apply-ends-with: exclude escape
1 parent 7d31b07 commit 4d9d697

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
if (/\d\/body$/.test(a))
2+
return true;

packages/plugin-regexp/lib/apply-ends-with/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ module.exports.match = () => ({
1515
if (!raw.endsWith('$'))
1616
return false;
1717

18+
if (raw.includes('\\d'))
19+
return false;
20+
1821
return !/[\^+({*\].]/.test(raw);
1922
},
2023
});

packages/plugin-regexp/lib/apply-ends-with/index.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ test('plugin-regexp/apply-ends-with: transform: slash', (t) => {
2323
t.transform('slash');
2424
t.end();
2525
});
26+
27+
test('plugin-regexp/apply-ends-with: no report: escape', (t) => {
28+
t.noReport('escape');
29+
t.end();
30+
});

0 commit comments

Comments
 (0)