pageClass | sidebarDepth | title | description | since |
---|---|---|---|---|
rule-details |
0 |
regexp/no-zero-quantifier |
disallow quantifiers with a maximum of zero |
v0.10.0 |
💼 This rule is enabled in the ✅ plugin:regexp/recommended
config.
💡 This rule is manually fixable by editor suggestions.
disallow quantifiers with a maximum of zero
This rule reports quantifiers with a maximum of zero. These quantifiers trivially do not affect the pattern is any way and can be removed.
/* eslint regexp/no-zero-quantifier: "error" */
/* ✓ GOOD */
var foo = /a?/;
var foo = /a{0,}/;
var foo = /a{0,1}/;
/* ✗ BAD */
var foo = /a{0}/;
var foo = /a{0,0}?/;
var foo = /(a){0}/;
Nothing.
This rule was introduced in eslint-plugin-regexp v0.10.0