diff --git a/packages/shared/preferences.ts b/packages/shared/preferences.ts index bd318d8fdd..3da0ea4b59 100644 --- a/packages/shared/preferences.ts +++ b/packages/shared/preferences.ts @@ -1,35 +1,35 @@ -export interface Preferences { +/** + * we should use sorted object keys + * use `eslint --fix` to auto sort keys + */ + +/* eslint @typescript-eslint/member-ordering: ["error", { + "interfaces": { "order": "alphabetically" }, + "typeLiterals": { "order": "alphabetically" } +}] */ +export interface PreferencesType { default: { - test1: string - test2: number - test3: boolean - test4: string[] - test5: { + 'app.test5': { content1: string content2: number } - } - user: { - test1: string - test2: number - test3: boolean + 'sys.a.test3': boolean + 'sys.a.test4': string[] + 'ui.a.test1': string + 'ui.b.test2': number } } -export const defaultPreferences: Preferences = { +/* eslint sort-keys: ["error", "asc", {"caseSensitive": true, "natural": false}] */ +export const defaultPreferences: PreferencesType = { default: { - test1: 'test1', - test2: 1, - test3: true, - test4: ['test4-1', 'test4-2'], - test5: { + 'app.test5': { content1: 'test5-1', content2: 2 - } - }, - user: { - test1: 'test1', - test2: 1, - test3: false + }, + 'sys.a.test3': true, + 'sys.a.test4': ['test4-1', 'test4-2'], + 'ui.a.test1': 'test1', + 'ui.b.test2': 1 } } diff --git a/src/main/db/schemas/preference.ts b/src/main/db/schemas/preference.ts index 1a02e8e99d..bb1b4e469c 100644 --- a/src/main/db/schemas/preference.ts +++ b/src/main/db/schemas/preference.ts @@ -5,7 +5,7 @@ import { crudTimestamps } from './columnHelpers' export const preferenceTable = sqliteTable( 'preference', { - scope: text().notNull(), + scope: text().notNull(), // scope is reserved for future use, now only 'default' is supported key: text().notNull(), value: text({ mode: 'json' }), ...crudTimestamps