Skip to content
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

Don't convert line comments containing */ to block comments #15135

Merged
merged 1 commit into from Nov 7, 2022

Conversation

liuxingbaoyu
Copy link
Member

@liuxingbaoyu liuxingbaoyu commented Nov 5, 2022

Q                       A
Fixed Issues? Fixes #15132
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass?
Documentation PR Link
Any Dependency Changes?
License MIT

regression: #15118

@liuxingbaoyu liuxingbaoyu added PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: generator area: comments i: regression labels Nov 5, 2022
@@ -10,7 +10,6 @@ export function _params(
this.token("(");
this._parameters(node.params, node);
this.token(")");
this._noLineTerminator = true;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the fix, can you confirm it? I'm not sure about the purpose here.
@nicolo-ribaudo

Copy link
Member

Choose a reason for hiding this comment

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

In arrow functions, ) cannot be followed by a newline.

Copy link
Member

Choose a reason for hiding this comment

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

Probably it doesn't matter because inner comments in arrow functions would already be printer earlier.

Comment on lines -907 to +914
if (this._noLineTerminator && HAS_NEWLINE.test(comment.value)) {
const noLineTerminator = this._noLineTerminator;

if (
noLineTerminator &&
(HAS_NEWLINE.test(comment.value) ||
HAS_BlOCK_COMMENT_END.test(comment.value))
) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Here is the fix for the root cause, see the test.

@babel-bot
Copy link
Collaborator

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

@nicolo-ribaudo nicolo-ribaudo changed the title fix: Generate invalid comments Don't convert line comments containing */ to block comments Nov 7, 2022
@nicolo-ribaudo nicolo-ribaudo merged commit 9b8fbcd into babel:main Nov 7, 2022
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Feb 7, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: comments i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: generator PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Unable to use pako in create-react-app 5 with latest babel v7.20.x
3 participants