no-empty-character-class
Configuration
rslint.config.ts
Rule Details
Disallows empty character classes [] in regular expression literals. An empty character class in a regular expression does not match anything and is almost certainly a mistake. Note that [^] (a negated empty class) is allowed since it matches any character.
With the ES2024 v flag (unicodeSets), character classes can be nested. This rule also detects empty classes inside nested structures such as set subtraction (--) and intersection (&&).
This rule does not check new RegExp() constructor calls — only regex literals.
Examples of incorrect code for this rule:
Examples of correct code for this rule: