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

Respect preserveComments option in tempate.ast() #11112

Merged

Conversation

dentrado
Copy link
Contributor

@dentrado dentrado commented Feb 8, 2020

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

validate(opts) added preserveComments: false when preserveComments was not present in the validated options. This caused the NO_PLACEHOLDER options in builder.js to contain preserveComments: false. So since NO_PLACEHOLDER later is merged in to the rest of the options given to template.ast() the preserveComments option was always set to false.

This PR changes validate(opts) so it keeps preserveComments undefined if it was null/undefined.

@@ -219,7 +231,7 @@ describe("@babel/template", function() {
});
});

describe.only(".syntacticPlaceholders", () => {
describe(".syntacticPlaceholders", () => {
Copy link
Member

Choose a reason for hiding this comment

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

😬

Copy link
Member

Choose a reason for hiding this comment

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

We should probably lint for this 😬

Copy link
Member

Choose a reason for hiding this comment

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

Actually, it looks like we should be linting for this already: https://github.com/jest-community/eslint-plugin-jest/blob/master/docs/rules/no-focused-tests.md is a recommended rule. 🤔

Copy link
Member

Choose a reason for hiding this comment

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

We added it yesterday 😛
#11119

@nicolo-ribaudo nicolo-ribaudo added pkg: template PR: Bug Fix 🐛 A type of pull request used for our changelog categories labels Feb 9, 2020
@dentrado dentrado removed the request for review from loganfsmyth February 11, 2020 08:58
@nicolo-ribaudo nicolo-ribaudo merged commit bc308a1 into babel:master Feb 11, 2020
@nicolo-ribaudo
Copy link
Member

Thanks!

rajasekarm pushed a commit to rajasekarm/babel that referenced this pull request Feb 17, 2020
@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 May 13, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: template 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.

template.ast() doesn't respect preserveComments option.
4 participants