From 4ef6008976e4ef17589985b07d752595fb5d9718 Mon Sep 17 00:00:00 2001 From: "johannes.vos" Date: Tue, 26 May 2026 14:50:23 +0200 Subject: [PATCH] feat(settings): default allowMultiple to false if not specified --- .../settings/utils/settingsValidator.js | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/features/settings/utils/settingsValidator.js b/src/features/settings/utils/settingsValidator.js index 005024a..c699985 100644 --- a/src/features/settings/utils/settingsValidator.js +++ b/src/features/settings/utils/settingsValidator.js @@ -57,21 +57,23 @@ function validateEntry(entry, path) { assertString(entry.name, `${path}.name`); assertString(entry.i18n, `${path}.i18n`); - if (entry.default !== undefined) { - if (entry.type === 'bool' && typeof entry.default !== 'boolean') { - throw new Error(`[settings] "${path}.default" must be a boolean`); - } - if (entry.type === 'number' && typeof entry.default !== 'number') { - throw new Error(`[settings] "${path}.default" must be a number`); - } - if (entry.type === 'string' && typeof entry.default !== 'string') { - throw new Error(`[settings] "${path}.default" must be a string`); - } - if (entry.type === 'selection') { - validateSelectionOptions(entry.options, path); - if (typeof entry.allowMultiple !== 'boolean') { - throw new Error(`[settings] "${path}.allowMultiple" must be a boolean`); - } + if (entry.default === undefined) { + throw new Error(`[settings] "${path}.default" is required`); + } + + if (entry.type === 'bool' && typeof entry.default !== 'boolean') { + throw new Error(`[settings] "${path}.default" must be a boolean`); + } + if (entry.type === 'number' && typeof entry.default !== 'number') { + throw new Error(`[settings] "${path}.default" must be a number`); + } + if (entry.type === 'string' && typeof entry.default !== 'string') { + throw new Error(`[settings] "${path}.default" must be a string`); + } + if (entry.type === 'selection') { + validateSelectionOptions(entry.options, path); + if (typeof entry.allowMultiple !== 'boolean') { + throw new Error(`[settings] "${path}.allowMultiple" must be a boolean`); } } }