8000 fix(es/parser): Throw error if JSX does not end with `>` by bvanjoi · Pull Request #10687 · swc-project/swc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(es/parser): Throw error if JSX does not end with > #10687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/mean-pans-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
swc_ecma_parser: patch
swc_core: patch
---

fix(es/parser): throw error if jsx not end with gt
11 changes: 5 additions & 6 deletions crates/swc_ecma_parser/src/parser/jsx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,11 @@ impl<I: Tokens> Parser<I> {
} else {
// <xxxxx/>
p.expect(&Token::Slash)?;
if p.expect_without_advance(&Token::Gt).is_ok() {
if in_expr_context {
p.bump();
} else {
p.input_mut().scan_jsx_token(true);
}
p.expect_without_advance(&Token::Gt)?;
if in_expr_context {
p.bump();
} else {
p.input_mut().scan_jsx_token(true);
}
let span = if in_expr_context {
Span::new(start, p.last_pos())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default () => <div /
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
x Unexpected eof
,-[$DIR/tests/jsx/errors/issue-10681/index.js:1:1]
1 | export default () => <div /
`----
Loading
0