babel / website

:globe_with_meridians: The Babel documentation website
https://babeljs.io/docs/en/index.html
MIT License
750 stars 1.31k forks source link

addDefault adds underscore even if nameHint provided #2312

Open mixail-novikov opened 4 years ago

mixail-novikov commented 4 years ago

Documentation shows an example without underscore https://babeljs.io/docs/en/next/babel-helper-module-imports.html#import-hintedname-from-source

But in fact, it is added to the name https://github.com/babel/babel/blob/e498bee10f0123bb208baa228ce6417542a2c3c4/packages/babel-helper-module-imports/test/index.js#L299

I understand why an underscore is necessary for _default(a reserved word). But I can't understand why it's necessary when nameHint is provided.

Should we change documentation or implementation?

babel-bot commented 4 years ago

Hey @mixail-novikov! 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 commented 4 years ago

We should probably update the docs: that's just an "hint", not the exact parameter name. Also, all the variable names generated by Babel start with _.

babel-bot commented 4 years ago

Hey @mixail-novikov! 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.