Disallow nested '.env' blocks since they are useless.

This commit is contained in:
Logan Smyth 2017-11-22 18:23:28 -08:00
parent a89171910f
commit db28c18458
2 changed files with 3 additions and 8 deletions

View File

@ -206,6 +206,9 @@ export function validate(type: OptionsType, opts: {}): ValidatedOptions {
if (type !== "arguments" && ROOT_VALIDATORS[key]) {
throw new Error(`.${key} is only allowed in root programmatic options`);
}
if (type === "env" && key === "env") {
throw new Error(`.${key} is not allowed inside another env block`);
}
const validator =
COMMON_VALIDATORS[key] ||

View File

@ -296,12 +296,6 @@ describe("api", function() {
development: {
passPerPreset: true,
presets: [pushPreset("argthree"), pushPreset("argfour")],
env: {
development: {
passPerPreset: true,
presets: [pushPreset("argfive"), pushPreset("argsix")],
},
},
},
},
});
@ -327,8 +321,6 @@ describe("api", function() {
"fourteen;",
"fifteen;",
"sixteen;",
"argfive;",
"argsix;",
"argthree;",
"argfour;",
"seven;",