File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1124,3 +1124,10 @@ pub fn identifier_expected_after_question_dot(span: Span) -> OxcDiagnostic {
11241124 . with_label ( span)
11251125 . with_help ( "Add an identifier after '?.'" )
11261126}
1127+
1128+ #[ cold]
1129+ pub fn identifier_expected_jsx_no_hyphen ( span : Span ) -> OxcDiagnostic {
1130+ OxcDiagnostic :: error ( "Identifiers in JSX cannot contain hyphens" )
1131+ . with_label ( span)
1132+ . with_help ( "Remove the hyphen from the identifier" )
1133+ }
Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ impl<'a> ParserImpl<'a> {
198198 let ident = self . parse_jsx_identifier ( ) ;
199199 // `<foo.bar- />` is a syntax error.
200200 if ident. name . contains ( '-' ) {
201- let error = diagnostics:: unexpected_token ( ident. span ) ;
201+ let error = diagnostics:: identifier_expected_jsx_no_hyphen ( ident. span ) ;
202202 return self . fatal_error ( error) ;
203203 }
204204 property = Some ( ident) ;
Original file line number Diff line number Diff line change @@ -3494,11 +3494,12 @@ Negative Passed: 120/120 (100.00%)
34943494 ╰────
34953495 help : Remove this ` ?`
34963496
3497- × Unexpected token
3497+ × Identifiers in JSX cannot contain hyphens
34983498 ╭─[misc / fail / oxc - 5355.jsx :1 :6 ]
34993499 1 │ < Foo .bar - baz / >
35003500 · ───────
35013501 ╰────
3502+ help : Remove the hyphen from the identifier
35023503
35033504 × Optional declaration is not allowed here
35043505 ╭─[misc / fail / oxc - 5955 - 1.ts :1 :8 ]
You can’t perform that action at this time.
0 commit comments