# regexp/no-obscure-range

disallow obscure character ranges

  • ⚙️ This rule is included in "plugin:regexp/recommended".

# 📖 Rule Details

The character range operator (the - inside character classes) can easily be misused (mostly unintentionally) to construct non-obvious character class. This rule will disallow all non-obvious uses of the character range operator.

Now loading...

# 🔧 Options

{
  "regexp/no-obscure-range": ["error",
    {
      "allowed": "alphanumeric" // or "all" or [...]
    }
  ]
}

This option can be used to override the allowedCharacterRanges setting.

It allows all values that the allowedCharacterRanges setting allows.

# "allowed": "alphanumeric"

Now loading...

# "allowed": "all"

Now loading...

# "allowed": [ "alphanumeric", "😀-😏" ]

Now loading...

# 🚀 Version

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

# 🔍 Implementation