generated from Seekra/repository-template
fix(settings): check the selection options and allowMultiple before and not after the default check in the settings validator
This commit is contained in:
@@ -56,6 +56,12 @@ export const validateEntry = function validateEntry (entry, path) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entry.type === 'selection') {
|
||||||
|
validateSelectionOptions(entry.options, path);
|
||||||
|
if (typeof entry.allowMultiple !== 'boolean' && entry.allowMultiple) {
|
||||||
|
throw new Error(`[settings] "${path}.allowMultiple" must be a boolean`);
|
||||||
|
}
|
||||||
|
};
|
||||||
if (entry.default !== undefined) {
|
if (entry.default !== undefined) {
|
||||||
if (entry.type === 'bool' && typeof entry.default !== 'boolean') {
|
if (entry.type === 'bool' && typeof entry.default !== 'boolean') {
|
||||||
throw new Error(`[settings] "${path}.default" must be a boolean`);
|
throw new Error(`[settings] "${path}.default" must be a boolean`);
|
||||||
@@ -67,12 +73,6 @@ export const validateEntry = function validateEntry (entry, path) {
|
|||||||
throw new Error(`[settings] "${path}.default" must be a string`);
|
throw new Error(`[settings] "${path}.default" must be a string`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (entry.type === 'selection') {
|
|
||||||
validateSelectionOptions(entry.options, path);
|
|
||||||
if (typeof entry.allowMultiple !== 'boolean' && entry.allowMultiple) {
|
|
||||||
throw new Error(`[settings] "${path}.allowMultiple" must be a boolean`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user