From 83bbabc11afe8cbb2481c9819921788f5f28ba2a Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Thu, 7 May 2020 15:55:41 +0800 Subject: [PATCH] `prefer-starts-ends-with`: Fix bug with `m` flag (#721) --- rules/prefer-starts-ends-with.js | 2 +- test/prefer-starts-ends-with.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rules/prefer-starts-ends-with.js b/rules/prefer-starts-ends-with.js index e8ae415d54..209ba42a5e 100644 --- a/rules/prefer-starts-ends-with.js +++ b/rules/prefer-starts-ends-with.js @@ -25,7 +25,7 @@ const stringMatchSelector = [ ].join(''); const checkRegex = ({pattern, flags}) => { - if (flags.includes('i')) { + if (flags.includes('i') || flags.includes('m')) { return; } diff --git a/test/prefer-starts-ends-with.js b/test/prefer-starts-ends-with.js index 774afe1df7..5b28a1c7c3 100644 --- a/test/prefer-starts-ends-with.js +++ b/test/prefer-starts-ends-with.js @@ -24,7 +24,9 @@ const validRegex = [ /^foo./, /foo.$/, /\^foo/, - /^foo/i + /^foo/i, + /^foo/m, + /^foo/im ]; const invalidRegex = [