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 2 commits into from Nov 20, 2019


Copy link

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

This comment has been minimized.

Copy link

nicolo-ribaudo commented Nov 19, 2019

(Please run yarn install && make fix)

Copy link

existentialism left a comment

👍 (baring lint fix)

@existentialism existentialism merged commit 01d6d6d into babel:master Nov 20, 2019
4 of 5 checks passed
4 of 5 checks passed
test262 Workflow: test262
Travis CI - Pull Request Build Passed
codecov/project 88.15% (target 80%)
e2e Workflow: e2e
test Workflow: test

This comment has been minimized.

Copy link

existentialism commented Nov 20, 2019

@gkz thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.