Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update: use regexpp's default ecmaVersion in no-control-regex (#13969)
  • Loading branch information
mdjermanovic committed Jan 1, 2021
1 parent 83e98cd commit 535fe47
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/rules/no-control-regex.js
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions tests/lib/rules/no-control-regex.js
Expand Up @@ -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.