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

(opt-in) Improve @babel/types with env.BABEL_TYPES_8_BREAKING #10917

Conversation

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Dec 23, 2019

Q                       A
Fixed Issues? Closes #5971
Patch: Bug Fix?
Major: Breaking Change? Yes, but opt-in.
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

⚠️ This PR isn't actually breaking, but I used that label for changelog reasons.

As discussed during the Dec 04 meeting, I'm introducing the stricter AST validation of #5971 behind a flag.

We decided to introduce those breaking changes when the process.env.BABEL_TYPES_8_BREAKING env variable is enabled, to give time to some popular projects (like react-native) to update their code before the Babel 8 release, to provide a smoother update experience to our users.

I didn't include the changes related to the default value of decorators (since they are still highly experimental, I don't think we should pollute the AST unless the parser plugin is enabled). Also, I didn't include the validateDeep logic, but we can introduce it later in our test runner.

Our tests are already passing when BABEL_TYPES_8_BREAKING=true.

Co-authored-by: Justin Ridgewell <justin+github@ridgewell.name>
@nicolo-ribaudo nicolo-ribaudo force-pushed the nicolo-ribaudo:cleanup-babel-types-babel-8-breaking branch from 60d964c to 9c15a55 Dec 23, 2019
@nicolo-ribaudo nicolo-ribaudo requested a review from jridgewell Dec 23, 2019
@nicolo-ribaudo nicolo-ribaudo added this to the v7.8.0 milestone Dec 23, 2019
export function assertClassExpression(node: Object, opts?: Object = {}): void {
assert("ClassExpression", node, opts);
}
export function assertClassDeclaration(node: Object, opts?: Object = {}): void {

This comment has been minimized.

Copy link
@JLHwung

JLHwung Dec 24, 2019

Contributor

I think they are sorted alphabetically?

This comment has been minimized.

Copy link
@nicolo-ribaudo

nicolo-ribaudo Dec 24, 2019

Author Member

This file is automatically generated. I had to swap then in the definitions/es2015 file, so they got swapped here.

fields: {
// todo
},
fields: !process.env.BABEL_TYPES_8_BREAKING

This comment has been minimized.

Copy link
@nicolo-ribaudo

nicolo-ribaudo Dec 24, 2019

Author Member

I used ! everywhere so that, when deleting it for Babel 8, I only have to make one selection (from ! to :) rather than two (from ! to ? and then from : to the end).

Dev-optimization? 😄

@JLHwung
JLHwung approved these changes Jan 8, 2020
@nicolo-ribaudo nicolo-ribaudo merged commit e7b80a2 into babel:master Jan 11, 2020
4 of 5 checks passed
4 of 5 checks passed
build (13.x)
Details
test262 Workflow: test262
Details
Travis CI - Pull Request Build Passed
Details
build-standalone Workflow: build-standalone
Details
e2e Workflow: e2e
Details
@nicolo-ribaudo nicolo-ribaudo deleted the nicolo-ribaudo:cleanup-babel-types-babel-8-breaking branch Jan 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.