# regexp/sort-character-class-elements
enforces elements order in character class
- 🔧 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 checks elements of character classes are sorted.
# 🔧 Options
{
"regexp/sort-character-class-elements": ["error", {
"order": [
"\\s", // \s or \S
"\\w", // \w or \W
"\\d", // \d or \D
"\\p", // \p{...} or \P{...}
"*", // Others (A character or range of characters or an element you did not specify.)
]
}]
}
"order"
... An array of your preferred order. The default is["\\s", "\\w", "\\d", "\\p", "*",]
.
# 🚀 Version
This rule was introduced in eslint-plugin-regexp v0.12.0