diff --git a/lib/rules/no-invalid-regexp.js b/lib/rules/no-invalid-regexp.js index 48b7188d49f..6136ebb9e0b 100644 --- a/lib/rules/no-invalid-regexp.js +++ b/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; diff --git a/tests/lib/rules/no-invalid-regexp.js b/tests/lib/rules/no-invalid-regexp.js index ba1827a4fab..add1af81fa8 100644 --- a/tests/lib/rules/no-invalid-regexp.js +++ b/tests/lib/rules/no-invalid-regexp.js @@ -41,7 +41,13 @@ ruleTester.run("no-invalid-regexp", rule, { { code: "new RegExp('(?b)\\k')", parserOptions: { ecmaVersion: 2018 } }, { code: "new RegExp('(?b)\\k', '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: [ {