Skip to content

Conversation

janicduplessis
Copy link
Contributor

This make the transform behave closer to the standard for modules.

This removes the few places that a top level this was used to refer to the global space. It also clean up the usage of GLOBAL to use global instead as this is what is used everywhere else in the code base. We still define GLOBAL for compatibility with other modules.

Test plan
Clear the packager cache to make sure the transforms run again. (node ./local-cli/cli.js start --reset-cache).
Run the Movies example (UIExplorer is broken atm) and make sure there are no errors.

@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @sahrens, @janicduplessis and @frantic to be potential reviewers.

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Mar 3, 2016
@@ -24,4 +21,4 @@ var GLOBAL = this;
* that use it aren't just using a global variable, so simply export the global
* variable here. ErrorUtils is originally defined in a file named error-guard.js.
*/
module.exports = GLOBAL.ErrorUtils;

Choose a reason for hiding this comment

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

strict: Use the global form of "use strict".

@facebook-github-bot
Copy link
Contributor

@janicduplessis updated the pull request.

@janicduplessis
Copy link
Contributor Author

Cc @davidaurelio

@ide
Copy link
Contributor

ide commented Mar 7, 2016

LGTM

@ide
Copy link
Contributor

ide commented Mar 10, 2016

Tests are green and this looks safe to me. Mainly it's a question of whether some FB internal code is relying on some subtle behavior that may have changed -- shipping this to send it to the internal test runner.

@ide
Copy link
Contributor

ide commented Mar 10, 2016

@facebook-github-bot shipit

@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to Phabricator to review.

/* eslint-disable consistent-this, global-strict */

var GLOBAL = this;
/* eslint-disable strict */
Copy link
Contributor

Choose a reason for hiding this comment

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

Also we probably can write "use strict" now... can do that in a future diff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We were actually discussing enabling strict mode in modules and maybe remove 'use strict' added manually everywhere so we can leave it as is for now.

@janicduplessis
Copy link
Contributor Author

👍

@ide
Copy link
Contributor

ide commented Mar 11, 2016

@davidaurelio @martinbigio I suspect this caused some internal tests to fail -- if this is the case, is it possible for FB to use a custom Babel configuration that extends the RN preset but sets allowTopLevelThis to true?

@facebook-github-bot
Copy link
Contributor

@janicduplessis updated the pull request.

@mkonicek
Copy link
Contributor

@davidaurelio Is this going to break anything?

@satya164
Copy link
Contributor

With this change, we can finally use 'es2015' preset instead of writing individual plugins, right?

Thanks a lot for working on this. Moving the preset closer towards standard setups is really great.

@satya164
Copy link
Contributor

satya164 commented Apr 4, 2016

Any updates on this?

@facebook-github-bot
Copy link
Contributor

@janicduplessis updated the pull request.

@janicduplessis
Copy link
Contributor Author

What I think we should do for now is keep the allowTopLevelThis in the preset but still make these changes that allow RN to work without it. The main issue right now is that we transform every library in node_modules with the babel preset so it can cause issues that are hard to fix. Until we can configure the babel preset it's better to keep the transforms as loose a possible.

@janicduplessis
Copy link
Contributor Author

I put back the allowTopLevelThis in the babel preset so it should be able to get merged without breaking internal fb tests.

@ide
Copy link
Contributor

ide commented Apr 5, 2016

@facebook-github-bot shipit

1 similar comment
@davidaurelio
Copy link
Contributor

@facebook-github-bot shipit

@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to Phabricator to review.

@mkonicek
Copy link
Contributor

mkonicek commented Apr 7, 2016

Flaky CI maybe?

@facebook-github-bot shipit

@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to Phabricator to review.

@satya164
Copy link
Contributor

satya164 commented Apr 7, 2016

Seems the tests are not passing. Some error with code analysis bot.

@facebook-github-bot
Copy link
Contributor

@janicduplessis updated the pull request.

@satya164
Copy link
Contributor

