chore: migrate from ESLint/Prettier to Biome

- Add biome.json with recommended preset + custom rules
- Remove eslint.config.mjs (root, apps/react, apps/elysia)
- Remove .prettierrc and .prettierignore
- Update package.json: remove eslint/prettier deps, add biome scripts
- Update Makefile: lint/format targets to biome
- Update CI (lint.yml): eslint -> biome ci
- Update VSCode config: biomejs.biome extension + default formatter
- Apply biome format --write to all files
- Update submodule pointers for react and elysia

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
asephs
2026-07-10 05:42:53 +07:00
co-authored by Claude Opus 4.8
parent e71f1261f6
commit 76ccc5ffe9
13 changed files with 153 additions and 553 deletions
+45 -43
View File
@@ -1,75 +1,77 @@
import { existsSync, readFileSync } from "node:fs"
import { resolve, sep } from "node:path"
import { existsSync, readFileSync } from 'node:fs';
import { resolve, sep } from 'node:path';
const distDir = resolve("./dist")
const indexPath = resolve(distDir, "index.html")
const distDir = resolve('./dist');
const indexPath = resolve(distDir, 'index.html');
const contentTypes = {
html: "text/html; charset=utf-8",
css: "text/css; charset=utf-8",
js: "application/javascript; charset=utf-8",
json: "application/json; charset=utf-8",
svg: "image/svg+xml",
png: "image/png",
jpg: "image/jpeg",
jpeg: "image/jpeg",
gif: "image/gif",
webp: "image/webp",
ico: "image/x-icon",
woff: "font/woff",
woff2: "font/woff2",
ttf: "font/ttf",
}
html: 'text/html; charset=utf-8',
css: 'text/css; charset=utf-8',
js: 'application/javascript; charset=utf-8',
json: 'application/json; charset=utf-8',
svg: 'image/svg+xml',
png: 'image/png',
jpg: 'image/jpeg',
jpeg: 'image/jpeg',
gif: 'image/gif',
webp: 'image/webp',
ico: 'image/x-icon',
woff: 'font/woff',
woff2: 'font/woff2',
ttf: 'font/ttf',
};
function responseFromFile(filePath, headers) {
try {
return new Response(readFileSync(filePath), { headers })
return new Response(readFileSync(filePath), { headers });
} catch (error) {
if (error?.code === "ENOENT") {
return new Response("Not Found", { status: 404 })
if (error?.code === 'ENOENT') {
return new Response('Not Found', { status: 404 });
}
console.error("File read error:", error)
return new Response("Internal Server Error", { status: 500 })
console.error('File read error:', error);
return new Response('Internal Server Error', { status: 500 });
}
}
function serveIndex() {
return responseFromFile(indexPath, {
"Content-Type": contentTypes.html,
"Cache-Control": "no-cache",
})
'Content-Type': contentTypes.html,
'Cache-Control': 'no-cache',
});
}
function serveFile(filePath, pathname) {
const ext = filePath.split(".").pop() || ""
const ext = filePath.split('.').pop() || '';
return responseFromFile(filePath, {
"Content-Type": contentTypes[ext] || "application/octet-stream",
"Cache-Control": pathname.startsWith("/assets/") ? "public, max-age=31536000, immutable" : "no-cache",
})
'Content-Type': contentTypes[ext] || 'application/octet-stream',
'Cache-Control': pathname.startsWith('/assets/')
? 'public, max-age=31536000, immutable'
: 'no-cache',
});
}
Bun.serve({
port: 80,
hostname: "0.0.0.0",
hostname: '0.0.0.0',
fetch(req) {
const url = new URL(req.url)
const pathname = url.pathname
const filePath = resolve(distDir, pathname.slice(1))
const insideDist = filePath === distDir || filePath.startsWith(`${distDir}${sep}`)
const url = new URL(req.url);
const pathname = url.pathname;
const filePath = resolve(distDir, pathname.slice(1));
const insideDist = filePath === distDir || filePath.startsWith(`${distDir}${sep}`);
if (!insideDist) {
return new Response("Forbidden", { status: 403 })
return new Response('Forbidden', { status: 403 });
}
if (pathname !== "/" && existsSync(filePath)) {
return serveFile(filePath, pathname)
if (pathname !== '/' && existsSync(filePath)) {
return serveFile(filePath, pathname);
}
if (!pathname.includes(".") && existsSync(indexPath)) {
return serveIndex()
if (!pathname.includes('.') && existsSync(indexPath)) {
return serveIndex();
}
return new Response("Not Found", { status: 404 })
return new Response('Not Found', { status: 404 });
},
})
});