feat(settings): default allowMultiple to false if not specified

This commit is contained in:
2026-05-26 14:50:23 +02:00
parent 035aa1aa77
commit 4ef6008976
@@ -57,21 +57,23 @@ function validateEntry(entry, path) {
assertString(entry.name, `${path}.name`); assertString(entry.name, `${path}.name`);
assertString(entry.i18n, `${path}.i18n`); assertString(entry.i18n, `${path}.i18n`);
if (entry.default !== undefined) { if (entry.default === undefined) {
if (entry.type === 'bool' && typeof entry.default !== 'boolean') { throw new Error(`[settings] "${path}.default" is required`);
throw new Error(`[settings] "${path}.default" must be a boolean`); }
}
if (entry.type === 'number' && typeof entry.default !== 'number') { if (entry.type === 'bool' && typeof entry.default !== 'boolean') {
throw new Error(`[settings] "${path}.default" must be a number`); throw new Error(`[settings] "${path}.default" must be a boolean`);
} }
if (entry.type === 'string' && typeof entry.default !== 'string') { if (entry.type === 'number' && typeof entry.default !== 'number') {
throw new Error(`[settings] "${path}.default" must be a string`); throw new Error(`[settings] "${path}.default" must be a number`);
} }
if (entry.type === 'selection') { if (entry.type === 'string' && typeof entry.default !== 'string') {
validateSelectionOptions(entry.options, path); throw new Error(`[settings] "${path}.default" must be a string`);
if (typeof entry.allowMultiple !== 'boolean') { }
throw new Error(`[settings] "${path}.allowMultiple" must be a boolean`); if (entry.type === 'selection') {
} validateSelectionOptions(entry.options, path);
if (typeof entry.allowMultiple !== 'boolean') {
throw new Error(`[settings] "${path}.allowMultiple" must be a boolean`);
} }
} }
} }