Skip to content

Files

Latest commit

 

History

History
26 lines (18 loc) · 706 Bytes

no-empty-character-class.md

File metadata and controls

26 lines (18 loc) · 706 Bytes

Pattern: Character class that match no characters

Issue: -

Description

This rule reports character classes that cannot match any characters.

Character classes that cannot match any characters are either empty or negated character classes of elements that contain all characters.

The reports for this rule include reports for the ESLint core no-empty-character-class rule. That is, if you use this rule, you can turn off the ESLint core no-empty-character-class rule.

Examples

/* eslint regexp/no-empty-character-class: "error" */
/* ✓ GOOD */
var foo = /abc[d]/;
var foo = /abc[a-z]/;
var foo = /[^]/;
var foo = /[\s\S]/;

/* ✗ BAD */
var foo = /abc[]/;
var foo = /[^\s\S]/;