Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Update Babel to ^7.7.0 and enable Flow enums parsing #812

Merged
merged 4 commits into from Feb 25, 2020

Conversation

gkz
Copy link

@gkz gkz commented Dec 6, 2019

The ability to parse Flow enums was added in Babel 7.7.0. It sits behind an option "enums" for the flow Babel plugin.

Update the Babel dependency to ^7.7.0, fix a small test issue, then enable enums: true.

I understand that we wouldn't need to do this with the 11.x series of babel-eslint because Babel is a peer dependency in 11.x, but that's still in beta and not officially released, so that's why I'm opening up a PR for the 10.x series.

Copy link
Member

@kaicataldo kaicataldo left a comment

Choose a reason for hiding this comment

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

This seems reasonable to me, though I'd like someone with more context to confirm this isn't a breaking change.

test/babel-eslint.js Outdated Show resolved Hide resolved
@gkz
Copy link
Author

gkz commented Dec 9, 2019

The support for parsing enums should not be breaking, since enum is a "future reserved word" and its usage was previously a parse error.

@gkz
Copy link
Author

gkz commented Jan 8, 2020

Hi @kaicataldo, now that the holiday season has passed, I was wondering if you'd be willing to take another look at this.

@kaicataldo
Copy link
Member

@gkz Would you be willing to make this PR over in https://github.com/babel/babel/tree/master/eslint/babel-eslint-parser? I'm working to get babel-eslint back to a sane state for the Babel v8 release, and doing all active development there now. Thanks!

@kaicataldo
Copy link
Member

Though, actually, this should already work in the latest version. Adding these tests could be helpful though.

@gkz
Copy link
Author

gkz commented Jan 9, 2020

We need to add the "flow" plugin to the parser options (to be able to parse Flow code), and add the enums: true flow plugin option to parse neums.

I'll take a look

@kaicataldo
Copy link
Member

@gkz The latest version reads your Babel config at parse time, so if Babel is able to parse it, ESLint should also.

@gkz
Copy link
Author

gkz commented Feb 21, 2020

@kaicataldo We are blocked on launching the enums feature because of lack of Eslint support. @babel/eslint-parser has not been released yet. I would appreciate it if you would consider merging this and releasing 10.0.4. Since the version of @babel/parser is specified as ^7.0.0, anyone installing babel-eslint will get the latest version of Babel parser already, so the only change in this PR is adding {enums: true}. Since enum is a reserved word, any usage would be a parse error.

@gkz
Copy link
Author

gkz commented Feb 24, 2020

I realized I need to add EnumDeclarations to the scope analysis - will update the PR soon

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

Thanks!

@gkz
Copy link
Author

gkz commented Feb 25, 2020

I have updated the test

@kaicataldo
Copy link
Member

Do we also need to update the peer dependency on @babel/core?

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Feb 25, 2020

No, it would be a breaking change. If someone is using an old version of Babel, this PR is a noop but doesn't do any harm.

@kaicataldo
Copy link
Member

Ah right, this is in v10. Got it 👍

@kaicataldo kaicataldo merged commit 2c754a8 into babel:10.x Feb 25, 2020
@kaicataldo
Copy link
Member

Thanks for contributing!

@gkz gkz deleted the babel-update-flow-enums branch February 25, 2020 23:20
@gkz
Copy link
Author

gkz commented Feb 25, 2020

Thanks for merging!

@kaicataldo
Copy link
Member

Published in babel-eslint@10.1.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants