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

Update babel to v7.20.0 #13733

Merged
merged 8 commits into from Oct 29, 2022
Merged

Update babel to v7.20.0 #13733

merged 8 commits into from Oct 29, 2022

Conversation

fisker
Copy link
Sponsor Member

@fisker fisker commented Oct 26, 2022

Description

Babel going to make some change to the location info babel/babel#15032. I downloaded the artifact to see what will break.

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@fisker

This comment was marked as outdated.

}
const decorators = node.declaration?.decorators ?? node.decorators;
if (isNonEmptyArray(decorators)) {
return Math.min(locStart(decorators[0]), start);
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

It seems the old one is not right, if decorators after export, it will still use range of decorators[0]

Copy link
Contributor

Choose a reason for hiding this comment

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

In which case is locStart(decorators[0]) less then start? The change in Babel that broke prettier was that now the start of the outer node should always be ≤ than the start of the inner nodes, so startlocStart(decorators[0]).

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

In which case is locStart(decorators[0]) less then start?

Other parsers, flow/typescript I think they followed old behavior of babel.

@fisker fisker changed the title Prepare for next @babel/parser version Update babel to v7.20.0 Oct 28, 2022
@fisker
Copy link
Sponsor Member Author

fisker commented Oct 28, 2022

This PR only fixes hasDecoratorsBeforeExport check, other changes like

  • Parse import reflection
  • Add support for expr satisfies Type expressions

Will be done in separate prs.

https://github.com/babel/babel/releases/tag/v7.20.0

@fisker fisker marked this pull request as ready for review October 28, 2022 06:52
@fisker fisker merged commit 40f3bce into prettier:next Oct 29, 2022
@fisker fisker deleted the babel-parser-loc branch October 29, 2022 08:40
@fisker fisker mentioned this pull request Oct 29, 2022
3 tasks
sosukesuzuki added a commit to sosukesuzuki/prettier that referenced this pull request Nov 2, 2022
fisker added a commit to fisker/prettier that referenced this pull request Nov 3, 2022
# Conflicts:
#	package.json
#	tests/unit/__snapshots__/visitor-keys.js.snap
#	yarn.lock
@kachkaev kachkaev added this to the 2.8 milestone Nov 16, 2022
medikoo pushed a commit to medikoo/prettier-elastic that referenced this pull request Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants