-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLintruleRelates to ESLint's core rulesRelates to ESLint's core rules
Description
What rule do you want to change?
no-useless-escape
What change do you want to make?
Generate fewer warnings
How do you think the change should be implemented?
A new option
Example code
/[0\-]/
What does the rule currently do for this code?
It currently marks \-
as a useless escape
What will the rule do after it's changed?
It will not mark \-
as a useless escape in regex character sets
Participation
- I am willing to submit a pull request to implement this change.
Additional comments
/[0\-]/
while technically a useless escape, omitting the escape is a common source of errors when additional characters are added to the character set accidentally creating a character range. For example /[0-]/
extended into /[0-9]/
produces a very different outcome than adding a single character 9
to the character set.
Metadata
Metadata
Assignees
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLintruleRelates to ESLint's core rulesRelates to ESLint's core rules
Type
Projects
Status
Complete