Skip to content

Commit 1dca2f3

Browse files
Tim Allenfisker
andauthored
prefer-starts-ends-with: Fix pipe in regex (#783)
Co-authored-by: fisker Cheung <[email protected]>
1 parent 4594085 commit 1dca2f3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

rules/prefer-starts-ends-with.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const doesNotContain = (string, characters) => characters.every(character => !st
1111

1212
const isSimpleString = string => doesNotContain(
1313
string,
14-
['^', '$', '+', '[', '{', '(', '\\', '.', '?', '*']
14+
['^', '$', '+', '[', '{', '(', '\\', '.', '?', '*', '|']
1515
);
1616

1717
const regexTestSelector = [

test/prefer-starts-ends-with.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ const validRegex = [
2626
/\^foo/,
2727
/^foo/i,
2828
/^foo/m,
29-
/^foo/im
29+
/^foo/im,
30+
/^A|B/,
31+
/A|B$/
3032
];
3133

3234
const invalidRegex = [

0 commit comments

Comments
 (0)