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