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

Babel Preset: Update @babel/preset-env to enabled optional chaining #18939

Closed
gziolo opened this issue Dec 5, 2019 · 4 comments · Fixed by #19831
Closed

Babel Preset: Update @babel/preset-env to enabled optional chaining #18939

gziolo opened this issue Dec 5, 2019 · 4 comments · Fixed by #19831
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Tool] Babel preset /packages/babel-preset-default [Type] Enhancement A suggestion for improvement.

Comments

@gziolo
Copy link
Member

gziolo commented Dec 5, 2019

Optional chaining reached stage 4!

image

https://twitter.com/NicoloRibaudo/status/1202323456899067906

This means that... it should be soon enabled by default in @babel/preset-env and in @babel/parser.

There are two issues to track progress:

Once those two packages are updated and published to npm we should take an action and update @wordpress/babel-preset-default and all other packages using Babel to use the latest version of all Babel packages.

Resources

@gziolo gziolo added [Type] Enhancement A suggestion for improvement. Good First Issue An issue that's suitable for someone looking to contribute for the first time [Tool] Babel preset /packages/babel-preset-default labels Dec 5, 2019
@jsnajdr
Copy link
Member

jsnajdr commented Dec 5, 2019

After the Babel update ships and we proceed to update Gutenberg, we'll need to add the shippedProposals: true option to the preset-env configuration. That tells the preset to include features that are not yet part of the published standard (that happens officially once a year), but are already approved (stage 4+) and are shipping in production browsers.

Babel will empty the list of shipped proposals once the standard is published and will enable these features by default. Then the list can grow again over the next year 🙂

@abdel-h abdel-h mentioned this issue Dec 11, 2019
6 tasks
@abdel-h
Copy link
Contributor

abdel-h commented Dec 11, 2019

Hey @jsnajdr we are supposed to add opts.shippedProposals = true; to Babel Preset package right ?

@jsnajdr
Copy link
Member

jsnajdr commented Dec 12, 2019

we are supposed to add opts.shippedProposals = true; to Babel Preset package right ?

If the Babel update that adds optional chaining to preset-env makes it a part of the shippedProposals option, then yes, Gutenberg will need to enable that option in its Babel config.

@gziolo
Copy link
Member Author

gziolo commented Jan 18, 2020

Babel 7.8 is out with the support for the feature:
https://babeljs.io/blog/2020/01/11/7.8.0

@gziolo gziolo added the [Status] In Progress Tracking issues with work in progress label Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Tool] Babel preset /packages/babel-preset-default [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants