fix: inital eslint errors

This commit is contained in:
Huskydog9988
2025-04-13 21:44:29 -04:00
parent ff1255f948
commit d4b89b5dc5
74 changed files with 339 additions and 304 deletions

View File

@@ -1,4 +1,4 @@
import { AuthMec } from "@prisma/client";
import type { AuthMec } from "@prisma/client";
import aclManager from "~/server/internal/acls";
import { applicationSettings } from "~/server/internal/config/application-configuration";

View File

@@ -1,7 +1,7 @@
import aclManager from "~/server/internal/acls";
import libraryManager from "~/server/internal/library";
import metadataHandler from "~/server/internal/metadata";
import {
import type {
GameMetadataSearchResult,
GameMetadataSource,
} from "~/server/internal/metadata/types";

View File

@@ -1,5 +1,5 @@
import { AuthMec } from "@prisma/client";
import { JsonArray } from "@prisma/client/runtime/library";
import type { JsonArray } from "@prisma/client/runtime/library";
import { type } from "arktype";
import prisma from "~/server/internal/db/database";
import {

View File

@@ -1,5 +1,6 @@
import type {
InternalClientCapability} from "~/server/internal/clients/capabilities";
import capabilityManager, {
InternalClientCapability,
validCapabilities,
} from "~/server/internal/clients/capabilities";
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";

View File

@@ -1,7 +1,7 @@
import session from "~/server/internal/session";
import taskHandler, { TaskMessage } from "~/server/internal/tasks";
import { parse as parseCookies } from "cookie-es";
import { MinimumRequestObject } from "~/server/h3";
import type { MinimumRequestObject } from "~/server/h3";
// TODO add web socket sessions for horizontal scaling
// ID to admin

View File

@@ -15,7 +15,7 @@ export default defineEventHandler(async (h3) => {
const deleted = await prisma.aPIToken.delete({
where: { id: id, userId: userId, mode: APITokenMode.User },
})!!;
})!;
if (!deleted)
throw createError({ statusCode: 404, statusMessage: "Token not found" });

View File

@@ -1,4 +1,4 @@
import { systemACLs, userACLs } from ".";
import type { systemACLs, userACLs } from ".";
type ObjectFromList<T extends ReadonlyArray<string>, V = string> = {
[K in T extends ReadonlyArray<infer U> ? U : never]: V;

View File

@@ -2,7 +2,7 @@ import { APITokenMode, User } from "@prisma/client";
import { H3Context, H3Event } from "h3";
import prisma from "../db/database";
import sessionHandler from "../session";
import { MinimumRequestObject } from "~/server/h3";
import type { MinimumRequestObject } from "~/server/h3";
export const userACLs = [
"read",

View File

@@ -1,6 +1,6 @@
import path from "path";
import fs from "fs";
import { CertificateBundle } from "./ca";
import type { CertificateBundle } from "./ca";
import prisma from "../db/database";
export type CertificateStore = {

View File

@@ -1,7 +1,8 @@
import path from "path";
import fs from "fs";
import droplet from "@drop-oss/droplet";
import { CertificateStore, fsCertificateStore } from "./ca-store";
import type { CertificateStore} from "./ca-store";
import { fsCertificateStore } from "./ca-store";
export type CertificateBundle = {
priv: string;

View File

@@ -1,4 +1,4 @@
import { EnumDictionary } from "../utils/types";
import type { EnumDictionary } from "../utils/types";
import https from "https";
import { useCertificateAuthority } from "~/server/plugins/ca";
import prisma from "../db/database";

View File

@@ -1,5 +1,5 @@
import { Client, User } from "@prisma/client";
import { EventHandlerRequest, H3Event } from "h3";
import type { Client, User } from "@prisma/client";
import type { EventHandlerRequest, H3Event } from "h3";
import droplet from "@drop-oss/droplet";
import prisma from "../db/database";
import { useCertificateAuthority } from "~/server/plugins/ca";
@@ -26,7 +26,7 @@ export function defineClientEventHandler<T>(handler: EventHandlerFunction<T>) {
let clientId: string;
switch (method) {
case "Debug":
if (!process.dev) throw createError({ statusCode: 403 });
if (!import.meta.dev) throw createError({ statusCode: 403 });
const client = await prisma.client.findFirst({ select: { id: true } });
if (!client)
throw createError({

View File

@@ -1,7 +1,7 @@
import { randomUUID } from "node:crypto";
import { CertificateBundle } from "./ca";
import prisma from "../db/database";
import { Platform } from "@prisma/client";
import type { Platform } from "@prisma/client";
import { useCertificateAuthority } from "~/server/plugins/ca";
export interface ClientMetadata {

View File

@@ -1,4 +1,5 @@
import { ApplicationSettings, AuthMec } from "@prisma/client";
import type { ApplicationSettings} from "@prisma/client";
import { AuthMec } from "@prisma/client";
import prisma from "../db/database";
class ApplicationConfiguration {

View File

@@ -1,4 +1,4 @@
import { GameVersion } from "@prisma/client";
import type { GameVersion } from "@prisma/client";
import prisma from "../db/database";
export type DropChunk = {

View File

@@ -8,7 +8,8 @@
import fs from "fs";
import path from "path";
import prisma from "../db/database";
import { GameVersion, Platform } from "@prisma/client";
import type { GameVersion} from "@prisma/client";
import { Platform } from "@prisma/client";
import { fuzzy } from "fast-fuzzy";
import { recursivelyReaddir } from "../utils/recursivedirs";
import taskHandler from "../tasks";

View File

@@ -1,6 +1,8 @@
import { Developer, MetadataSource, Publisher } from "@prisma/client";
import { MetadataProvider, MissingMetadataProviderConfig } from ".";
import {
import type { Developer, Publisher } from "@prisma/client";
import { MetadataSource } from "@prisma/client";
import type { MetadataProvider} from ".";
import { MissingMetadataProviderConfig } from ".";
import type {
GameMetadataSearchResult,
_FetchGameMetadataParams,
GameMetadata,
@@ -9,7 +11,8 @@ import {
_FetchDeveloperMetadataParams,
DeveloperMetadata,
} from "./types";
import axios, { AxiosRequestConfig } from "axios";
import type { AxiosRequestConfig } from "axios";
import axios from "axios";
import TurndownService from "turndown";
import { DateTime } from "luxon";

View File

@@ -1,6 +1,8 @@
import { Developer, MetadataSource, Publisher } from "@prisma/client";
import { MetadataProvider, MissingMetadataProviderConfig } from ".";
import {
import type { Developer, Publisher } from "@prisma/client";
import { MetadataSource } from "@prisma/client";
import type { MetadataProvider} from ".";
import { MissingMetadataProviderConfig } from ".";
import type {
GameMetadataSearchResult,
_FetchGameMetadataParams,
GameMetadata,
@@ -9,7 +11,8 @@ import {
_FetchDeveloperMetadataParams,
DeveloperMetadata,
} from "./types";
import axios, { AxiosRequestConfig } from "axios";
import type { AxiosRequestConfig } from "axios";
import axios from "axios";
import { DateTime } from "luxon";
type IGDBID = number;
@@ -182,7 +185,7 @@ export class IGDBProvider implements MetadataProvider {
if (this.accessTokenExpiry < futureTime) await this.authWithTwitch();
}
private async request<T extends Object>(
private async request<T extends object>(
resource: string,
body: string,
options?: AxiosRequestConfig

View File

@@ -1,11 +1,12 @@
import {
import type {
Developer,
Publisher} from "@prisma/client";
import {
MetadataSource,
PrismaClient,
Publisher,
PrismaClient
} from "@prisma/client";
import prisma from "../db/database";
import {
import type {
_FetchDeveloperMetadataParams,
_FetchGameMetadataParams,
_FetchPublisherMetadataParams,

View File

@@ -1,13 +1,14 @@
import { MetadataSource } from "@prisma/client";
import { MetadataProvider } from ".";
import {
GameMetadataSearchResult,
import type { MetadataProvider } from ".";
import type {
_FetchGameMetadataParams,
GameMetadata,
_FetchPublisherMetadataParams,
PublisherMetadata,
_FetchDeveloperMetadataParams,
DeveloperMetadata,
DeveloperMetadata} from "./types";
import {
GameMetadataSearchResult
} from "./types";
import * as jdenticon from "jdenticon";

View File

@@ -1,6 +1,8 @@
import { Developer, MetadataSource, Publisher } from "@prisma/client";
import { MetadataProvider, MissingMetadataProviderConfig } from ".";
import {
import type { Developer, Publisher } from "@prisma/client";
import { MetadataSource } from "@prisma/client";
import type { MetadataProvider} from ".";
import { MissingMetadataProviderConfig } from ".";
import type {
GameMetadataSearchResult,
_FetchGameMetadataParams,
GameMetadata,
@@ -9,7 +11,8 @@ import {
_FetchDeveloperMetadataParams,
DeveloperMetadata,
} from "./types";
import axios, { AxiosRequestConfig } from "axios";
import type { AxiosRequestConfig } from "axios";
import axios from "axios";
import * as jdenticon from "jdenticon";
import { DateTime } from "luxon";

View File

@@ -1,6 +1,7 @@
import { Developer, Publisher } from "@prisma/client";
import { ObjectTransactionalHandler, TransactionDataType } from "../objects/transactional";
import { ObjectReference } from "../objects/objectHandler";
import type { Developer, Publisher } from "@prisma/client";
import type { TransactionDataType } from "../objects/transactional";
import { ObjectTransactionalHandler } from "../objects/transactional";
import type { ObjectReference } from "../objects/objectHandler";
export interface GameMetadataSearchResult {
id: string;
@@ -48,7 +49,7 @@ export interface PublisherMetadata {
logo: ObjectReference;
banner: ObjectReference;
website: String;
website: string;
}
export type DeveloperMetadata = PublisherMetadata;

View File

@@ -6,7 +6,7 @@ Design goals:
2. Real-time; use websocket listeners to keep clients up-to-date
*/
import { Notification } from "@prisma/client";
import type { Notification } from "@prisma/client";
import prisma from "../db/database";
export type NotificationCreateArgs = Pick<

View File

@@ -1,9 +1,5 @@
import {
ObjectBackend,
ObjectMetadata,
ObjectReference,
Source,
} from "./objectHandler";
import type { ObjectMetadata, ObjectReference, Source } from "./objectHandler";
import { ObjectBackend } from "./objectHandler";
import { LRUCache } from "lru-cache";
import fs from "fs";

View File

@@ -15,7 +15,8 @@
*/
import { parse as getMimeTypeBuffer } from "file-type-mime";
import Stream, { Readable, Writable } from "stream";
import type { Writable } from "stream";
import Stream, { Readable } from "stream";
import { getMimeType as getMimeTypeStream } from "stream-mime-type";
export type ObjectReference = string;

View File

@@ -2,7 +2,7 @@
The purpose of this class is to hold references to remote objects (like images) until they're actually needed
This is used as a utility in metadata handling, so we only fetch the objects if we're actually creating a database record.
*/
import { Readable } from "stream";
import type { Readable } from "stream";
import { randomUUID } from "node:crypto";
import objectHandler from ".";

View File

@@ -3,7 +3,7 @@ import prisma from "../db/database";
import { applicationSettings } from "../config/application-configuration";
import objectHandler from "../objects";
import { randomUUID, createHash } from "node:crypto";
import { IncomingMessage } from "http";
import type { IncomingMessage } from "http";
class SaveManager {
async deleteObjectFromSave(

View File

@@ -1,6 +1,6 @@
import { LRUCache } from "lru-cache";
import prisma from "../db/database";
import { Session, SessionProvider } from "./types";
import type { Session, SessionProvider } from "./types";
import { Prisma } from "@prisma/client";
export default function createDBSessionHandler(): SessionProvider {

View File

@@ -1,11 +1,12 @@
import { H3Event } from "h3";
import type { H3Event } from "h3";
import createMemorySessionProvider from "./memory";
import { Session, SessionProvider } from "./types";
import type { Session, SessionProvider } from "./types";
import { randomUUID } from "node:crypto";
import { parse as parseCookies } from "cookie-es";
import { MinimumRequestObject } from "~/server/h3";
import type { MinimumRequestObject } from "~/server/h3";
import createDBSessionHandler from "./db";
import { DateTime, DurationLike } from "luxon";
import type { DurationLike } from "luxon";
import { DateTime } from "luxon";
/*
This implementation may need work.

View File

@@ -1,4 +1,4 @@
import { Session, SessionProvider } from "./types";
import type { Session, SessionProvider } from "./types";
export default function createMemorySessionHandler() {
const sessions: { [key: string]: Session } = {};
@@ -21,7 +21,7 @@ export default function createMemorySessionHandler() {
},
async cleanupSessions() {
const now = new Date();
for (let token in sessions) {
for (const token in sessions) {
// if expires at time is before now, the session is expired
if (sessions[token].expiresAt < now) await this.removeSession(token);
}

View File

@@ -1,5 +1,5 @@
import droplet from "@drop-oss/droplet";
import { MinimumRequestObject } from "~/server/h3";
import type { MinimumRequestObject } from "~/server/h3";
import aclManager from "../acls";
/**

View File

@@ -1,5 +1,6 @@
import { EventHandlerRequest, H3Event } from "h3";
import { Dump, ObjectTransactionalHandler, Pull } from "../objects/transactional";
import type { EventHandlerRequest, H3Event } from "h3";
import type { Dump, Pull } from "../objects/transactional";
import { ObjectTransactionalHandler } from "../objects/transactional";
export async function handleFileUpload(
h3: H3Event<EventHandlerRequest>,

View File

@@ -1,4 +1,4 @@
import { FilterConditionally } from "./types";
import type { FilterConditionally } from "./types";
interface PriorityTagged<T> {
object: T,

View File

@@ -1,5 +1,6 @@
import { applicationSettings } from "../internal/config/application-configuration";
import metadataHandler, { MetadataProvider } from "../internal/metadata";
import type { MetadataProvider } from "../internal/metadata";
import metadataHandler from "../internal/metadata";
import { GiantBombProvider } from "../internal/metadata/giantbomb";
import { IGDBProvider } from "../internal/metadata/igdb";
import { ManualMetadataProvider } from "../internal/metadata/manual";