From d6fb8e9429fdd105da0d477be7eac9686de1d785 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sat, 1 Apr 2023 21:10:31 -0700 Subject: [PATCH] chore: :art: format --- packages/backend/src/models/repositories/note.ts | 9 +++------ .../backend/src/server/api/stream/channels/channel.ts | 3 +-- .../backend/src/server/api/stream/channels/messaging.ts | 3 +-- packages/backend/src/server/web/cli.js | 6 +++--- packages/backend/src/services/chart/core.ts | 8 ++++++-- packages/client/src/scripts/helpMenu.ts | 2 +- packages/client/src/scripts/sound.ts | 3 ++- packages/client/src/types/menu.ts | 9 ++++++++- 8 files changed, 25 insertions(+), 18 deletions(-) diff --git a/packages/backend/src/models/repositories/note.ts b/packages/backend/src/models/repositories/note.ts index ce589e173..b99ce1635 100644 --- a/packages/backend/src/models/repositories/note.ts +++ b/packages/backend/src/models/repositories/note.ts @@ -266,10 +266,8 @@ export const NoteRepository = db.getRepository(Note).extend({ if (packed.user.isCat && packed.text) { const tokens = packed.text ? mfm.parse(packed.text) : []; function nyaizeNode(node: mfm.MfmNode) { - if (node.type === "quote") - return; - if (node.type === "text") - node.props.text = nyaize(node.props.text); + if (node.type === "quote") return; + if (node.type === "text") node.props.text = nyaize(node.props.text); if (node.children) { for (const child of node.children) { @@ -278,8 +276,7 @@ export const NoteRepository = db.getRepository(Note).extend({ } } - for (const node of tokens) - nyaizeNode(node); + for (const node of tokens) nyaizeNode(node); packed.text = mfm.toString(tokens); } diff --git a/packages/backend/src/server/api/stream/channels/channel.ts b/packages/backend/src/server/api/stream/channels/channel.ts index 5a0f70981..d2a2269a4 100644 --- a/packages/backend/src/server/api/stream/channels/channel.ts +++ b/packages/backend/src/server/api/stream/channels/channel.ts @@ -57,8 +57,7 @@ export default class extends Channel { // Remove not typing users for (const [userId, date] of Object.entries(this.typers)) { - if (now.getTime() - date.getTime() > 5000) - this.typers.delete(userId); + if (now.getTime() - date.getTime() > 5000) this.typers.delete(userId); } const userIds = Array.from(this.typers.keys()); diff --git a/packages/backend/src/server/api/stream/channels/messaging.ts b/packages/backend/src/server/api/stream/channels/messaging.ts index f20b1ead1..0622bd464 100644 --- a/packages/backend/src/server/api/stream/channels/messaging.ts +++ b/packages/backend/src/server/api/stream/channels/messaging.ts @@ -108,8 +108,7 @@ export default class extends Channel { // Remove not typing users for (const [userId, date] of this.typers.entries()) { - if (now.getTime() - date.getTime() > 5000) - this.typers.delete(userId); + if (now.getTime() - date.getTime() > 5000) this.typers.delete(userId); } const userIds = Array.from(this.typers.keys()); diff --git a/packages/backend/src/server/web/cli.js b/packages/backend/src/server/web/cli.js index ca1c23375..85a61a244 100644 --- a/packages/backend/src/server/web/cli.js +++ b/packages/backend/src/server/web/cli.js @@ -47,10 +47,10 @@ window.onload = async () => { const el = document.createElement("div"); const header = document.createElement("header"); const name = document.createElement("p"); - const avatar = document.createElement("img") + const avatar = document.createElement("img"); name.textContent = `${note.user.name} @${note.user.username}`; avatar.src = note.user.avatarUrl; - avatar.style = 'height: 40px' + avatar.style = "height: 40px"; const text = document.createElement("div"); text.textContent = `${note.text}`; el.appendChild(header); @@ -63,7 +63,7 @@ window.onload = async () => { for (const file of note.files) { const img = document.createElement("img"); img.src = file.properties.thumbnailUrl; - el.appendChild(img) + el.appendChild(img); } } tl.appendChild(el); diff --git a/packages/backend/src/services/chart/core.ts b/packages/backend/src/services/chart/core.ts index 207d8a93c..36fe37326 100644 --- a/packages/backend/src/services/chart/core.ts +++ b/packages/backend/src/services/chart/core.ts @@ -556,7 +556,11 @@ export default abstract class Chart { // bake unique count for (const [k, v] of Object.entries(finalDiffs)) { - if (this.schema[k].uniqueIncrement && Array.isArray(v) && v.length > 0) { + if ( + this.schema[k].uniqueIncrement && + Array.isArray(v) && + v.length > 0 + ) { const name = (columnPrefix + k.replaceAll(".", columnDot)) as keyof Columns; const tempColumnName = (uniqueTempColumnPrefix + @@ -660,7 +664,7 @@ export default abstract class Chart { const startTime = Date.now(); await Promise.all( - groups.map((group) => + groups.map((group) => limit(() => Promise.all([ this.claimCurrentLog(group, "hour"), diff --git a/packages/client/src/scripts/helpMenu.ts b/packages/client/src/scripts/helpMenu.ts index 56d3658e2..aca9d6e70 100644 --- a/packages/client/src/scripts/helpMenu.ts +++ b/packages/client/src/scripts/helpMenu.ts @@ -67,6 +67,6 @@ export function openHelpMenu_(ev: MouseEvent) { ], }, ], - ev.currentTarget ?? ev.target + ev.currentTarget ?? ev.target, ); } diff --git a/packages/client/src/scripts/sound.ts b/packages/client/src/scripts/sound.ts index 07d543a33..84388b81c 100644 --- a/packages/client/src/scripts/sound.ts +++ b/packages/client/src/scripts/sound.ts @@ -30,7 +30,8 @@ export function play(type: string) { export function playFile(file: string, volume: number) { const masterVolume = ColdDeviceStorage.get("sound_masterVolume"); - if (masterVolume === 0 || volume === 0 || file.toLowerCase().includes("none")) return; + if (masterVolume === 0 || volume === 0 || file.toLowerCase().includes("none")) + return; const audio = setVolume(getAudio(file), volume); audio.play(); diff --git a/packages/client/src/types/menu.ts b/packages/client/src/types/menu.ts index a7ce81c71..4a0a9061e 100644 --- a/packages/client/src/types/menu.ts +++ b/packages/client/src/types/menu.ts @@ -90,7 +90,14 @@ type OuterMenuItem = | MenuButtonMultipleIcons | MenuParent; type OuterPromiseMenuItem = Promise< - MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton | MenuButtonMultipleIcons | MenuParent + | MenuLabel + | MenuLink + | MenuA + | MenuUser + | MenuSwitch + | MenuButton + | MenuButtonMultipleIcons + | MenuParent >; export type MenuItem = OuterMenuItem | OuterPromiseMenuItem; export type InnerMenuItem =