Skip to content

regexp/no-empty-string-literal

💼 This rule is enabled in the following configs: 🟢 flat/recommended, 🔵 recommended.

disallow empty string literals in character classes

📖 Rule Details

This rule reports empty string literals in character classes.

If the empty string literal is supposed to match the empty string, then use a quantifier instead. For example, [ab\q{}] should be written as [ab]?.

This rule does not report empty alternatives in string literals. (e.g. /[\q{a|}]/v)
If you want to report empty alternatives in string literals, use the regexp/no-empty-alternative rule.

Now loading...

🔧 Options

Nothing.

🚀 Version

This rule was introduced in eslint-plugin-regexp v2.0.0-next.11

🔍 Implementation