Skip to content

fix(parser): Terminate modifier parsing at newline #17307

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 3 commits into from
May 13, 2025

Conversation

magic-akari
Copy link
Contributor

Q                       A
Fixed Issues? Fixes: #17305
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT
@babel-bot
Copy link
Collaborator

babel-bot commented May 13, 2025

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/59322

@nicolo-ribaudo nicolo-ribaudo added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label May 13, 2025
Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

@@ -447,6 +447,10 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
modifier,
});
}

if (this.hasPrecedingLineBreak()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already check the newline in tsNextTokenCanFollowModifier, but somehow we missed this check for the static token, could you move the newline check there? So we don't have to check the line break for every other modifiers here.

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@nicolo-ribaudo nicolo-ribaudo merged commit 205e1cf into babel:main May 13, 2025
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Bug Fix 🐛 A type of pull request used for our changelog categories
4 participants