Skip to content

Latest commit

 

History

History
51 lines (34 loc) · 1.24 KB

no-zero-quantifier.md

File metadata and controls

51 lines (34 loc) · 1.24 KB
pageClass sidebarDepth title description since
rule-details
0
regexp/no-zero-quantifier
disallow quantifiers with a maximum of zero
v0.10.0

regexp/no-zero-quantifier

💼 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

📖 Rule Details

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}/;

🔧 Options

Nothing.

🚀 Version

This rule was introduced in eslint-plugin-regexp v0.10.0

🔍 Implementation