Skip to content

Commit

Permalink
Fix: use regexpp's default ecmaVersion in no-invalid-regexp (#13968)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic committed Jan 1, 2021
1 parent 7297363 commit 83e98cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rules/no-invalid-regexp.js
Expand Up @@ -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;

Expand Down
8 changes: 7 additions & 1 deletion tests/lib/rules/no-invalid-regexp.js
Expand Up @@ -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: [
{
Expand Down

0 comments on commit 83e98cd

Please sign in to comment.