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

Flow enums: fix enum body location #10737

Merged
merged 2 commits into from Nov 20, 2019
Merged

Flow enums: fix enum body location #10737

merged 2 commits into from Nov 20, 2019

Conversation

gkz
Copy link
Contributor

@gkz gkz commented Nov 19, 2019

The location of the Flow enum bodys was incorrect. I fixed this in flow-parser (facebook/flow@498a209), and this PR fixes this in Babel, making it consistent with flow-parser, and also consistent with what the enum body contains (everything after enum E).

The diff also does some minor refactoring and cleaning up:

  • Splits out parsing of the enum body into a separate function (separate from parsing the enum declaration overall)
  • Rather than have a helper function for enum string bodies, it returns the string members, so the creation of enum bodies is completely contained in the new flowEnumBody function.

This incorrect location was discovering when adding support in Prettier prettier/prettier#6860

After this lands and they update their parser deps, Prettier can remove their hacks.

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

@nicolo-ribaudo nicolo-ribaudo added area: flow pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories labels Nov 19, 2019
@nicolo-ribaudo
Copy link
Member

(Please run yarn install && make fix)

Copy link
Member

@existentialism existentialism left a comment

Choose a reason for hiding this comment

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

👍 (baring lint fix)

@existentialism existentialism merged commit 01d6d6d into babel:master Nov 20, 2019
@existentialism
Copy link
Member

@gkz thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: flow outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser 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.

None yet

3 participants