Skip to content

regexp/prefer-range

💼 This rule is enabled in the following configs: 🟢 flat/recommended, 🔵 recommended.

🔧 This rule is automatically fixable by the --fix CLI option.

enforce using character class range

📖 Rule Details

This rule is aimed to use ranges instead of multiple adjacent characters in character class.

🔧 Options

This option can be used to override the allowedCharacterRanges setting.

It allows all values that the allowedCharacterRanges setting allows.

"target": "alphanumeric"

"target": "all"

"target": [ "alphanumeric", "😀-😏" ]

🚀 Version

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

🔍 Implementation