RunDevelopment/eslint-plugin-clean-regex

Prefer character classes instead of groups if possible

RunDevelopment opened this issue · 0 comments

Example:

/(?:a|b|c)/ => /[abc]/
/(?:\w|-|\+|\*|\/)+/ => /[\w+*/-]+/
/(a|b|c)/ => /([abc])/
/(?:[ab]|c)/ => /[abc]/
/(?:a|b)/ // stay like this

Note:
This rules should only affect groups with a) >= 3 alternatives or b) at least one character class.