From 866558251323766042794445cc37492238d6fc06 Mon Sep 17 00:00:00 2001 From: Tatsuto YAMAMOTO Date: Tue, 8 Aug 2023 23:06:51 +0900 Subject: [PATCH] =?UTF-8?q?fix(lint):=20Lint=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E3=82=92=E8=A7=A3=E6=B6=88=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/repository/inmemory/media.ts | 3 ++- src/repository/inmemory/post.ts | 13 +++++++------ src/repository/inmemory/server.ts | 3 ++- src/repository/inmemory/user.ts | 7 ++++--- src/repository/prisma/post.ts | 1 + src/repository/prisma/user.ts | 1 + src/server/controller/post.ts | 4 +--- src/server/handlers/activitypub/nodeinfo.ts | 2 +- src/server/handlers/post.ts | 5 ++++- src/server/start.ts | 3 ++- src/service/data/user.ts | 1 + 11 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/repository/inmemory/media.ts b/src/repository/inmemory/media.ts index 66233f4..c1608de 100644 --- a/src/repository/inmemory/media.ts +++ b/src/repository/inmemory/media.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { IMediaRepository } from "../media.js"; import { Media } from "../../domain/media.js"; import { Failure, Result, Success } from "../../helpers/result.js"; @@ -49,7 +50,7 @@ export class MediaRepository implements IMediaRepository { } } - async Update(m: Media): Promise> { + async Update(): Promise> { return new Failure(new Error("")); } } diff --git a/src/repository/inmemory/post.ts b/src/repository/inmemory/post.ts index a3ca2dd..568c49a 100644 --- a/src/repository/inmemory/post.ts +++ b/src/repository/inmemory/post.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { IPostRepository } from "../post.js"; import { AsyncResult, Failure, Result, Success } from "../../helpers/result.js"; import { Post } from "../../domain/post.js"; @@ -41,18 +42,18 @@ export class PostRepository implements IPostRepository { } } - async Update(p: Post): Promise> { + async Update(): Promise> { return new Failure(new Error("")); } - async Delete(id: Snowflake): AsyncResult { + async Delete(): AsyncResult { return new Failure(new Error("todo")); } - async ChronologicalPosts( - userID: Snowflake, - cursor: number, - ): AsyncResult<{ posts: Post; author: User }[], Error> { + async ChronologicalPosts(): AsyncResult< + { posts: Post; author: User }[], + Error + > { try { // ToDo: 自分がフォローしているユーザーの投稿の取得 [...this.data].filter((v) => { diff --git a/src/repository/inmemory/server.ts b/src/repository/inmemory/server.ts index aab722e..17ef4e8 100644 --- a/src/repository/inmemory/server.ts +++ b/src/repository/inmemory/server.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { IServerRepository } from "../server.js"; import { Server } from "../../domain/server.js"; import { Failure, Result, Success } from "../../helpers/result.js"; @@ -37,7 +38,7 @@ export class ServerRepository implements IServerRepository { } } - async Update(s: Server): Promise> { + async Update(): Promise> { return new Failure(new Error("")); } } diff --git a/src/repository/inmemory/user.ts b/src/repository/inmemory/user.ts index 648672e..6fbc63d 100644 --- a/src/repository/inmemory/user.ts +++ b/src/repository/inmemory/user.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { IUserRepository } from "../user.js"; import { AsyncResult, Failure, Result, Success } from "../../helpers/result.js"; import { User } from "../../domain/user.js"; @@ -38,12 +39,12 @@ export class UserRepository implements IUserRepository { } } - async Update(u: User): Promise> { + async Update(): Promise> { return new Failure(new Error("")); } // 指定したユーザーがフォローしているユーザー一覧を取得 - async FindFollowing(id: Snowflake): AsyncResult, Error> { + async FindFollowing(): AsyncResult, Error> { try { // ToDo: 実装する return new Success(new Array()); @@ -55,7 +56,7 @@ export class UserRepository implements IUserRepository { } // 指定したユーザーをフォローしているユーザー一覧を取得 - async FindFollower(id: Snowflake): AsyncResult, Error> { + async FindFollower(): AsyncResult, Error> { try { // ToDo: 実装する return new Success(new Array()); diff --git a/src/repository/prisma/post.ts b/src/repository/prisma/post.ts index ea7079b..4980b82 100644 --- a/src/repository/prisma/post.ts +++ b/src/repository/prisma/post.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { IPostRepository } from "../post.js"; import { AsyncResult, Failure, Result, Success } from "../../helpers/result.js"; import { Post, PostReactionEvent } from "../../domain/post.js"; diff --git a/src/repository/prisma/user.ts b/src/repository/prisma/user.ts index 15fa15b..4fced51 100644 --- a/src/repository/prisma/user.ts +++ b/src/repository/prisma/user.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { IUserRepository } from "../user.js"; import { AsyncResult, Failure, Result, Success } from "../../helpers/result.js"; import { User, UserAPData, UserFollowEvent } from "../../domain/user.js"; diff --git a/src/server/controller/post.ts b/src/server/controller/post.ts index 0639578..0d7d9aa 100644 --- a/src/server/controller/post.ts +++ b/src/server/controller/post.ts @@ -59,9 +59,7 @@ export class PostController { ); } - async FindByHandle( - handle: string, - ): AsyncResult, Error> { + async FindByHandle(): AsyncResult, Error> { // ToDo: Implement return new Success(Array()); } diff --git a/src/server/handlers/activitypub/nodeinfo.ts b/src/server/handlers/activitypub/nodeinfo.ts index ba15757..6c102f1 100644 --- a/src/server/handlers/activitypub/nodeinfo.ts +++ b/src/server/handlers/activitypub/nodeinfo.ts @@ -7,7 +7,7 @@ export class NodeInfoHandlers { this.controller = c; } - public Handle: FastifyHandlerMethod<{}> = async (q, r) => { + public Handle: FastifyHandlerMethod<{ Params: object }> = async (q, r) => { const res = this.controller.Handle(); return r.code(200).send(res); }; diff --git a/src/server/handlers/post.ts b/src/server/handlers/post.ts index 58b3f2b..125aeeb 100644 --- a/src/server/handlers/post.ts +++ b/src/server/handlers/post.ts @@ -51,7 +51,10 @@ export class PostHandler { r.code(204).send(); }; - public GetTimeline: FastifyHandlerMethod<{}> = async (q, r) => { + public GetTimeline: FastifyHandlerMethod<{ Params: object }> = async ( + q, + r, + ) => { const res = await this.controller.ChronologicalPosts("123"); if (res.isFailure()) { const [code, message] = ErrorConverter(res.value); diff --git a/src/server/start.ts b/src/server/start.ts index 0826164..d87983d 100644 --- a/src/server/start.ts +++ b/src/server/start.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { fastify } from "fastify"; import { PostHandler } from "./handlers/post.js"; import { PostRepository } from "../repository/prisma/post.js"; @@ -79,7 +80,7 @@ export async function StartServer(port: number) { const personHandler = new PersonHandler( new PersonController(new FindUserService(userRepository)), ); - app.get("/", (q, s) => { + app.get("/", () => { return { version: "Qip2 Server v0.0.1 (pre-alpha)" }; }); diff --git a/src/service/data/user.ts b/src/service/data/user.ts index f69d67c..88553cd 100644 --- a/src/service/data/user.ts +++ b/src/service/data/user.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { Snowflake } from "../../helpers/id_generator.js"; import { User, UserAPData, UserFollowEvent } from "../../domain/user.js";