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

Enable babel parameters/destructuring for all versions of Node #927

Merged
merged 2 commits into from
Oct 18, 2016

Conversation

JeffreyATW
Copy link
Contributor

Should fix #904. This is my first commit to this project- let me know if this is missing anything!

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@gaearon
Copy link
Contributor

gaearon commented Oct 18, 2016

Thank you! Can you describe how you verified that your changes work?

@JeffreyATW
Copy link
Contributor Author

Ran the same test I tried in #904:

it('renders without crashing', () => {
  const obj = {
    a: 'a',
    b: 'b',
    c: 'c'
  };

  const { a, ...z } = obj;

  console.log(a);
  console.log(z);

  const div = document.createElement('div');
  ReactDOM.render(<App />, div);
});

And the test passed.

@gaearon
Copy link
Contributor

gaearon commented Oct 18, 2016

Nice. Can you try any other cases mentioned in babel/babel#4074?

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@JeffreyATW
Copy link
Contributor Author

JeffreyATW commented Oct 18, 2016

This snippet from babel/babel#4074 worked as well within the test, with an output of { b: 2 }:

const fn = ({ a, ...otherProps }) => otherProps;

fn({ a: 1, b: 2 });

@gaearon gaearon added this to the 0.7.0 milestone Oct 18, 2016
@@ -27,7 +27,10 @@ const plugins = [
regenerator: true,
// Resolve the Babel runtime relative to the config.
moduleName: path.dirname(require.resolve('babel-runtime/package'))
}]
}],
// const { a, ...z } = obj;
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a note here specifically mentioning why we need them, and link to the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@gaearon gaearon merged commit d7ecd92 into facebook:master Oct 18, 2016
@gaearon
Copy link
Contributor

gaearon commented Oct 18, 2016

Awesome. Thank you so much!

@JeffreyATW JeffreyATW deleted the fix/enable-babel-destructuring branch October 18, 2016 17:38
feiqitian pushed a commit to feiqitian/create-react-app that referenced this pull request Oct 25, 2016
…ook#927)

* Enable babel parameters/destructuring for all versions of Node

* Add more descriptive comment explaining plugin use
jarlef pushed a commit to jarlef/create-react-app that referenced this pull request Nov 28, 2016
…ook#927)

* Enable babel parameters/destructuring for all versions of Node

* Add more descriptive comment explaining plugin use
@gaearon gaearon mentioned this pull request Dec 5, 2016
alexdriaguine pushed a commit to alexdriaguine/create-react-app that referenced this pull request Jan 23, 2017
…ook#927)

* Enable babel parameters/destructuring for all versions of Node

* Add more descriptive comment explaining plugin use
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
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.

Investigate if object rest works correctly in tests on master
3 participants