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

Clarify warning source about underspecified corejs option in preset-env. #12402

Merged
merged 5 commits into from Dec 1, 2020

Conversation

AndrewSouthpaw
Copy link
Contributor

@AndrewSouthpaw AndrewSouthpaw commented Nov 25, 2020

Q                       A
Fixed Issues?
Patch: Bug Fix? Yes
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes? No
License MIT

I stumbled across the warning about using useBuiltIns without declaring a core-js version. It took me a fair bit of hunting before I realized it belonged to preset-env, and how to fix the issue. From the docs, I thought all I needed to do was install the package, which (I now see obviously) didn't fix the problem.

I'm not sure if some expanded logging like this would be desired, but I could imagine it'll reduce confusion for people by adding a little tag to the warning printout, so they know this is coming from this package. I've definitely run into this error multiple times when starting projects and was confused as to what to do.

I think I got all the tests to pass, I was getting some issues with caniuse-lite being outdated and complaining about it, but I couldn't seem to make it go away. Sorry if I got it wrong, this is my first time contributing to babel.

@babel-bot
Copy link
Collaborator

babel-bot commented Nov 25, 2020

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/33649/

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 25, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 8fd93bc:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@AndrewSouthpaw AndrewSouthpaw changed the title Clarify warning source Clarify warning source about underspecified corejs option in preset-env. Nov 26, 2020
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I really like the links pointing to the docs for more context.

Comment on lines 163 to 164
"\n[babel-preset-env]" +
"\nWARNING: We noticed you're using the `useBuiltIns` option without declaring a " +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer something like

Suggested change
"\n[babel-preset-env]" +
"\nWARNING: We noticed you're using the `useBuiltIns` option without declaring a " +
"\nWARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a " +

Comment on lines 189 to 190
"\n[babel-preset-env]" +
"\nThe `corejs` option only has an effect when the `useBuiltIns` option is not `false`\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also here:

Suggested change
"\n[babel-preset-env]" +
"\nThe `corejs` option only has an effect when the `useBuiltIns` option is not `false`\n",
"\nWARNING (@babel/preset-env): The `corejs` option only has an effect when the `useBuiltIns` option is not `false`\n",

(this is not technically a warning, but since it's probably an error in the user's config it's good to mark it as such).

@nicolo-ribaudo nicolo-ribaudo added area: errors pkg: preset-env PR: Polish 💅 A type of pull request used for our changelog categories labels Nov 26, 2020
@AndrewSouthpaw
Copy link
Contributor Author

Thanks for the review! I'll work on those changes.

@AndrewSouthpaw
Copy link
Contributor Author

Okay, changes are up.

@nicolo-ribaudo nicolo-ribaudo merged commit 71f8787 into babel:main Dec 1, 2020
@nicolo-ribaudo
Copy link
Member

Thanks!

@AndrewSouthpaw AndrewSouthpaw deleted the clarify-warning-source branch December 1, 2020 19:19
nicolo-ribaudo pushed a commit to nicolo-ribaudo/babel that referenced this pull request Dec 2, 2020
…nv. (babel#12402)

* Clarify these warnings are for babel-preset-env.

* Fix lint.

* Fix specs.

* Fix merge conflict.

* PR feedback.
@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 Mar 3, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: errors outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: preset-env PR: Polish 💅 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants