Skip to content

regexp: UnicodeEscape Character inside StringLiteral is not correctly detected #13660

@Sysix

Description

@Sysix

When working on eslint/no-misleading-character-class I found a bug for CharacterKind when using StringLiteral (e. new RegExp("abc", "i");).

Example Code

/[A\u0301]/

Returns Characters inside the CharacterClass like:

[
  Character { span: Span { start: 2, end: 3 }, value: 65,  kind: Symbol },
  Character { span: Span { start: 3, end: 9 }, value: 769, kind: UnicodeEscape }
]
RegExp("[A\u0301]")

Returns Characters inside the CharacterClass like:

[
  Character { span: Span { start: 9, end: 10 },  value: 65,  kind: Symbol },
  Character { span: Span { start: 10, end: 16 }, value: 769, kind: Symbol }
]

Expected

I expect that the last character is always UnicodeEscape

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions