File tree 1 file changed +10
-1
lines changed
crates/oxc_linter/src/rules/unicorn
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,14 @@ declare_oxc_lint!(
50
50
) ;
51
51
52
52
fn is_hex ( iter : & Chars , count : usize ) -> bool {
53
- iter. clone ( ) . take ( count) . all ( |c| c. is_ascii_hexdigit ( ) )
53
+ let mut iter = iter. clone ( ) ;
54
+ for _ in 0 ..count {
55
+ match iter. next ( ) {
56
+ Some ( c) if c. is_ascii_hexdigit ( ) => continue ,
57
+ _ => return false ,
58
+ }
59
+ }
60
+ true
54
61
}
55
62
56
63
// /(?<=(?:^|[^\\])(?:\\\\)*\\)(?<data>x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|u{[\dA-Fa-f]+})/g
@@ -196,6 +203,8 @@ fn test() {
196
203
r#"const foo = new RegExp("/\u{1D306}/", "u")"# ,
197
204
r#"const foo = new RegExp("/\ca/")"# ,
198
205
r#"const foo = new RegExp("/\cA/")"# ,
206
+ // Issue: <https://github.com/oxc-project/oxc/issues/9583>
207
+ r"const foo = e`\u`;" ,
199
208
] ;
200
209
201
210
let fail = vec ! [
You can’t perform that action at this time.
0 commit comments