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

Improve example of babel-plugin-transform-es2015-arrow-functions #5573

Merged
merged 3 commits into from Apr 7, 2017

Conversation

@exacs
Copy link
Contributor

exacs commented Apr 2, 2017

[skip ci]

Q A
Patch: Bug Fix? No
Major: Breaking Change? No
Minor: New Feature? No
Deprecations? No
Spec Compliancy? No
Tests Added/Pass? No
Fixed Tickets No
License MIT
Doc PR Yes
Dependency Changes No

The example in the README file suggested that the plugin transforms shorthand properties to ES5 object syntax but that operation is performed by another plugin (babel-plugin-transform-es2015-shorthand-properties).

@mention-bot

This comment has been minimized.

Copy link

mention-bot commented Apr 2, 2017

@exacs, thanks for your PR! By analyzing the history of the files in this pull request, we identified @xtuc, @existentialism and @hzoo to be potential reviewers.

@xtuc

This comment has been minimized.

Copy link
Member

xtuc commented Apr 3, 2017

Thanks for your PR but this is not the result you get in the REPL, see here.

Output should be ES5 compatible, const isn't.

@exacs

This comment has been minimized.

Copy link
Contributor Author

exacs commented Apr 3, 2017

Ok. I thought that the example only show the transformation of the single arrow-functions plugin instead of all the es2015 preset, i.e. what you get when you run:

babel --plugins transform-es2015-arrow-functions in.js

Thanks for your clarify!

@xtuc

This comment has been minimized.

Copy link
Member

xtuc commented Apr 3, 2017

Yes, I didn't think about it, you are correct 💯

I'm wondering why arrow functions doesn't keep the name after transpilation.

@exacs

This comment has been minimized.

Copy link
Contributor Author

exacs commented Apr 3, 2017

I've just found this other plugin babel-plugin-transform-es2015-function-name that performs that transformation

@exacs

This comment has been minimized.

Copy link
Contributor Author

exacs commented Apr 4, 2017

So, just to ask, what is the criteria for examples in documentation of plugins like this one?

  • Same output as REPL (show the example of the whole preset instead of the particular transform plugin)
  • Same output as CLI (show exclusively the transformation of the plugin)
@existentialism

This comment has been minimized.

Copy link
Member

existentialism commented Apr 5, 2017

IMO, the examples in a plugin's docs should really only show what happens when it is run by itself.

The real wrinkle here is the awkwardness that clicking on the "TRY IT OUT" link that sends you to the REPL will show diffrent output (since it only has support for presets and not individual plugins, yet).

@xtuc
xtuc approved these changes Apr 7, 2017
Copy link
Member

xtuc left a comment

LGTM, thanks for the PR 👍

@xtuc xtuc merged commit 0b917c0 into babel:7.0 Apr 7, 2017
xtuc added a commit that referenced this pull request Apr 8, 2017
@xtuc xtuc mentioned this pull request Apr 8, 2017
hulkish added a commit to hulkish/babel that referenced this pull request May 2, 2017
* 'master' of github.com:hulkish/babel: (37 commits)
  Increase the code coverage for traverse evaluation (babel#5363)
  Improve options documentation for `babel-plugin-transform-runtime` babel#5401
  [doc] Fix: comments in usage w/ options babel#5400
  document cache option for babel-register babel#5440
  Update coffescript/register reference link address babel#5475
  Update babel-generator's README babel#5517
  Improve example of babel-plugin-transform-es2015-arrow-functions babel#5573
  Remove incorrect docs. babel#5580
  Update transform-es2015-modules-commonjs doc babel#5588
  Fix replacing function declaration in export default (fixes babel#4468) (babel#5456)
  Fix a typo: occurences -> occurrences (babel#5575)
  Fix changelog [skip ci]
  Treat "await" as an invalid identifier (babel#4954)
  Removes unused lodash dependency from babel-helper-builder-react-jsx (babel#5486)
  docs: [skip ci] update documentation
  v6.24.0
  changelog for 6.24.0 [skip ci] (babel#5452)
  Keep parentheses for logical expression when in await expression (fix babel#5428) (babel#5433) (babel#5453)
  Use absolute paths in Babel's CONTRIBUTING.md (babel#5431)
  Fixed broken links in README.md [skip ci] (babel#5449)
  ...
hulkish added a commit to hulkish/babel that referenced this pull request May 3, 2017
@lock lock bot added the outdated label Oct 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants
You can’t perform that action at this time.