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

Take top-level config source into consideration when processing nested env/overrides. #8493

Merged
merged 1 commit into from Aug 20, 2018

Conversation

loganfsmyth
Copy link
Member

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

I realized we had a small hole in option validation. Because we were using the config "type" field for both the type of the overall config, e.g. babelrc vs programmatic vs presets, and also env and overrides, it was possible for options to slip through that aren't supposed to be allowed, if they were inside of an env or overrides subconfig.

For example, presets don't allow ignore and only and extends, but a preset could technically have done

    {
      env: {
        test: {
          ignore: [__dirname],
        }
      }
    }

to get an ignore into the config anyway, by nesting it inside env.

This PR also improves the overall config validation logic by including more information when errors occur during validation, for example the error message for the above config will specifically call out .env["test"].ignore instead off just saying .ignore like it would have before.

@loganfsmyth loganfsmyth added PR: Internal 🏠 A type of pull request used for our changelog categories PR: Polish 💅 A type of pull request used for our changelog categories PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: core labels Aug 20, 2018
@babel-bot
Copy link
Collaborator

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

1 similar comment
@babel-bot
Copy link
Collaborator

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

@loganfsmyth loganfsmyth merged commit c2a2e24 into babel:master Aug 20, 2018
@loganfsmyth loganfsmyth deleted the options-nesting-validation branch August 20, 2018 04:46
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
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 pkg: core PR: Bug Fix 🐛 A type of pull request used for our changelog categories PR: Internal 🏠 A type of pull request used for our changelog categories 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

2 participants