regexp/no-obscure-range
💼 This rule is enabled in the following configs: 🟢 flat/recommended
, 🔵 recommended
.
disallow obscure character ranges
📖 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.
🔧 Options
json5
{
"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"
"allowed": "all"
"allowed": [ "alphanumeric", "😀-😏" ]
🚀 Version
This rule was introduced in eslint-plugin-regexp v0.9.0