oxc-project/oxc · error · OxcDiagnostic
Unexpected regional indicator in character class.
Error message
Unexpected regional indicator in character class.
What it means
Lint diagnostic from eslint/no-misleading-character-class (regional_indicator_symbol_sequences): a character class contains regional indicator symbols (flag emoji halves). In a class each indicator is matched independently, which splits flag pairs into meaningless single units.
Source
Thrown at crates/oxc_linter/src/rules/eslint/no_misleading_character_class.rs:54
OxcDiagnostic::warn("Unexpected surrogate pair in character class.")
.with_help("Add the Unicode flag 'u'.")
.with_label(span)
}
fn combining_class_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Unexpected combining class in character class.")
.with_help("Replace the character with its normalized form (NFC) or use Unicode code point escapes instead of combining sequences.")
.with_label(span)
}
fn emoji_modifiers_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Unexpected emoji modifier in character class.")
.with_help("Use Unicode code point escapes (e.g., \\u{1F3FB} for the light skin tone modifier) instead of emoji modifier sequences in character classes.")
.with_label(span)
}
fn regional_indicator_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Unexpected regional indicator in character class.")
.with_help("Use Unicode code point escapes (e.g., \\u{1F1EF} for the regional indicator symbol for 'J') instead of regional indicator symbol pairs in character classes.")
.with_label(span)
}
fn zwj_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Unexpected joined character sequence in character class.")
.with_help("Use Unicode code point escapes (e.g., \\u{1F468}\\u200D\\u{1F469} for '👨👩') instead of zero-width joiner sequences in character classes.")
.with_label(span)
}
#[derive(Debug, Default, Clone, JsonSchema, Deserialize)]
#[serde(rename_all = "camelCase", default, deny_unknown_fields)]
pub struct NoMisleadingCharacterClass {
/// When set to `true`, the rule allows any grouping of code points
/// inside a character class as long as they are written using escape sequences.
///
/// Examples of **incorrect** code for this rule with `{ "allowEscape": true }`:
/// ```javascriptView on GitHub (pinned to e1e7af627c)
Solutions
- Use Unicode code point escapes for the regional indicators
- Add the u flag and match full flag sequences outside the character class
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/rules/eslint/no_misleading_character_class.rs:54 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/aa926403c273cc28.
Report an issue: GitHub.