Rule Change: no-control-regex
should check Unicode code point escapes
#15809
Labels
accepted
There is consensus among the team that this change meets the criteria for inclusion
archived due to age
This issue has been archived; please open a new issue for any further discussion
enhancement
This change enhances an existing feature of ESLint
rule
Relates to ESLint's core rules
Projects
What rule do you want to change?
no-control-regex
What change to do you want to make?
Generate more warnings
How do you think the change should be implemented?
A new default behavior
Example code
What does the rule currently do for this code?
Reports only
/\u001F/
.What will the rule do after it's changed?
Report both
/\u001F/
and/\u{1F}/u
.Participation
Additional comments
I think not reporting
/\u{1F}/u
is actually a bug caused by forgetting to pass theu
flag toregexpp
, so\u{1F}
is not parsed as an escape sequence. The bug is observable in (rare) patterns that are valid with theu
flag but invalid without it. For example, the rule fails to report\x1F
in/\u{1111}*\x1F/u
becauseregexpp
stops parsing the pattern after\u{1111}*
since it is invalid without theu
flag.Here's a demo with examples: Online Demo
The text was updated successfully, but these errors were encountered: