@@ -5,7 +5,9 @@ use oxc_diagnostics::OxcDiagnostic;
55use oxc_macros:: declare_oxc_lint;
66use oxc_span:: Span ;
77
8- use crate :: { AstNode , context:: LintContext , rule:: Rule } ;
8+ use crate :: {
9+ AstNode , context:: LintContext , rule:: Rule , utils:: is_string_raw_tagged_template_expression,
10+ } ;
911
1012fn escape_case_diagnostic ( span : Span ) -> OxcDiagnostic {
1113 OxcDiagnostic :: warn ( "Use uppercase characters for the value of the escape sequence." )
@@ -133,7 +135,11 @@ impl Rule for EscapeCase {
133135 } ) ;
134136 }
135137 }
136- AstKind :: TemplateLiteral ( lit) => {
138+ AstKind :: TemplateLiteral ( lit)
139+ if !is_string_raw_tagged_template_expression (
140+ & ctx. nodes ( ) . parent_kind ( lit. node_id ( ) ) ,
141+ ) =>
142+ {
137143 lit. quasis . iter ( ) . for_each ( |quasi| {
138144 let text = quasi. span . source_text ( ctx. source_text ( ) ) ;
139145 if let Some ( fixed) = check_case ( text, false ) {
@@ -189,6 +195,7 @@ fn test() {
189195 r"const foo = `foo\\\\xbar`;" ,
190196 r"const foo = `foo\\\\ubarbaz`;" ,
191197 r"const foo = `\ca`;" ,
198+ r"const foo = String.raw`\uAaAa`;" ,
192199 r"const foo = /foo\xA9/" ,
193200 r"const foo = /foo\uD834/" ,
194201 r"const foo = /foo\u{1D306}/u" ,
0 commit comments