Skip to content

Commit

Permalink
fix: validate should support plugin optionsSourceKind
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jan 7, 2020
1 parent f420a60 commit 60dde89
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/babel-core/src/config/validation/options.js
Expand Up @@ -27,6 +27,7 @@ import {
type Validator,
type OptionPath,
} from "./option-assertions";
import { validatePluginObject } from "./plugins";

const ROOT_VALIDATORS: ValidatorSet = {
cwd: (assertString: Validator<$PropertyType<ValidatedOptions, "cwd">>),
Expand Down Expand Up @@ -296,6 +297,10 @@ function getSource(loc: NestingPath): OptionsSource {
}

export function validate(type: OptionsSource, opts: {}): ValidatedOptions {
//todo: consider merge validatePluginObject with validateNested
if (type === "plugin") {
return validatePluginObject(opts);
}
return validateNested(
{
type: "root",
Expand Down

0 comments on commit 60dde89

Please sign in to comment.