Skip to content
Permalink
Browse files
Fix: use regexpp's default ecmaVersion in no-invalid-regexp (#13968)
  • Loading branch information
mdjermanovic committed Jan 1, 2021
1 parent 7297363 commit 83e98cd48ce3d1acf729f4fb9be40cff332abd6e
Showing with 8 additions and 2 deletions.
  1. +1 −1 lib/rules/no-invalid-regexp.js
  2. +7 −1 tests/lib/rules/no-invalid-regexp.js
@@ -9,7 +9,7 @@
//------------------------------------------------------------------------------

const RegExpValidator = require("regexpp").RegExpValidator;
const validator = new RegExpValidator({ ecmaVersion: 2018 });
const validator = new RegExpValidator();
const validFlags = /[gimuys]/gu;
const undefined1 = void 0;

@@ -41,7 +41,13 @@ ruleTester.run("no-invalid-regexp", rule, {
{ code: "new RegExp('(?<!a)b')", parserOptions: { ecmaVersion: 2018 } },
{ code: "new RegExp('(?<a>b)\\k<a>')", parserOptions: { ecmaVersion: 2018 } },
{ code: "new RegExp('(?<a>b)\\k<a>', 'u')", parserOptions: { ecmaVersion: 2018 } },
{ code: "new RegExp('\\\\p{Letter}', 'u')", parserOptions: { ecmaVersion: 2018 } }
{ code: "new RegExp('\\\\p{Letter}', 'u')", parserOptions: { ecmaVersion: 2018 } },

// ES2020
"new RegExp('(?<\\\\ud835\\\\udc9c>.)', 'g')",
"new RegExp('(?<\\\\u{1d49c}>.)', 'g')",
"new RegExp('(?<𝒜>.)', 'g');",
"new RegExp('\\\\p{Script=Nandinagari}', 'u');"
],
invalid: [
{

0 comments on commit 83e98cd

Please sign in to comment.