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 { chunkText } from "../../auto-reply/chunk.js";
import {
DEFAULT_ACCOUNT_ID,
normalizeAccountId,
} from "../../routing/session-key.js";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../../routing/session-key.js";
import {
listSignalAccountIds,
type ResolvedSignalAccount,
@@ -53,8 +50,7 @@ export const signalPlugin: ChannelPlugin<ResolvedSignalAccount> = {
reload: { configPrefixes: ["channels.signal"] },
config: {
listAccountIds: (cfg) => listSignalAccountIds(cfg),
resolveAccount: (cfg, accountId) =>
resolveSignalAccount({ cfg, accountId }),
resolveAccount: (cfg, accountId) => resolveSignalAccount({ cfg, accountId }),
defaultAccountId: (cfg) => resolveDefaultSignalAccountId(cfg),
setAccountEnabled: ({ cfg, accountId, enabled }) =>
setAccountEnabledInConfigSection({
@@ -69,14 +65,7 @@ export const signalPlugin: ChannelPlugin<ResolvedSignalAccount> = {
cfg,
sectionKey: "signal",
accountId,
clearBaseFields: [
"account",
"httpUrl",
"httpHost",
"httpPort",
"cliPath",
"name",
],
clearBaseFields: ["account", "httpUrl", "httpHost", "httpPort", "cliPath", "name"],
}),
isConfigured: (account) => account.configured,
describeAccount: (account) => ({
@@ -87,25 +76,20 @@ export const signalPlugin: ChannelPlugin<ResolvedSignalAccount> = {
baseUrl: account.baseUrl,
}),
resolveAllowFrom: ({ cfg, accountId }) =>
(resolveSignalAccount({ cfg, accountId }).config.allowFrom ?? []).map(
(entry) => String(entry),
(resolveSignalAccount({ cfg, accountId }).config.allowFrom ?? []).map((entry) =>
String(entry),
),
formatAllowFrom: ({ allowFrom }) =>
allowFrom
.map((entry) => String(entry).trim())
.filter(Boolean)
.map((entry) =>
entry === "*" ? "*" : normalizeE164(entry.replace(/^signal:/i, "")),
)
.map((entry) => (entry === "*" ? "*" : normalizeE164(entry.replace(/^signal:/i, ""))))
.filter(Boolean),
},
security: {
resolveDmPolicy: ({ cfg, accountId, account }) => {
const resolvedAccountId =
accountId ?? account.accountId ?? DEFAULT_ACCOUNT_ID;
const useAccountPath = Boolean(
cfg.channels?.signal?.accounts?.[resolvedAccountId],
);
const resolvedAccountId = accountId ?? account.accountId ?? DEFAULT_ACCOUNT_ID;
const useAccountPath = Boolean(cfg.channels?.signal?.accounts?.[resolvedAccountId]);
const basePath = useAccountPath
? `channels.signal.accounts.${resolvedAccountId}.`
: "channels.signal.";
@@ -115,8 +99,7 @@ export const signalPlugin: ChannelPlugin<ResolvedSignalAccount> = {
policyPath: `${basePath}dmPolicy`,
allowFromPath: basePath,
approveHint: formatPairingApproveHint("signal"),
normalizeEntry: (raw) =>
normalizeE164(raw.replace(/^signal:/i, "").trim()),
normalizeEntry: (raw) => normalizeE164(raw.replace(/^signal:/i, "").trim()),
};
},
collectWarnings: ({ account }) => {
@@ -264,8 +247,7 @@ export const signalPlugin: ChannelPlugin<ResolvedSignalAccount> = {
},
collectStatusIssues: (accounts) =>
accounts.flatMap((account) => {
const lastError =
typeof account.lastError === "string" ? account.lastError.trim() : "";
const lastError = typeof account.lastError === "string" ? account.lastError.trim() : "";
if (!lastError) return [];
return [
{
@@ -312,9 +294,7 @@ export const signalPlugin: ChannelPlugin<ResolvedSignalAccount> = {
accountId: account.accountId,
baseUrl: account.baseUrl,
});
ctx.log?.info(
`[${account.accountId}] starting provider (${account.baseUrl})`,
);
ctx.log?.info(`[${account.accountId}] starting provider (${account.baseUrl})`);
// Lazy import: the monitor pulls the reply pipeline; avoid ESM init cycles.
const { monitorSignalProvider } = await import("../../signal/index.js");
return monitorSignalProvider({