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

Map plugins to transformers and vice versa #8790

Open
andrewmiller1 opened this Issue Oct 1, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@andrewmiller1

andrewmiller1 commented Oct 1, 2018

Feature Request

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I have an issue when [...]

You guys have done a fantastic job on babel.

An extension of #6205

I have an issue when I'm dealing with a syntax plugin but don't know its associated transformer plugin and vice versa.

My view:

Using plugins listed in stage preset deprecation error message.

Expecting all experimental features to be enabled and configured. But run into:

SyntaxError ... Support for the experimental syntax 'classPrivateMethods' isn't currently enabled ...
...
missingPlugin: [ 'classPrivateMethods' ],
...

Look into documentation, and see

NOTE: transform plugins automatically enable the syntax plugins. So you don't need to specify the syntax plugin if the corresponding transform plugin is used already.

I couldn't initially confirm which transformer if any associated with this syntax plugin. Names were changing in the ecma proposals and proposals were being combined as well.

During that point in time I didn't know which situation I was in:

  • The stage preset error didn't list all the plugins
  • Only parsing was supported for private methods and I wouldn't be able to get a transformer
  • There was a bug in the code

After an hour of researching the ecma repositories and babel github issues and development, I found what I needed: #8130 (comment)

Describe the solution you'd like
A clear and concise description of what you want to happen. Add any considered drawbacks.

Mainly, mimic how proposals are referenced but for the respective feature.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Reference babel's relevant development tracker issue for the relevant feature in progress, in documentation / error messages

Teachability, Documentation, Adoption, Migration Strategy
If you can, explain how users will be able to use this and possibly write out a version the docs.
Maybe a screenshot or design?

From https://babeljs.io/docs/en/next/babel-parser:

Before

classPrivateMethods (proposal) class A { #c() {} }

After

classPrivateMethods (plugin, proposal) class A { #c() {} }

And similar solution on the transformer documentation (maybe include into error messages referenced in the issue linked at the top of this post too).

There are further improvements we can do that relate to this issue. But for an easy and effective solution now, we can start with linking the transformers and the plugins where we might need to find them.

@babel-bot

This comment has been minimized.

Show comment
Hide comment
@babel-bot

babel-bot Oct 1, 2018

Collaborator

Hey @andrewmiller1! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

Collaborator

babel-bot commented Oct 1, 2018

Hey @andrewmiller1! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment