# regexp/unicode-escape
enforce consistent usage of unicode escape or unicode codepoint escape
- 🔧 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 aims to enforce the consistent use of unicode escapes or unicode code point escapes.
This rule does not check for characters that require surrogate pairs (e.g. \ud83d\ude00
, \u{1f600}
) and patterns that do not have the u
flag.
If you want to enforce a character that requires a surrogate pair to unicode code point escape, use the regexp/prefer-unicode-codepoint-escapes rule.
# 🔧 Options
{
"regexp/unicode-escape": [
"error",
"unicodeCodePointEscape" // or "unicodeEscape"
]
}
"unicodeCodePointEscape"
... Unicode escape characters must always use unicode code point escapes. This is default."unicodeEscape"
... Unicode code point escape characters must always use unicode escapes.
# "unicodeEscape"
# 👫 Related rules
- regexp/hexadecimal-escape
- regexp/prefer-unicode-codepoint-escapes
- require-unicode-regexp (opens new window)
# 🚀 Version
This rule was introduced in eslint-plugin-regexp v0.9.0