chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -27,9 +27,7 @@ type DiscordPermissionsAuditSummary = {
|
||||
}>;
|
||||
};
|
||||
|
||||
function readDiscordAccountStatus(
|
||||
value: ChannelAccountSnapshot,
|
||||
): DiscordAccountStatus | null {
|
||||
function readDiscordAccountStatus(value: ChannelAccountSnapshot): DiscordAccountStatus | null {
|
||||
if (!isRecord(value)) return null;
|
||||
return {
|
||||
accountId: value.accountId,
|
||||
@@ -40,9 +38,7 @@ function readDiscordAccountStatus(
|
||||
};
|
||||
}
|
||||
|
||||
function readDiscordApplicationSummary(
|
||||
value: unknown,
|
||||
): DiscordApplicationSummary {
|
||||
function readDiscordApplicationSummary(value: unknown): DiscordApplicationSummary {
|
||||
if (!isRecord(value)) return {};
|
||||
const intentsRaw = value.intents;
|
||||
if (!isRecord(intentsRaw)) return {};
|
||||
@@ -58,13 +54,10 @@ function readDiscordApplicationSummary(
|
||||
};
|
||||
}
|
||||
|
||||
function readDiscordPermissionsAuditSummary(
|
||||
value: unknown,
|
||||
): DiscordPermissionsAuditSummary {
|
||||
function readDiscordPermissionsAuditSummary(value: unknown): DiscordPermissionsAuditSummary {
|
||||
if (!isRecord(value)) return {};
|
||||
const unresolvedChannels =
|
||||
typeof value.unresolvedChannels === "number" &&
|
||||
Number.isFinite(value.unresolvedChannels)
|
||||
typeof value.unresolvedChannels === "number" && Number.isFinite(value.unresolvedChannels)
|
||||
? value.unresolvedChannels
|
||||
: undefined;
|
||||
const channelsRaw = value.channels;
|
||||
@@ -110,8 +103,7 @@ export function collectDiscordStatusIssues(
|
||||
channel: "discord",
|
||||
accountId,
|
||||
kind: "intent",
|
||||
message:
|
||||
"Message Content Intent is disabled. Bot may not see normal channel messages.",
|
||||
message: "Message Content Intent is disabled. Bot may not see normal channel messages.",
|
||||
fix: "Enable Message Content Intent in Discord Dev Portal → Bot → Privileged Gateway Intents, or require mention-only operation.",
|
||||
});
|
||||
}
|
||||
@@ -128,9 +120,7 @@ export function collectDiscordStatusIssues(
|
||||
}
|
||||
for (const channel of audit.channels ?? []) {
|
||||
if (channel.ok === true) continue;
|
||||
const missing = channel.missing?.length
|
||||
? ` missing ${channel.missing.join(", ")}`
|
||||
: "";
|
||||
const missing = channel.missing?.length ? ` missing ${channel.missing.join(", ")}` : "";
|
||||
const error = channel.error ? `: ${channel.error}` : "";
|
||||
issues.push({
|
||||
channel: "discord",
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
export function asString(value: unknown): string | undefined {
|
||||
return typeof value === "string" && value.trim().length > 0
|
||||
? value.trim()
|
||||
: undefined;
|
||||
return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
|
||||
}
|
||||
|
||||
export function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
|
||||
@@ -20,9 +20,7 @@ type TelegramGroupMembershipAuditSummary = {
|
||||
}>;
|
||||
};
|
||||
|
||||
function readTelegramAccountStatus(
|
||||
value: ChannelAccountSnapshot,
|
||||
): TelegramAccountStatus | null {
|
||||
function readTelegramAccountStatus(value: ChannelAccountSnapshot): TelegramAccountStatus | null {
|
||||
if (!isRecord(value)) return null;
|
||||
return {
|
||||
accountId: value.accountId,
|
||||
@@ -38,8 +36,7 @@ function readTelegramGroupMembershipAuditSummary(
|
||||
): TelegramGroupMembershipAuditSummary {
|
||||
if (!isRecord(value)) return {};
|
||||
const unresolvedGroups =
|
||||
typeof value.unresolvedGroups === "number" &&
|
||||
Number.isFinite(value.unresolvedGroups)
|
||||
typeof value.unresolvedGroups === "number" && Number.isFinite(value.unresolvedGroups)
|
||||
? value.unresolvedGroups
|
||||
: undefined;
|
||||
const hasWildcardUnmentionedGroups =
|
||||
|
||||
@@ -11,9 +11,7 @@ type WhatsAppAccountStatus = {
|
||||
lastError?: unknown;
|
||||
};
|
||||
|
||||
function readWhatsAppAccountStatus(
|
||||
value: ChannelAccountSnapshot,
|
||||
): WhatsAppAccountStatus | null {
|
||||
function readWhatsAppAccountStatus(value: ChannelAccountSnapshot): WhatsAppAccountStatus | null {
|
||||
if (!isRecord(value)) return null;
|
||||
return {
|
||||
accountId: value.accountId,
|
||||
@@ -40,9 +38,7 @@ export function collectWhatsAppStatusIssues(
|
||||
const running = account.running === true;
|
||||
const connected = account.connected === true;
|
||||
const reconnectAttempts =
|
||||
typeof account.reconnectAttempts === "number"
|
||||
? account.reconnectAttempts
|
||||
: null;
|
||||
typeof account.reconnectAttempts === "number" ? account.reconnectAttempts : null;
|
||||
const lastError = asString(account.lastError);
|
||||
|
||||
if (!linked) {
|
||||
|
||||
Reference in New Issue
Block a user