🔄 Synchronize Biome linting rules between relay and frontend

🛠️ Apply identical Biome configuration from frontend to relay service
🧹 Ensure consistent code formatting and quality standards across components
📝 Maintain unified development experience throughout the project
This commit is contained in:
Danny Morabito 2025-03-24 19:20:24 +01:00
parent 4bd0839669
commit a4134fa416
Signed by: dannym
GPG key ID: 7CC8056A5A04557E
9 changed files with 273 additions and 195 deletions

View file

@ -1,7 +1,7 @@
import { xchacha20poly1305 } from "@noble/ciphers/chacha";
import { managedNonce } from "@noble/ciphers/webcrypto";
import { decodeBase64 } from "jsr:@std/encoding/base64";
export const encryptionKey = decodeBase64(Deno.env.get("ENCRYPTION_KEY") || "");
import { decodeBase64 } from 'jsr:@std/encoding/base64';
import { xchacha20poly1305 } from '@noble/ciphers/chacha';
import { managedNonce } from '@noble/ciphers/webcrypto';
export const encryptionKey = decodeBase64(Deno.env.get('ENCRYPTION_KEY') || '');
/**
* Encrypts a given Uint8Array using the XChaCha20-Poly1305 algorithm.

View file

@ -1,4 +1,4 @@
import { exists } from "jsr:@std/fs";
import { exists } from 'jsr:@std/fs';
/**
* Return the path to Eve's configuration directory and ensures its existence.
@ -14,13 +14,11 @@ import { exists } from "jsr:@std/fs";
export async function getEveConfigHome(): Promise<string> {
let storagePath: string;
if (Deno.build.os === "darwin") {
storagePath = `${
Deno.env.get("HOME")
}/Library/Application Support/eve/arx/Eve`;
if (Deno.build.os === 'darwin') {
storagePath = `${Deno.env.get('HOME')}/Library/Application Support/eve/arx/Eve`;
} else {
const xdgConfigHome = Deno.env.get("XDG_CONFIG_HOME") ??
`${Deno.env.get("HOME")}/.config`;
const xdgConfigHome =
Deno.env.get('XDG_CONFIG_HOME') ?? `${Deno.env.get('HOME')}/.config`;
storagePath = `${xdgConfigHome}/arx/Eve`;
}
if (!(await exists(storagePath))) {

View file

@ -1,59 +1,59 @@
import * as colors from "jsr:@std/fmt@^1.0.4/colors";
import * as log from "jsr:@std/log";
import { getEveFilePath } from "./files.ts";
export * as log from "jsr:@std/log";
import * as colors from 'jsr:@std/fmt@^1.0.4/colors';
import * as log from 'jsr:@std/log';
import { getEveFilePath } from './files.ts';
export * as log from 'jsr:@std/log';
export async function setupLogger() {
const formatLevel = (level: number): string => {
return (
{
10: colors.gray("[DEBUG]"),
20: colors.green("[INFO] "),
30: colors.yellow("[WARN] "),
40: colors.red("[ERROR]"),
50: colors.bgRed("[FATAL]"),
10: colors.gray('[DEBUG]'),
20: colors.green('[INFO] '),
30: colors.yellow('[WARN] '),
40: colors.red('[ERROR]'),
50: colors.bgRed('[FATAL]'),
}[level] || `[LVL${level}]`
);
};
const levelName = (level: number): string => {
return {
10: "DEBUG",
20: "INFO",
30: "WARN",
40: "ERROR",
50: "FATAL",
}[level] || `LVL${level}`;
return (
{
10: 'DEBUG',
20: 'INFO',
30: 'WARN',
40: 'ERROR',
50: 'FATAL',
}[level] || `LVL${level}`
);
};
const formatArg = (arg: unknown): string => {
if (typeof arg === "object") return JSON.stringify(arg);
if (typeof arg === 'object') return JSON.stringify(arg);
return String(arg);
};
await log.setup({
handlers: {
console: new log.ConsoleHandler("DEBUG", {
console: new log.ConsoleHandler('DEBUG', {
useColors: true,
formatter: (record) => {
const timestamp = new Date().toISOString();
let msg = `${colors.dim(`[${timestamp}]`)} ${
formatLevel(record.level)
} ${record.msg}`;
let msg = `${colors.dim(`[${timestamp}]`)} ${formatLevel(record.level)} ${record.msg}`;
if (record.args.length > 0) {
const args = record.args
.map((arg, i) => `${colors.dim(`arg${i}:`)} ${formatArg(arg)}`)
.join(" ");
msg += ` ${colors.dim("|")} ${args}`;
.join(' ');
msg += ` ${colors.dim('|')} ${args}`;
}
return msg;
},
}),
file: new log.FileHandler("DEBUG", {
filename: Deno.env.get("LOG_FILE") ||
await getEveFilePath("eve-logs.jsonl"),
file: new log.FileHandler('DEBUG', {
filename:
Deno.env.get('LOG_FILE') || (await getEveFilePath('eve-logs.jsonl')),
formatter: (record) => {
const timestamp = new Date().toISOString();
return JSON.stringify({
@ -67,8 +67,8 @@ export async function setupLogger() {
},
loggers: {
default: {
level: "DEBUG",
handlers: ["console", "file"],
level: 'DEBUG',
handlers: ['console', 'file'],
},
},
});

View file

@ -1,4 +1,4 @@
import type { BindValue, Database } from "@db/sqlite";
import type { BindValue, Database } from '@db/sqlite';
/**
* Construct a SQL query with placeholders for values.
@ -23,8 +23,8 @@ export function sqlPartial(
) {
return {
query: segments.reduce(
(acc, str, i) => acc + str + (i < values.length ? "?" : ""),
"",
(acc, str, i) => acc + str + (i < values.length ? '?' : ''),
'',
),
values: values,
};
@ -72,7 +72,7 @@ export function mixQuery(...queries: { query: string; values: BindValue[] }[]) {
query: `${acc.query} ${query}`,
values: [...acc.values, ...values],
}),
{ query: "", values: [] },
{ query: '', values: [] },
);
return { query, values };
}