chore: migrate to oxlint and oxfmt

Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
Peter Steinberger
2026-01-14 14:31:43 +00:00
parent 912ebffc63
commit c379191f80
1480 changed files with 28608 additions and 43547 deletions

View File

@@ -1,8 +1,5 @@
import { resolveChannelDefaultAccountId } from "../channels/plugins/helpers.js";
import {
getChannelPlugin,
listChannelPlugins,
} from "../channels/plugins/index.js";
import { getChannelPlugin, listChannelPlugins } from "../channels/plugins/index.js";
import type { ChannelAccountSnapshot } from "../channels/plugins/types.js";
import { withProgress } from "../cli/progress.js";
import { loadConfig } from "../config/config.js";
@@ -55,25 +52,20 @@ const isAccountEnabled = (account: unknown): boolean => {
};
const asRecord = (value: unknown): Record<string, unknown> | null =>
value && typeof value === "object"
? (value as Record<string, unknown>)
: null;
value && typeof value === "object" ? (value as Record<string, unknown>) : null;
const formatProbeLine = (probe: unknown): string | null => {
const record = asRecord(probe);
if (!record) return null;
const ok = typeof record.ok === "boolean" ? record.ok : undefined;
if (ok === undefined) return null;
const elapsedMs =
typeof record.elapsedMs === "number" ? record.elapsedMs : null;
const elapsedMs = typeof record.elapsedMs === "number" ? record.elapsedMs : null;
const status = typeof record.status === "number" ? record.status : null;
const error = typeof record.error === "string" ? record.error : null;
const bot = asRecord(record.bot);
const botUsername =
bot && typeof bot.username === "string" ? bot.username : null;
const botUsername = bot && typeof bot.username === "string" ? bot.username : null;
const webhook = asRecord(record.webhook);
const webhookUrl =
webhook && typeof webhook.url === "string" ? webhook.url : null;
const webhookUrl = webhook && typeof webhook.url === "string" ? webhook.url : null;
if (ok) {
let label = "ok";
@@ -90,29 +82,20 @@ const formatProbeLine = (probe: unknown): string | null => {
export const formatHealthChannelLines = (summary: HealthSummary): string[] => {
const channels = summary.channels ?? {};
const channelOrder =
summary.channelOrder?.length > 0
? summary.channelOrder
: Object.keys(channels);
summary.channelOrder?.length > 0 ? summary.channelOrder : Object.keys(channels);
const lines: string[] = [];
for (const channelId of channelOrder) {
const channelSummary = channels[channelId];
if (!channelSummary) continue;
const plugin = getChannelPlugin(channelId as never);
const label =
summary.channelLabels?.[channelId] ?? plugin?.meta.label ?? channelId;
const linked =
typeof channelSummary.linked === "boolean" ? channelSummary.linked : null;
const label = summary.channelLabels?.[channelId] ?? plugin?.meta.label ?? channelId;
const linked = typeof channelSummary.linked === "boolean" ? channelSummary.linked : null;
if (linked !== null) {
if (linked) {
const authAgeMs =
typeof channelSummary.authAgeMs === "number"
? channelSummary.authAgeMs
: null;
const authLabel =
authAgeMs != null
? ` (auth age ${Math.round(authAgeMs / 60000)}m)`
: "";
typeof channelSummary.authAgeMs === "number" ? channelSummary.authAgeMs : null;
const authLabel = authAgeMs != null ? ` (auth age ${Math.round(authAgeMs / 60000)}m)` : "";
lines.push(`${label}: linked${authLabel}`);
} else {
lines.push(`${label}: not linked`);
@@ -121,9 +104,7 @@ export const formatHealthChannelLines = (summary: HealthSummary): string[] => {
}
const configured =
typeof channelSummary.configured === "boolean"
? channelSummary.configured
: null;
typeof channelSummary.configured === "boolean" ? channelSummary.configured : null;
if (configured === false) {
lines.push(`${label}: not configured`);
continue;
@@ -306,9 +287,7 @@ export async function healthCommand(
runtime.log(info(`Heartbeat interval: ${summary.heartbeatSeconds}s`));
runtime.log(
info(
`Session store: ${summary.sessions.path} (${summary.sessions.count} entries)`,
),
info(`Session store: ${summary.sessions.path} (${summary.sessions.count} entries)`),
);
if (summary.sessions.recent.length > 0) {
runtime.log("Recent sessions:");