Seems Flow check is failing in the CI

@janicduplessis
Copy link
Contributor Author

No idea what causes that. Flow is scanning random buck json files.

cc @bestander @mkonicek

@bestander
Copy link
Contributor

@janicduplessis, no worries, it is some old Circle cache that had buck installed in the project file tree.
I set it to rebuild without caches, should be fine

@mkonicek
Copy link
Contributor

@facebook-github-bot shipit

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Apr 22, 2016
@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to Phabricator to review.

@facebook-github-bot facebook-github-bot added Import Failed and removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Apr 23, 2016
@janicduplessis
Copy link
Contributor Author

@mkonicek Any idea what caused the internal test failures here?

…monjs

This removes the few places that a top level this was used to refer to
the global space. It also clean up the usage of `GLOBAL` to use `global`
instead as this is what is used everywhere else in the code base. We still
define `GLOBAL` for compatibility with other modules.
@ghost
Copy link

ghost commented Apr 29, 2016

@janicduplessis updated the pull request.

@ghost
Copy link

ghost commented Apr 29, 2016

@janicduplessis updated the pull request.

@mkonicek
Copy link
Contributor

I can't tell what's wrong with the tests actually, a generic Buck failure. Merging again.

@davidaurelio
Copy link
Contributor

@janicduplessis I’d really like to have this. Would you mind rebasing again? I’ll try to get this in ;-(

@janicduplessis
Copy link
Contributor Author

Rebased it yesterday, it should be fine now.

@davidaurelio
Copy link
Contributor

@facebook-github-bot shipit

@ghost ghost added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Apr 29, 2016
@ghost
Copy link

ghost commented Apr 29, 2016

Thanks for importing. If you are an FB employee go to Phabricator to review.

@ghost ghost closed this in 169cfb5 Apr 29, 2016
ptmt pushed a commit to ptmt/react-native that referenced this pull request May 9, 2016
…monjs

Summary:
This make the transform behave closer to the standard for modules.

This removes the few places that a top level this was used to refer to the global space. It also clean up the usage of `GLOBAL` to use `global` instead as this is what is used everywhere else in the code base. We still define `GLOBAL` for compatibility with other modules.

**Test plan**
Clear the packager cache to make sure the transforms run again. (node ./local-cli/cli.js start --reset-cache).
Run the Movies example (UIExplorer is broken atm) and make sure there are no errors.
Closes facebook#6255

Differential Revision: D3037227

Pulled By: mkonicek

fb-gh-sync-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
fbshipit-source-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
zebulgar pushed a commit to nightingale/react-native that referenced this pull request Jun 18, 2016
…monjs

Summary:
This make the transform behave closer to the standard for modules.

This removes the few places that a top level this was used to refer to the global space. It also clean up the usage of `GLOBAL` to use `global` instead as this is what is used everywhere else in the code base. We still define `GLOBAL` for compatibility with other modules.

**Test plan**
Clear the packager cache to make sure the transforms run again. (node ./local-cli/cli.js start --reset-cache).
Run the Movies example (UIExplorer is broken atm) and make sure there are no errors.
Closes facebook#6255

Differential Revision: D3037227

Pulled By: mkonicek

fb-gh-sync-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
fbshipit-source-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
bubblesunyum pushed a commit to iodine/react-native that referenced this pull request Aug 23, 2016
…monjs

Summary:
This make the transform behave closer to the standard for modules.

This removes the few places that a top level this was used to refer to the global space. It also clean up the usage of `GLOBAL` to use `global` instead as this is what is used everywhere else in the code base. We still define `GLOBAL` for compatibility with other modules.

**Test plan**
Clear the packager cache to make sure the transforms run again. (node ./local-cli/cli.js start --reset-cache).
Run the Movies example (UIExplorer is broken atm) and make sure there are no errors.
Closes facebook#6255

Differential Revision: D3037227

Pulled By: mkonicek

fb-gh-sync-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
fbshipit-source-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants