style: satisfy cumulative biome checks

This commit is contained in:
Simo committed 2026-08-30 19:38:36 +02:00
1 parent cb77b2d3b9
commit b9c47aa89a
10 files changed
+34 -37

No files matched your search

+1 -1
View File
@@ -57,7 +57,7 @@ export async function updateAd(formData: FormData): Promise<void> {
id: Number(raw), id: Number(raw),
error: result.error.messageKey, error: result.error.messageKey,
}); });
revalidatePath("/admin/ads/" + raw); revalidatePath(`/admin/ads/${raw}`);
return; return;
} }
redirect("/admin/ads"); redirect("/admin/ads");
+1 -1
View File
@@ -54,7 +54,7 @@ export async function updateArticle(formData: FormData): Promise<void> {
{ action: "update", id, ...articleInput(formData) }, { action: "update", id, ...articleInput(formData) },
); );
if (!result.ok) redirect("/admin/articles?error=Update failed"); if (!result.ok) redirect("/admin/articles?error=Update failed");
revalidatePath("/admin/articles/" + id); revalidatePath(`/admin/articles/${id}`);
redirect("/admin/articles"); redirect("/admin/articles");
} }
+1 -1
View File
@@ -60,7 +60,7 @@ export async function updateHelpQuestion(formData: FormData): Promise<void> {
{ action: "update", id, ...input }, { action: "update", id, ...input },
); );
if (!result.ok) { if (!result.ok) {
revalidatePath("/admin/help-questions/" + id); revalidatePath(`/admin/help-questions/${id}`);
return; return;
} }
redirect("/admin/help-questions"); redirect("/admin/help-questions");
+2 -2
View File
@@ -49,7 +49,7 @@ export async function applyPreset(formData: FormData): Promise<void> {
if (result.ok) revalidatePath("/", "layout"); if (result.ok) revalidatePath("/", "layout");
redirect( redirect(
result.ok result.ok
? "/admin/theme?preset=" + encodeURIComponent(name) ? `/admin/theme?preset=${encodeURIComponent(name)}`
: "/admin/theme", : "/admin/theme",
); );
} }
@@ -80,7 +80,7 @@ export async function applyCustomTheme(formData: FormData): Promise<void> {
: ""; : "";
redirect( redirect(
result.ok result.ok
? "/admin/theme?theme=" + encodeURIComponent(name) ? `/admin/theme?theme=${encodeURIComponent(name)}`
: "/admin/theme", : "/admin/theme",
); );
} }
@@ -62,7 +62,7 @@ export async function loadContentInboxItems(
items.push({ items.push({
sourceId, sourceId,
itemId: item.id, itemId: item.id,
deduplicationKey: sourceId + ":" + routeId + ":" + item.id, deduplicationKey: `${sourceId}:${routeId}:${item.id}`,
domain: "content", domain: "content",
capability: anyCapability(permission), capability: anyCapability(permission),
severity: severity:
@@ -283,7 +283,7 @@ async function mediaLibrary(
.map(({ name, metadata }) => ({ .map(({ name, metadata }) => ({
id: name, id: name,
title: name, title: name,
description: String(metadata.size) + " bytes", description: `${String(metadata.size)} bytes`,
status: "stored", status: "stored",
updatedAt: metadata.mtime.toISOString(), updatedAt: metadata.mtime.toISOString(),
href: "/ase/content/media/library", href: "/ase/content/media/library",
@@ -367,7 +367,7 @@ async function localizationFiles(
{ {
id: "cms", id: "cms",
title: "CMS translations", title: "CMS translations",
status: String(locales.length) + " locales", status: `${String(locales.length)} locales`,
href: "/ase/content/localization/cms", href: "/ase/content/localization/cms",
}, },
{ {
@@ -41,7 +41,7 @@ export async function loadContentSearchCandidates(
for (const item of result.data.items) { for (const item of result.data.items) {
if (!item.href) continue; if (!item.href) continue;
candidates.push({ candidates.push({
id: routeId + ":" + item.id, id: `${routeId}:${item.id}`,
title: item.title, title: item.title,
description: item.description ?? item.status, description: item.description ?? item.status,
href: item.href, href: item.href,
@@ -155,7 +155,7 @@ async function uniqueSlug(
.where(eq(WebsiteArticles.slug, candidate)) .where(eq(WebsiteArticles.slug, candidate))
.limit(1); .limit(1);
if (!existing) return candidate; if (!existing) return candidate;
candidate = base + "-" + suffix; candidate = `${base}-${suffix}`;
suffix += 1; suffix += 1;
} }
} }
@@ -261,7 +261,7 @@ async function adChange(
await activity( await activity(
context, context,
"ad_create", "ad_create",
"Created advertisement #" + id + " (" + image + ")", `Created advertisement #${id} (${image})`,
"website_ad", "website_ad",
Number(id), Number(id),
); );
@@ -279,7 +279,7 @@ async function adChange(
await activity( await activity(
context, context,
"ad_delete", "ad_delete",
"Deleted advertisement #" + id, `Deleted advertisement #${id}`,
"website_ad", "website_ad",
Number(id), Number(id),
); );
@@ -297,7 +297,7 @@ async function adChange(
await activity( await activity(
context, context,
"ad_update", "ad_update",
"Updated advertisement #" + id + " (" + image + ")", `Updated advertisement #${id} (${image})`,
"website_ad", "website_ad",
Number(id), Number(id),
); );
@@ -661,7 +661,7 @@ async function tagChange(
await activity( await activity(
context, context,
"tag_create", "tag_create",
"Created tag " + name + " (#" + id + ")", `Created tag ${name} (#${id})`,
"tag", "tag",
Number(id), Number(id),
); );
@@ -678,7 +678,7 @@ async function tagChange(
await activity( await activity(
context, context,
"tag_delete", "tag_delete",
"Deleted tag #" + id, `Deleted tag #${id}`,
"tag", "tag",
Number(id), Number(id),
); );
@@ -696,7 +696,7 @@ async function tagChange(
await activity( await activity(
context, context,
"tag_update", "tag_update",
"Updated tag #" + id + (values.name ? " to " + values.name : ""), `Updated tag #${id}${values.name ? ` to ${values.name}` : ""}`,
"tag", "tag",
Number(id), Number(id),
); );
@@ -838,7 +838,7 @@ async function helpQuestionChange(
await activity( await activity(
context, context,
"help_delete", "help_delete",
"Deleted help-center entry #" + id, `Deleted help-center entry #${id}`,
"help_center_category", "help_center_category",
Number(id), Number(id),
); );
@@ -864,7 +864,7 @@ async function helpQuestionChange(
await activity( await activity(
context, context,
"help_create", "help_create",
"Created help-center entry #" + id + " (" + createValues.name + ")", `Created help-center entry #${id} (${createValues.name})`,
"help_center_category", "help_center_category",
Number(id), Number(id),
); );
@@ -906,7 +906,7 @@ async function helpQuestionChange(
"help_update", "help_update",
"Updated help-center entry #" + "Updated help-center entry #" +
id + id +
(values.name ? " (" + values.name + ")" : ""), (values.name ? ` (${values.name})` : ""),
"help_center_category", "help_center_category",
Number(id), Number(id),
); );
@@ -933,7 +933,7 @@ async function writeableBoxChange(
await activity( await activity(
context, context,
"writeable_box_delete", "writeable_box_delete",
"Deleted writeable box #" + id, `Deleted writeable box #${id}`,
"writeable_box", "writeable_box",
Number(id), Number(id),
); );
@@ -949,7 +949,7 @@ async function writeableBoxChange(
await activity( await activity(
context, context,
"writeable_box_toggle", "writeable_box_toggle",
(isActive ? "Activated" : "Hid") + " writeable box #" + id, `${isActive ? "Activated" : "Hid"} writeable box #${id}`,
"writeable_box", "writeable_box",
Number(id), Number(id),
); );
@@ -979,7 +979,7 @@ async function writeableBoxChange(
await activity( await activity(
context, context,
"writeable_box_create", "writeable_box_create",
"Created writeable box " + createValues.title + " (#" + id + ")", `Created writeable box ${createValues.title} (#${id})`,
"writeable_box", "writeable_box",
Number(id), Number(id),
); );
@@ -1007,9 +1007,7 @@ async function writeableBoxChange(
await activity( await activity(
context, context,
"writeable_box_update", "writeable_box_update",
"Updated writeable box #" + "Updated writeable box #" + id + (values.title ? ` (${values.title})` : ""),
id +
(values.title ? " (" + values.title + ")" : ""),
"writeable_box", "writeable_box",
Number(id), Number(id),
); );
@@ -239,15 +239,14 @@ async function mediaUpload(input: unknown): Promise<ContentMutationSnapshot> {
MEDIA_TYPES, MEDIA_TYPES,
); );
await mkdir(MEDIA_ROOT, { recursive: true }); await mkdir(MEDIA_ROOT, { recursive: true });
const name = const name = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}.${extension}`;
Date.now() + "-" + Math.random().toString(36).slice(2, 8) + "." + extension;
const filePath = resolveMediaPath(name); const filePath = resolveMediaPath(name);
if (!filePath.startsWith(MEDIA_ROOT + path.sep)) throw validation(); if (!filePath.startsWith(MEDIA_ROOT + path.sep)) throw validation();
await writeFile(filePath, bytes); await writeFile(filePath, bytes);
return { return {
before: null, before: null,
after: { name, size: file.size, type }, after: { name, size: file.size, type },
output: { name, url: "/api/media/" + name }, output: { name, url: `/api/media/${name}` },
}; };
} }
@@ -291,7 +290,7 @@ async function photoDelete(
await logStaffActivity({ await logStaffActivity({
staffId: context.capability.actor.id, staffId: context.capability.actor.id,
action: "photo_delete", action: "photo_delete",
description: "Deleted camera photo #" + id, description: `Deleted camera photo #${id}`,
targetType: "camera_web", targetType: "camera_web",
targetId: id, targetId: id,
}); });
@@ -459,7 +458,7 @@ async function themeApplyPreset(
await logStaffActivity({ await logStaffActivity({
staffId: context.capability.actor.id, staffId: context.capability.actor.id,
action: "theme_preset", action: "theme_preset",
description: "Applied theme preset " + name, description: `Applied theme preset ${name}`,
}); });
} catch { } catch {
throw new ContentCommittedExternalFailure(snapshot); throw new ContentCommittedExternalFailure(snapshot);
@@ -504,7 +503,7 @@ async function themeCustomChange(
await logStaffActivity({ await logStaffActivity({
staffId: context.capability.actor.id, staffId: context.capability.actor.id,
action: "theme_preset", action: "theme_preset",
description: "Saved custom theme " + theme.name, description: `Saved custom theme ${theme.name}`,
}); });
return { return {
before: id ? { id } : null, before: id ? { id } : null,
@@ -547,7 +546,7 @@ async function themeApplyCustom(
await logStaffActivity({ await logStaffActivity({
staffId: context.capability.actor.id, staffId: context.capability.actor.id,
action: "theme_preset", action: "theme_preset",
description: "Applied custom theme " + theme.name, description: `Applied custom theme ${theme.name}`,
}); });
} catch { } catch {
throw new ContentCommittedExternalFailure(snapshot); throw new ContentCommittedExternalFailure(snapshot);
@@ -580,13 +579,13 @@ async function faviconSave(input: unknown): Promise<ContentMutationSnapshot> {
FAVICON_TYPES, FAVICON_TYPES,
); );
const directory = resolveMediaPath("favicon"); const directory = resolveMediaPath("favicon");
const filename = "favicon-" + Date.now() + "." + extension; const filename = `favicon-${Date.now()}.${extension}`;
const filePath = path.resolve(directory, filename); const filePath = path.resolve(directory, filename);
if (!filePath.startsWith(directory + path.sep)) throw validation(); if (!filePath.startsWith(directory + path.sep)) throw validation();
const oldUrl = await siteSettings.get("cms_favicon"); const oldUrl = await siteSettings.get("cms_favicon");
await mkdir(directory, { recursive: true }); await mkdir(directory, { recursive: true });
await writeFile(filePath, bytes); await writeFile(filePath, bytes);
const url = "/api/media/favicon/" + filename; const url = `/api/media/favicon/${filename}`;
const snapshot: ContentMutationSnapshot = { const snapshot: ContentMutationSnapshot = {
before: { value: oldUrl ?? null }, before: { value: oldUrl ?? null },
after: { value: url }, after: { value: url },
@@ -654,7 +653,7 @@ async function logoSave(input: unknown): Promise<ContentMutationSnapshot> {
const oldUrl = await siteSettings.get("cms_logo"); const oldUrl = await siteSettings.get("cms_logo");
await mkdir(directory, { recursive: true }); await mkdir(directory, { recursive: true });
await writeFile(filePath, bytes); await writeFile(filePath, bytes);
const url = "/api/media/logo/" + filename; const url = `/api/media/logo/${filename}`;
const snapshot: ContentMutationSnapshot = { const snapshot: ContentMutationSnapshot = {
before: { value: oldUrl ?? null }, before: { value: oldUrl ?? null },
after: { value: url }, after: { value: url },
@@ -694,7 +693,7 @@ async function cmsTranslationSave(
process.cwd(), process.cwd(),
"src", "src",
"messages", "messages",
locale + ".json", `${locale}.json`,
); );
await writeFile(filePath, JSON.stringify(translations, null, 2), "utf-8"); await writeFile(filePath, JSON.stringify(translations, null, 2), "utf-8");
return { return {
@@ -75,7 +75,7 @@ function auditEntry(
): AuditEntry { ): AuditEntry {
return { return {
userId: context.capability.actor.id, userId: context.capability.actor.id,
action: "content." + operation, action: `content.${operation}`,
target: "Content", target: "Content",
correlationId: context.correlationId, correlationId: context.correlationId,
domain: "content", domain: "content",