Skip to content

Update babel to v7.20.0#13733

Merged
fisker merged 8 commits intoprettier:nextfrom
fisker:babel-parser-loc
Oct 29, 2022
Merged

Update babel to v7.20.0#13733
fisker merged 8 commits intoprettier:nextfrom
fisker:babel-parser-loc

Conversation

@fisker
Copy link
Copy Markdown
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.

Comment thread src/language-js/loc.js
}
const decorators = node.declaration?.decorators ?? node.decorators;
if (isNonEmptyArray(decorators)) {
return Math.min(locStart(decorators[0]), start);
Copy link
Copy Markdown
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
Copy Markdown
Contributor

@nicolo-ribaudo nicolo-ribaudo Oct 29, 2022

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
Copy Markdown
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
Copy Markdown
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 pushed 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.

4 participants