From 7f2d7bab007f4cc51eda32edd41be0371edcc9c0 Mon Sep 17 00:00:00 2001 From: TSR Berry <20988865+TSRBerry@users.noreply.github.com> Date: Fri, 8 Mar 2024 23:23:31 +0100 Subject: [PATCH] Update no-unused-vars rule --- .eslintrc.js | 14 ++++++++++++++ src/api.ts | 4 ++-- src/middleware.ts | 8 ++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 0c9b837..0f65f50 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,4 +4,18 @@ module.exports = { parser: '@typescript-eslint/parser', plugins: ['@typescript-eslint'], root: true, + rules: { + "@typescript-eslint/no-unused-vars": [ + "error", + { + "args": "all", + "argsIgnorePattern": "^_", + "caughtErrors": "all", + "caughtErrorsIgnorePattern": "^_", + "destructuredArrayIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "ignoreRestSiblings": true + } + ] + } }; diff --git a/src/api.ts b/src/api.ts index 0e3d91a..e9b79ec 100644 --- a/src/api.ts +++ b/src/api.ts @@ -3,7 +3,7 @@ import { redisClient } from "./app"; const router = Router(); -router.get("/", async (req, res, next) => { +router.get("/", async (_req, res, _next) => { if (!redisClient.isOpen) { await redisClient.connect(); } @@ -17,7 +17,7 @@ router.get("/", async (req, res, next) => { return res.send(result); }); -router.get("/public_games", async (req, res, next) => { +router.get("/public_games", async (req, res, _next) => { let gameFilter = ""; if (req.query.titleid != null && (req.query.titleid as string)?.length > 0) { diff --git a/src/middleware.ts b/src/middleware.ts index f1ffced..18ed568 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -2,7 +2,11 @@ import { Request, Response, NextFunction } from "express"; import { logger } from "./app"; import { loggerDefaultMetadata } from "./utils"; -export function requestLogger(req: Request, res: Response, next: NextFunction) { +export function requestLogger( + req: Request, + _res: Response, + next: NextFunction +) { logger.debug("Incoming request.", loggerDefaultMetadata(req)); next(); } @@ -10,7 +14,7 @@ export function requestLogger(req: Request, res: Response, next: NextFunction) { export function errorLogger( err: Error, req: Request, - res: Response, + _res: Response, next: NextFunction ) { logger.error(err.message, {