Skip to content

Files

Latest commit

 

History

History
40 lines (26 loc) · 576 Bytes

Lint-RedundantRegexpQuantifiers.md

File metadata and controls

40 lines (26 loc) · 576 Bytes

Pattern: Redundant Regexp quantifier

Issue: -

Description

Checks for redundant quantifiers inside Regexp literals.

It is always allowed when interpolation is used in a regexp literal, because it's unknown what kind of string will be expanded as a result:

/(?:a*#{interpolation})?/x

Examples

# bad
/(?:x+)+/

# good
/(?:x)+/

# good
/(?:x+)/

# bad
/(?:x+)?/

# good
/(?:x)*/

# good
/(?:x*)/

Further Reading