Skip to content
Permalink
Browse files
Update: use regexpp's default ecmaVersion in no-control-regex (#13969)
  • Loading branch information
mdjermanovic committed Jan 1, 2021
1 parent 83e98cd commit 535fe47fee6544b4957378f9408117c8318d4762
Showing with 5 additions and 1 deletion.
  1. +0 −1 lib/rules/no-control-regex.js
  2. +5 −0 tests/lib/rules/no-control-regex.js
@@ -8,7 +8,6 @@
const RegExpValidator = require("regexpp").RegExpValidator;
const collector = new (class {
constructor() {
this.ecmaVersion = 2018;
this._source = "";
this._controlChars = [];
this._validator = new RegExpValidator(this);
@@ -41,6 +41,11 @@ ruleTester.run("no-control-regex", rule, {
code: "var regex = /(?<a>\\x1f)/",
parserOptions: { ecmaVersion: 2018 },
errors: [{ messageId: "unexpected", data: { controlChars: "\\x1f" }, type: "Literal" }]
},
{
code: String.raw`var regex = /(?<\u{1d49c}>.)\x1f/`,
parserOptions: { ecmaVersion: 2020 },
errors: [{ messageId: "unexpected", data: { controlChars: "\\x1f" }, type: "Literal" }]
}
]
});

0 comments on commit 535fe47

Please sign in to comment.