# regexp/no-useless-character-class

disallow character class with one character

  • ⚙️ This rule is included in "plugin:regexp/recommended".
  • 🔧 The --fix option on the command line (opens new window) can automatically fix some of the problems reported by this rule.

# 📖 Rule Details

This rule reports character classes that defines only one character.

Character classes that define only one character have the same effect even if you remove the brackets.

Now loading...

# 🔧 Options

  "regexp/no-useless-character-class": ["error", {
    "ignores": ["="]
  • "ignores" ... An array of characters and character classes to ignores. Default ["="].

The default value is "=" to prevent conflicts with the no-div-regex (opens new window) rule. Note that if you do not specify "=", there may be conflicts with the no-div-regex (opens new window) rule.

# "ignores": ["a"]

Now loading...

# 🚀 Version

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

# 🔍 Implementation

Last Updated: 6/25/2022, 12:32:38 PM