Rule Change: improve no-misleading-character-class so that it reports on the sub-node range rather than the entire node #16682
Labels
accepted
There is consensus among the team that this change meets the criteria for inclusion
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-misleading-character-class
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?
The rule currently errors on the entire RegExp literal.
eslint playground example
What will the rule do after it's changed?
The rule will report on the sub-node range that violates the rule instead of the entire literal node. For long regexes it can be pretty-well impossible to understand what the actual problem is if the rule reports on the entire node.
Example with reporting on the relevant violating sub-node ranges:
This will result in more lint rule reports because it will report more than once per node.
But I think the increased understandability of the reports is worth it.
Participation
Additional comments
No response
The text was updated successfully, but these errors were encountered: