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

Use the same JS language features as React Native #22

Closed
lacker opened this issue Jul 18, 2016 · 11 comments
Closed

Use the same JS language features as React Native #22

lacker opened this issue Jul 18, 2016 · 11 comments
Assignees

Comments

@lacker
Copy link
Contributor

lacker commented Jul 18, 2016

It will make our open source stuff confusing if each project uses a slightly different subset of language features. Tricky to cut n paste from examples, etc. React Native is the trickiest to match because it doesn't actually ship in ES5 form so it's hard to alter the babel config for it. My proposal is that we take ES6 and then cherry-pick individual features til we have the ones React Native uses. If that seems like "the right thing" I can take this on; otherwise what is "the right thing" here?

@gaearon
Copy link
Contributor

gaearon commented Jul 18, 2016

I’m 👍 on this if RN is a superset of ES2015.

@lacker
Copy link
Contributor Author

lacker commented Jul 18, 2016

Sadly babel-preset-react-native is not a superset of ES2015 but it's pretty close. I will keep this a superset of ES2015 and then add in the stuff RN uses, and I will nag the React Native folks separately to add the missing ES2015 features.

@lacker lacker self-assigned this Jul 18, 2016
@vjeux
Copy link
Contributor

vjeux commented Jul 18, 2016

@vjeux
Copy link
Contributor

vjeux commented Jul 18, 2016

Missing from react-native:

  • transform-es2015-block-scoped-functions
  • transform-es2015-duplicate-keys
  • transform-es2015-object-super
  • transform-es2015-sticky-regex
  • transform-es2015-typeof-symbol
  • transform-es2015-unicode-regex

Different defaults

  • transform-es2015-for-of { loose: true }
  • transform-es2015-modules-commonjs { strict: false, allowTopLevelThis: true }

@vjeux
Copy link
Contributor

vjeux commented Jul 18, 2016

For React Native, as a philosophy, we want to use es2015 and next. So if those transforms don't break any of our current apps and don't add any weight, we should add them to the preset.

@lacker
Copy link
Contributor Author

lacker commented Jul 19, 2016

In react-native but afaict not (yet) in create-react-app:

  • 'syntax-async-functions'
  • 'syntax-class-properties'
  • 'syntax-trailing-function-commas'
  • 'transform-class-properties'
  • 'transform-object-assign'

@vjeux
Copy link
Contributor

vjeux commented Jul 19, 2016

  • 'syntax-async-functions': we're already embedding regenerator with es2015 and it's already implemented in browsers so should be good to go
  • 'syntax-trailing-function-commas': seems like a no-brainer, we should enable it
  • 'syntax-class-properties' & 'transform-class-properties': would be nice to wait until end of next week as we're presenting a revised version to tc39. See how it goes.
  • 'transform-object-assign': this is a polyfill kind of thing, we don't really need it.

@gaearon
Copy link
Contributor

gaearon commented Jul 19, 2016

fully agree with ^^

@lacker
Copy link
Contributor Author

lacker commented Jul 20, 2016

OK, the problem is the linting. Both async functions and class properties are not supported by eslint. We could use https://github.com/babel/babel-eslint but perhaps that is too nonstandard / not worth it just for this extra bit of compatibility. Any thoughts one way or the other?

@gaearon
Copy link
Contributor

gaearon commented Jul 20, 2016

I'm against using babel-eslint for now. It is very fragile (no offense to maintainers, it's just a hard thing to do) and so people have been historically bumping into its issues many times.

We can revisit this later if properties advance in TC39.

@lacker
Copy link
Contributor Author

lacker commented Jul 21, 2016

OK well you mostly did this in #43 so this issue is all set, with the exception of async. I think it would be cleaner to put that in a new issue so I'll do that

@lacker lacker closed this as completed Jul 21, 2016
@lock lock bot locked and limited conversation to collaborators Jan 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants