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

Minor improvements from a few more translation examples #90

Merged
merged 3 commits into from
May 20, 2016

Conversation

lemonmade
Copy link
Member

This PR does a few small things, I can unbundle them if it will make it easier to review:

  • Adds global-identifier-to-import to turn globals (lodash, jQuery, etc) into import statements.
  • Made remove-useless-return-from-test also remove the IIFE wrapper from the return argument, if present. This was causing some issues with the transforms that depend on scope to do things, like the mocha ones. The bare IIFE also doesn't really make much sense, it's mostly just used for CoffeeScript's everything-is-an-expression madness.
  • Rejigged the order a little bit more.
  • Made some small updates to the utilities and a few other files.

cc/ @GoodForOneFare @bouk @Fandy

d3: 'd3',
NProgress: 'NProgress',
FastClick: 'shopify-fastclick',
Clipboard: 'clipboard',
Copy link
Contributor

Choose a reason for hiding this comment

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

nice 👍

@bouk
Copy link
Contributor

bouk commented May 20, 2016

👌

@@ -12,6 +12,29 @@ This repository contains a collection of Codemods written with [JSCodeshift](htt

## Included Transforms

### `global-identifer-to-import`

Transforms global identifiers that you specify into the appropriate import statements. In order for this to work, you must set the `globalIdentifiers` option to an object where the keys are the names of globals used in your script, and the keys are the import paths for those globals.
Copy link
Member

Choose a reason for hiding this comment

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

Transforms global identifiers seems misleading because this is an additive operation.

-the keys are the import paths
+the values are the import path

Overall, it could be more concise. Creates import statements for global references. Use the globalIdentifiers option to specify identifier/import path pairs.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

@GoodForOneFare
Copy link
Member

Really nice stuff. Once the key=>value typo is fixed, this is good to 🚢

@lemonmade lemonmade merged commit 4e3814a into master May 20, 2016
@lemonmade lemonmade deleted the minor-improvements branch May 20, 2016 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants