style: format config settings changes

This commit is contained in:
2026-05-17 02:41:17 -07:00
parent a4314ab5de
commit 79d057a2e8
6 changed files with 10 additions and 20 deletions
+1 -3
View File
@@ -350,9 +350,7 @@ export function applySubtitleDomainConfig(context: ResolveContext): void {
); );
} }
const nPlusOneColor = asColor( const nPlusOneColor = asColor((src.subtitleStyle as { nPlusOneColor?: unknown }).nPlusOneColor);
(src.subtitleStyle as { nPlusOneColor?: unknown }).nPlusOneColor,
);
if (nPlusOneColor !== undefined) { if (nPlusOneColor !== undefined) {
resolved.subtitleStyle.nPlusOneColor = nPlusOneColor; resolved.subtitleStyle.nPlusOneColor = nPlusOneColor;
} else if ((src.subtitleStyle as { nPlusOneColor?: unknown }).nPlusOneColor !== undefined) { } else if ((src.subtitleStyle as { nPlusOneColor?: unknown }).nPlusOneColor !== undefined) {
+1 -2
View File
@@ -199,8 +199,7 @@ test('subtitleStyle nPlusOneColor accepts valid values and warns on invalid', ()
assert.ok( assert.ok(
invalid.warnings.some( invalid.warnings.some(
(warning) => (warning) =>
warning.path === 'subtitleStyle.nPlusOneColor' && warning.path === 'subtitleStyle.nPlusOneColor' && warning.message === 'Expected hex color.',
warning.message === 'Expected hex color.',
), ),
); );
}); });
+1 -7
View File
@@ -80,13 +80,7 @@ const JSON_OBJECT_FIELDS = new Set([
const SECRET_PATHS = new Set(['ai.apiKey', 'jimaku.apiKey', 'anilist.accessToken']); const SECRET_PATHS = new Set(['ai.apiKey', 'jimaku.apiKey', 'anilist.accessToken']);
const COLOR_SUFFIXES = new Set([ const COLOR_SUFFIXES = new Set(['Color', 'color', 'backgroundColor', 'singleColor', 'nPlusOne']);
'Color',
'color',
'backgroundColor',
'singleColor',
'nPlusOne',
]);
const OPTION_BY_PATH = new Map(CONFIG_OPTION_REGISTRY.map((entry) => [entry.path, entry])); const OPTION_BY_PATH = new Map(CONFIG_OPTION_REGISTRY.map((entry) => [entry.path, entry]));
+3 -3
View File
@@ -27,8 +27,8 @@ export function isSecretSnapshotValue(
): value is { configured: boolean } { ): value is { configured: boolean } {
return Boolean( return Boolean(
value && value &&
typeof value === 'object' && typeof value === 'object' &&
'configured' in value && 'configured' in value &&
typeof (value as { configured?: unknown }).configured === 'boolean', typeof (value as { configured?: unknown }).configured === 'boolean',
); );
} }
+3 -1
View File
@@ -221,7 +221,9 @@ function renderField(field: ConfigSettingsField): HTMLElement {
header.append(label, description, createFieldMeta(field)); header.append(label, description, createFieldMeta(field));
const controlWrap = createElement('div', 'field-control'); const controlWrap = createElement('div', 'field-control');
controlWrap.append(renderControl(field, { setFieldError, updateDraft, valueForField, valueForPath })); controlWrap.append(
renderControl(field, { setFieldError, updateDraft, valueForField, valueForPath }),
);
const resetButton = createElement('button', 'reset-button') as HTMLButtonElement; const resetButton = createElement('button', 'reset-button') as HTMLButtonElement;
resetButton.type = 'button'; resetButton.type = 'button';
resetButton.textContent = 'Reset'; resetButton.textContent = 'Reset';
+1 -4
View File
@@ -87,10 +87,7 @@ export interface ConfigSettingsAPI {
openSettingsFile(): Promise<boolean>; openSettingsFile(): Promise<boolean>;
openSettingsWindow(): Promise<boolean>; openSettingsWindow(): Promise<boolean>;
getAnkiDeckNames(draftUrl?: string): Promise<ConfigSettingsAnkiListResult>; getAnkiDeckNames(draftUrl?: string): Promise<ConfigSettingsAnkiListResult>;
getAnkiDeckFieldNames( getAnkiDeckFieldNames(deckName: string, draftUrl?: string): Promise<ConfigSettingsAnkiListResult>;
deckName: string,
draftUrl?: string,
): Promise<ConfigSettingsAnkiListResult>;
getAnkiModelNames(draftUrl?: string): Promise<ConfigSettingsAnkiListResult>; getAnkiModelNames(draftUrl?: string): Promise<ConfigSettingsAnkiListResult>;
getAnkiModelFieldNames( getAnkiModelFieldNames(
modelName: string, modelName: string,