From 74030b580695e89b582bf03dbfc74ea47f127d41 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Fri, 28 Nov 2025 13:13:01 +0100 Subject: [PATCH] Refactor lint comments and minor code improvements Removed or updated unnecessary eslint-disable comments across several server and service files to improve code clarity. Fixed import paths and added TypeScript ignore comments where needed for compatibility. Minor formatting adjustments were made for readability. --- prisma.config.ts | 2 +- server.js | 1 + src/app/_components/ScriptsGrid.tsx | 5 ++++- src/server/api/routers/scripts.ts | 2 +- src/server/database-prisma.ts | 2 +- src/server/lib/autoSyncInit.js | 4 +++- src/server/services/backupService.ts | 2 +- src/server/services/githubJsonService.ts | 2 +- src/server/services/localScripts.ts | 2 +- src/server/services/repositoryService.ts | 2 +- src/server/services/restoreService.ts | 2 +- 11 files changed, 16 insertions(+), 10 deletions(-) diff --git a/prisma.config.ts b/prisma.config.ts index 6aa728e..5abb1c4 100644 --- a/prisma.config.ts +++ b/prisma.config.ts @@ -1,9 +1,9 @@ import 'dotenv/config' import { defineConfig } from 'prisma/config' -// @ts-ignore - Prisma 7 config types are incomplete export default defineConfig({ schema: 'prisma/schema.prisma', + // @ts-expect-error - Prisma 7 config types are incomplete studio: { adapter: async () => { const { PrismaBetterSqlite3 } = await import('@prisma/adapter-better-sqlite3') diff --git a/server.js b/server.js index 9350292..759c4db 100644 --- a/server.js +++ b/server.js @@ -8,6 +8,7 @@ import stripAnsi from 'strip-ansi'; import { spawn as ptySpawn } from 'node-pty'; import { getSSHExecutionService } from './src/server/ssh-execution-service.js'; import { getDatabase } from './src/server/database-prisma.js'; +// @ts-ignore - TypeScript has trouble with JS module exports import { initializeAutoSync, initializeRepositories, setupGracefulShutdown } from './src/server/lib/autoSyncInit.js'; import dotenv from 'dotenv'; diff --git a/src/app/_components/ScriptsGrid.tsx b/src/app/_components/ScriptsGrid.tsx index 84af2d0..1b95c53 100644 --- a/src/app/_components/ScriptsGrid.tsx +++ b/src/app/_components/ScriptsGrid.tsx @@ -584,7 +584,10 @@ export function ScriptsGrid({ onInstallScript }: ScriptsGridProps) { } else { const error = "error" in result ? result.error : "Failed to load script"; - const userFriendlyError = getFriendlyErrorMessage(error ?? "Unknown error", slug ?? ""); + const userFriendlyError = getFriendlyErrorMessage( + error ?? "Unknown error", + slug ?? "", + ); failed.push({ slug: slug ?? "", error: userFriendlyError }); } } catch (error) { diff --git a/src/server/api/routers/scripts.ts b/src/server/api/routers/scripts.ts index abe65d9..5543d88 100644 --- a/src/server/api/routers/scripts.ts +++ b/src/server/api/routers/scripts.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ + import { z } from "zod"; import { createTRPCRouter, publicProcedure } from "~/server/api/trpc"; import { scriptManager } from "~/server/lib/scripts"; diff --git a/src/server/database-prisma.ts b/src/server/database-prisma.ts index dd54054..9de07ec 100644 --- a/src/server/database-prisma.ts +++ b/src/server/database-prisma.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument */ + import { prisma } from './db'; import { join } from 'path'; import { writeFileSync, unlinkSync, chmodSync, mkdirSync } from 'fs'; diff --git a/src/server/lib/autoSyncInit.js b/src/server/lib/autoSyncInit.js index b6147cb..e6e9616 100644 --- a/src/server/lib/autoSyncInit.js +++ b/src/server/lib/autoSyncInit.js @@ -1,11 +1,13 @@ import { AutoSyncService } from '../services/autoSyncService.js'; -import { repositoryService } from '../services/repositoryService.ts'; +import { repositoryService } from '../services/repositoryService.js'; +/** @type {AutoSyncService | null} */ let autoSyncService = null; let isInitialized = false; /** * Initialize default repositories + * @returns {Promise} */ export async function initializeRepositories() { try { diff --git a/src/server/services/backupService.ts b/src/server/services/backupService.ts index 3d512d4..94c28ea 100644 --- a/src/server/services/backupService.ts +++ b/src/server/services/backupService.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-floating-promises, @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/no-unused-vars, @typescript-eslint/prefer-regexp-exec, @typescript-eslint/prefer-optional-chain, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-floating-promises, @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/no-unused-vars, @typescript-eslint/prefer-regexp-exec, @typescript-eslint/prefer-optional-chain */ import { getSSHExecutionService } from '../ssh-execution-service'; import { getStorageService } from './storageService'; import { getDatabase } from '../database-prisma'; diff --git a/src/server/services/githubJsonService.ts b/src/server/services/githubJsonService.ts index 1a852ce..54f2878 100644 --- a/src/server/services/githubJsonService.ts +++ b/src/server/services/githubJsonService.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-unsafe-argument, @typescript-eslint/prefer-nullish-coalescing */ +/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ import { writeFile, mkdir, readdir, readFile } from 'fs/promises'; import { join } from 'path'; import { env } from '../../env.js'; diff --git a/src/server/services/localScripts.ts b/src/server/services/localScripts.ts index 9c70865..8586f2b 100644 --- a/src/server/services/localScripts.ts +++ b/src/server/services/localScripts.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ + import { readFile, readdir, writeFile, mkdir } from 'fs/promises'; import { join } from 'path'; import type { Script, ScriptCard } from '~/types/script'; diff --git a/src/server/services/repositoryService.ts b/src/server/services/repositoryService.ts index 7444a87..c9045dd 100644 --- a/src/server/services/repositoryService.ts +++ b/src/server/services/repositoryService.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument, @typescript-eslint/prefer-regexp-exec */ +/* eslint-disable @typescript-eslint/prefer-regexp-exec */ import { prisma } from '../db'; export class RepositoryService { diff --git a/src/server/services/restoreService.ts b/src/server/services/restoreService.ts index b644c8c..db5014d 100644 --- a/src/server/services/restoreService.ts +++ b/src/server/services/restoreService.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-floating-promises, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-return, @typescript-eslint/prefer-optional-chain, @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/prefer-regexp-exec, @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/no-floating-promises, @typescript-eslint/prefer-optional-chain, @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/prefer-regexp-exec, @typescript-eslint/no-empty-function */ import { getSSHExecutionService } from '../ssh-execution-service'; import { getBackupService } from './backupService'; import { getStorageService } from './storageService';