Add a --fix option for wrap-regex #7013
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
I'm using Node v6.4.0 and ESLint v3.4.0.
It would be useful to have an autofix option for the
wrap-regex
rule. The fixer would simply wrap all regular expression literals with parentheses, if they aren't parenthesized already.We would need to ensure that adding parentheses doesn't cause the regex to be interpreted as a function parameter (like with
no-unexpected-multiline
). However, I don't think this is an issue, because in scenarios like this, the regex is parsed as a division operator anyway:I would be willing to add this if the issue is accepted.
The text was updated successfully, but these errors were encountered: