fix(lint): resolve #280 Lint failures (route formatting + landing import sort)

#280 left 10 section-prefixed custom-route files mis-indented and one
unsorted import block in the new landing section-index page. Fixed via
biome formatter (api) and manual import sort (landing). No config change
(biome.json is hook-protected); no suppression. pnpm lint + typecheck
now exit 0.
This commit is contained in:
SnapOtter
2026-06-21 02:58:46 +08:00
parent 71fefc05b0
commit 6e1b9cd3cc
11 changed files with 1016 additions and 986 deletions
+5 -2
View File
@@ -90,7 +90,9 @@ registerAiJobHandler("auto-subtitles", async (input, data, ctx) => {
}); });
export function registerAutoSubtitles(app: FastifyInstance) { export function registerAutoSubtitles(app: FastifyInstance) {
app.post("/api/v1/tools/video/auto-subtitles", async (request: FastifyRequest, reply: FastifyReply) => { app.post(
"/api/v1/tools/video/auto-subtitles",
async (request: FastifyRequest, reply: FastifyReply) => {
const toolId = "auto-subtitles"; const toolId = "auto-subtitles";
if (!isToolInstalled(toolId)) { if (!isToolInstalled(toolId)) {
const bundle = getBundleForTool(toolId); const bundle = getBundleForTool(toolId);
@@ -171,5 +173,6 @@ export function registerAutoSubtitles(app: FastifyInstance) {
}); });
return reply.status(202).send({ jobId: progressJobId, async: true }); return reply.status(202).send({ jobId: progressJobId, async: true });
}); },
);
} }
+5 -2
View File
@@ -79,7 +79,9 @@ function buildOverlaySvg(
* Read barcodes (all 1D + 2D types) from uploaded images using zxing-wasm. * Read barcodes (all 1D + 2D types) from uploaded images using zxing-wasm.
*/ */
export function registerBarcodeRead(app: FastifyInstance) { export function registerBarcodeRead(app: FastifyInstance) {
app.post("/api/v1/tools/image/barcode-read", async (request: FastifyRequest, reply: FastifyReply) => { app.post(
"/api/v1/tools/image/barcode-read",
async (request: FastifyRequest, reply: FastifyReply) => {
let fileBuffer: Buffer | null = null; let fileBuffer: Buffer | null = null;
let filename = "image"; let filename = "image";
let settingsRaw: string | null = null; let settingsRaw: string | null = null;
@@ -263,5 +265,6 @@ export function registerBarcodeRead(app: FastifyInstance) {
details: err instanceof Error ? err.message : "Unknown error", details: err instanceof Error ? err.message : "Unknown error",
}); });
} }
}); },
);
} }
+5 -2
View File
@@ -65,7 +65,9 @@ registerAiJobHandler("blur-faces", async (input, data, ctx) => {
/** Face detection and blurring route. */ /** Face detection and blurring route. */
export function registerBlurFaces(app: FastifyInstance) { export function registerBlurFaces(app: FastifyInstance) {
app.post("/api/v1/tools/image/blur-faces", async (request: FastifyRequest, reply: FastifyReply) => { app.post(
"/api/v1/tools/image/blur-faces",
async (request: FastifyRequest, reply: FastifyReply) => {
const toolId = "blur-faces"; const toolId = "blur-faces";
if (!isToolInstalled(toolId)) { if (!isToolInstalled(toolId)) {
const bundle = getBundleForTool(toolId); const bundle = getBundleForTool(toolId);
@@ -177,7 +179,8 @@ export function registerBlurFaces(app: FastifyInstance) {
}); });
return reply.status(202).send({ jobId: progressJobId, async: true }); return reply.status(202).send({ jobId: progressJobId, async: true });
}); },
);
// Register in the pipeline/batch registry // Register in the pipeline/batch registry
registerToolProcessFn({ registerToolProcessFn({
+5 -2
View File
@@ -109,7 +109,9 @@ export function registerEditMetadata(app: FastifyInstance) {
); );
// Edit endpoint - writes metadata in-place using ExifTool (no pixel re-encoding) // Edit endpoint - writes metadata in-place using ExifTool (no pixel re-encoding)
app.post("/api/v1/tools/image/edit-metadata", async (request: FastifyRequest, reply: FastifyReply) => { app.post(
"/api/v1/tools/image/edit-metadata",
async (request: FastifyRequest, reply: FastifyReply) => {
let fileBuffer: Buffer | null = null; let fileBuffer: Buffer | null = null;
let filename = "image"; let filename = "image";
let settingsRaw: string | null = null; let settingsRaw: string | null = null;
@@ -209,7 +211,8 @@ export function registerEditMetadata(app: FastifyInstance) {
details: err instanceof Error ? err.message : "Unknown error", details: err instanceof Error ? err.message : "Unknown error",
}); });
} }
}); },
);
// Register in pipeline/batch registry // Register in pipeline/batch registry
registerToolProcessFn({ registerToolProcessFn({
+5 -2
View File
@@ -58,7 +58,9 @@ registerAiJobHandler("enhance-faces", async (input, data, ctx) => {
/** Face enhancement route using GFPGAN/CodeFormer. */ /** Face enhancement route using GFPGAN/CodeFormer. */
export function registerEnhanceFaces(app: FastifyInstance) { export function registerEnhanceFaces(app: FastifyInstance) {
app.post("/api/v1/tools/image/enhance-faces", async (request: FastifyRequest, reply: FastifyReply) => { app.post(
"/api/v1/tools/image/enhance-faces",
async (request: FastifyRequest, reply: FastifyReply) => {
const toolId = "enhance-faces"; const toolId = "enhance-faces";
if (!isToolInstalled(toolId)) { if (!isToolInstalled(toolId)) {
const bundle = getBundleForTool(toolId); const bundle = getBundleForTool(toolId);
@@ -170,7 +172,8 @@ export function registerEnhanceFaces(app: FastifyInstance) {
}); });
return reply.status(202).send({ jobId: progressJobId, async: true }); return reply.status(202).send({ jobId: progressJobId, async: true });
}); },
);
// Register in the pipeline/batch registry // Register in the pipeline/batch registry
registerToolProcessFn({ registerToolProcessFn({
+5 -2
View File
@@ -33,7 +33,9 @@ const settingsSchema = z.object({
* via getObjectBuffer(data.inputRefs[1]) inside the handler. * via getObjectBuffer(data.inputRefs[1]) inside the handler.
*/ */
export function registerEraseObject(app: FastifyInstance) { export function registerEraseObject(app: FastifyInstance) {
app.post("/api/v1/tools/image/erase-object", async (request: FastifyRequest, reply: FastifyReply) => { app.post(
"/api/v1/tools/image/erase-object",
async (request: FastifyRequest, reply: FastifyReply) => {
const toolId = "erase-object"; const toolId = "erase-object";
if (!isToolInstalled(toolId)) { if (!isToolInstalled(toolId)) {
const bundle = getBundleForTool(toolId); const bundle = getBundleForTool(toolId);
@@ -173,7 +175,8 @@ export function registerEraseObject(app: FastifyInstance) {
}); });
return reply.status(202).send({ jobId: progressJobId, async: true }); return reply.status(202).send({ jobId: progressJobId, async: true });
}); },
);
} }
// ── AI job handler (separate import for the worker) ─────────────── // ── AI job handler (separate import for the worker) ───────────────
+5 -2
View File
@@ -98,7 +98,9 @@ const settingsSchema = z.object({
export function registerGifTools(app: FastifyInstance) { export function registerGifTools(app: FastifyInstance) {
// ── Metadata endpoint ─────────────────────────────────────────── // ── Metadata endpoint ───────────────────────────────────────────
app.post("/api/v1/tools/image/gif-tools/info", async (request: FastifyRequest, reply: FastifyReply) => { app.post(
"/api/v1/tools/image/gif-tools/info",
async (request: FastifyRequest, reply: FastifyReply) => {
let fileBuffer: Buffer | null = null; let fileBuffer: Buffer | null = null;
try { try {
@@ -137,7 +139,8 @@ export function registerGifTools(app: FastifyInstance) {
} catch { } catch {
return reply.status(422).send({ error: "Could not read image metadata" }); return reply.status(422).send({ error: "Could not read image metadata" });
} }
}); },
);
// ── Processing endpoint ───────────────────────────────────────── // ── Processing endpoint ─────────────────────────────────────────
createToolRoute(app, { createToolRoute(app, {
+5 -2
View File
@@ -69,7 +69,9 @@ registerAiJobHandler("noise-removal", async (input, data, ctx) => {
* Uses the Python sidecar for multi-tier denoising. * Uses the Python sidecar for multi-tier denoising.
*/ */
export function registerNoiseRemoval(app: FastifyInstance) { export function registerNoiseRemoval(app: FastifyInstance) {
app.post("/api/v1/tools/image/noise-removal", async (request: FastifyRequest, reply: FastifyReply) => { app.post(
"/api/v1/tools/image/noise-removal",
async (request: FastifyRequest, reply: FastifyReply) => {
const toolId = "noise-removal"; const toolId = "noise-removal";
if (!isToolInstalled(toolId)) { if (!isToolInstalled(toolId)) {
const bundle = getBundleForTool(toolId); const bundle = getBundleForTool(toolId);
@@ -181,7 +183,8 @@ export function registerNoiseRemoval(app: FastifyInstance) {
}); });
return reply.status(202).send({ jobId: progressJobId, async: true }); return reply.status(202).send({ jobId: progressJobId, async: true });
}); },
);
// Register in the pipeline/batch registry // Register in the pipeline/batch registry
registerToolProcessFn({ registerToolProcessFn({
+5 -2
View File
@@ -30,7 +30,9 @@ const settingsSchema = z.object({
* images from text input, not from uploaded files. * images from text input, not from uploaded files.
*/ */
export function registerQrGenerate(app: FastifyInstance) { export function registerQrGenerate(app: FastifyInstance) {
app.post("/api/v1/tools/image/qr-generate", async (request: FastifyRequest, reply: FastifyReply) => { app.post(
"/api/v1/tools/image/qr-generate",
async (request: FastifyRequest, reply: FastifyReply) => {
let body: unknown; let body: unknown;
try { try {
body = request.body; body = request.body;
@@ -108,5 +110,6 @@ export function registerQrGenerate(app: FastifyInstance) {
details: err instanceof Error ? err.message : "Unknown error", details: err instanceof Error ? err.message : "Unknown error",
}); });
} }
}); },
);
} }
+5 -2
View File
@@ -83,7 +83,9 @@ registerAiJobHandler("restore-photo", async (input, data, ctx) => {
* optional colorization. * optional colorization.
*/ */
export function registerRestorePhoto(app: FastifyInstance) { export function registerRestorePhoto(app: FastifyInstance) {
app.post("/api/v1/tools/image/restore-photo", async (request: FastifyRequest, reply: FastifyReply) => { app.post(
"/api/v1/tools/image/restore-photo",
async (request: FastifyRequest, reply: FastifyReply) => {
if (!isToolInstalled("restore-photo")) { if (!isToolInstalled("restore-photo")) {
const bundle = getBundleForTool("restore-photo"); const bundle = getBundleForTool("restore-photo");
return reply.status(501).send({ return reply.status(501).send({
@@ -201,7 +203,8 @@ export function registerRestorePhoto(app: FastifyInstance) {
}); });
return reply.status(202).send({ jobId: progressJobId, async: true }); return reply.status(202).send({ jobId: progressJobId, async: true });
}); },
);
// Register in the pipeline/batch registry // Register in the pipeline/batch registry
registerToolProcessFn({ registerToolProcessFn({
@@ -1,8 +1,8 @@
--- ---
import { SECTIONS, TOOLS, toolSection } from "@snapotter/shared"; import { SECTIONS, TOOLS, toolSection } from "@snapotter/shared";
import Base from "@/layouts/Base.astro";
import Navbar from "@/components/Navbar.astro";
import Footer from "@/components/Footer.astro"; import Footer from "@/components/Footer.astro";
import Navbar from "@/components/Navbar.astro";
import Base from "@/layouts/Base.astro";
export function getStaticPaths() { export function getStaticPaths() {
return SECTIONS.map((s) => ({ return SECTIONS.map((s) => ({