From 1b59cb3bdf00cea0353956501569a0b2d9f43342 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 5 Apr 2026 13:23:53 +0300 Subject: [PATCH] lint --- .../settings_modal/settings_modal.js | 3 +- src/stores/merged_config.js | 10 +- test/unit/specs/stores/sync_config.spec.js | 96 ++++++++++++++++--- 3 files changed, 84 insertions(+), 25 deletions(-) diff --git a/src/components/settings_modal/settings_modal.js b/src/components/settings_modal/settings_modal.js index 782a005e1..c78659e4e 100644 --- a/src/components/settings_modal/settings_modal.js +++ b/src/components/settings_modal/settings_modal.js @@ -17,6 +17,7 @@ import { LOCAL_ONLY_KEYS, ROOT_CONFIG, ROOT_CONFIG_DEFINITIONS, + validateSetting, } from 'src/modules/default_config_state.js' import { newExporter, @@ -164,7 +165,7 @@ const SettingsModal = { }) }) } else { - const definition = ROOT_CONFIG_DEFINITIONS[entry] + const definition = ROOT_CONFIG_DEFINITIONS[path] const finalValue = validateSetting({ path: `simple.${path}`, diff --git a/src/stores/merged_config.js b/src/stores/merged_config.js index 3e218c942..334db6c4f 100644 --- a/src/stores/merged_config.js +++ b/src/stores/merged_config.js @@ -5,18 +5,10 @@ import { useLocalConfigStore } from 'src/stores/local_config.js' import { useSyncConfigStore } from 'src/stores/sync_config.js' import { - INSTANCE_DEFAULT_CONFIG, - LOCAL_DEFAULT_CONFIG, LOCAL_ONLY_KEYS, - THEME_CONFIG, + ROOT_CONFIG, } from 'src/modules/default_config_state.js' -const ROOT_CONFIG = { - ...INSTANCE_DEFAULT_CONFIG, - ...LOCAL_DEFAULT_CONFIG, - ...THEME_CONFIG, -} - export const useMergedConfigStore = defineStore('merged_config', { getters: { mergedConfig: () => { diff --git a/test/unit/specs/stores/sync_config.spec.js b/test/unit/specs/stores/sync_config.spec.js index 9a582a193..83324f62b 100644 --- a/test/unit/specs/stores/sync_config.spec.js +++ b/test/unit/specs/stores/sync_config.spec.js @@ -241,7 +241,9 @@ describe('The SyncConfig store', () => { store.setPreference({ path: 'simple.fontInput.family', value: 'test' }) store.unsetPreference({ path: 'simple.fontInput.family' }) store.updateCache(store, { username: 'test' }) - expect(store.prefsStorage.simple.fontInput).to.not.have.property('family') + expect(store.prefsStorage.simple.fontInput).to.not.have.property( + 'family', + ) expect(store.prefsStorage._journal.length).to.eql(1) }) @@ -395,7 +397,12 @@ describe('The SyncConfig store', () => { { simple: { theme: '1', style: '0', hideISP: true }, _journal: [ - { path: 'simple.style', operation: 'set', args: ['0'], timestamp: 2 }, + { + path: 'simple.style', + operation: 'set', + args: ['0'], + timestamp: 2, + }, { path: 'simple.hideISP', operation: 'set', @@ -408,17 +415,42 @@ describe('The SyncConfig store', () => { { simple: { theme: '1', style: '1', hideISP: false }, _journal: [ - { path: 'simple.theme', operation: 'set', args: ['1'], timestamp: 1 }, - { path: 'simple.style', operation: 'set', args: ['1'], timestamp: 3 }, + { + path: 'simple.theme', + operation: 'set', + args: ['1'], + timestamp: 1, + }, + { + path: 'simple.style', + operation: 'set', + args: ['1'], + timestamp: 3, + }, ], }, ), ).to.eql({ simple: { theme: '1', style: '1', hideISP: true }, _journal: [ - { path: 'simple.theme', operation: 'set', args: ['1'], timestamp: 1 }, - { path: 'simple.style', operation: 'set', args: ['1'], timestamp: 3 }, - { path: 'simple.hideISP', operation: 'set', args: [true], timestamp: 4 }, + { + path: 'simple.theme', + operation: 'set', + args: ['1'], + timestamp: 1, + }, + { + path: 'simple.style', + operation: 'set', + args: ['1'], + timestamp: 3, + }, + { + path: 'simple.hideISP', + operation: 'set', + args: [true], + timestamp: 4, + }, ], }) }) @@ -430,7 +462,12 @@ describe('The SyncConfig store', () => { { simple: { theme: '1', style: '0', hideISP: false }, _journal: [ - { path: 'simple.style', operation: 'set', args: ['0'], timestamp: 2 }, + { + path: 'simple.style', + operation: 'set', + args: ['0'], + timestamp: 2, + }, { path: 'simple.hideISP', operation: 'set', @@ -443,18 +480,42 @@ describe('The SyncConfig store', () => { { simple: { theme: '0', style: '0', hideISP: true }, _journal: [ - { path: 'simple.theme', operation: 'set', args: ['0'], timestamp: 1 }, - { path: 'simple.style', operation: 'set', args: ['0'], timestamp: 3 }, + { + path: 'simple.theme', + operation: 'set', + args: ['0'], + timestamp: 1, + }, + { + path: 'simple.style', + operation: 'set', + args: ['0'], + timestamp: 3, + }, ], }, ), ).to.eql({ - simple: { a: 0, b: 0, c: false }, simple: { theme: '0', style: '0', hideISP: false }, _journal: [ - { path: 'simple.theme', operation: 'set', args: ['0'], timestamp: 1 }, - { path: 'simple.style', operation: 'set', args: ['0'], timestamp: 3 }, - { path: 'simple.hideISP', operation: 'set', args: [false], timestamp: 4 }, + { + path: 'simple.theme', + operation: 'set', + args: ['0'], + timestamp: 1, + }, + { + path: 'simple.style', + operation: 'set', + args: ['0'], + timestamp: 3, + }, + { + path: 'simple.hideISP', + operation: 'set', + args: [false], + timestamp: 4, + }, ], }) }) @@ -490,7 +551,12 @@ describe('The SyncConfig store', () => { ).to.eql({ simple: { theme: 'bar' }, _journal: [ - { path: 'simple.theme', operation: 'set', args: ['bar'], timestamp: 4 }, + { + path: 'simple.theme', + operation: 'set', + args: ['bar'], + timestamp: 4, + }, ], }) })