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

Map plugins to transformers and vice versa #8790

Closed
andrewmiller1 opened this issue Oct 1, 2018 · 2 comments
Closed

Map plugins to transformers and vice versa #8790

andrewmiller1 opened this issue Oct 1, 2018 · 2 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@andrewmiller1
Copy link

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
Copy link
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.

@nicolo-ribaudo
Copy link
Member

Babel now throws

Support for the experimental syntax 'classProperties' isn't currently enabled (2:5):

  1 | class A {
> 2 |   x = 2
    |     ^
  3 | }

Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-class-properties (https://git.io/vb4yQ) to the 'plugins' section to enable parsing.

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 3, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

3 participants