-
Notifications
You must be signed in to change notification settings - Fork 38
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
Conversation
d3: 'd3', | ||
NProgress: 'NProgress', | ||
FastClick: 'shopify-fastclick', | ||
Clipboard: 'clipboard', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 👍
👌 |
@@ -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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Really nice stuff. Once the key=>value typo is fixed, this is good to 🚢 |
This PR does a few small things, I can unbundle them if it will make it easier to review:
global-identifier-to-import
to turn globals (lodash, jQuery, etc) into import statements.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.cc/ @GoodForOneFare @bouk @Fandy