From 00be492d5e7cad6250be0e1afb1eab8ddc5fe731 Mon Sep 17 00:00:00 2001 From: Refringe Date: Thu, 16 Nov 2023 10:09:01 -0500 Subject: [PATCH] Resolves ESLint Naming Convention Issues --- project/src/controllers/RagfairController.ts | 2 +- project/src/generators/BotWeaponGenerator.ts | 1 + project/src/generators/RagfairOfferGenerator.ts | 2 +- project/src/helpers/DialogueHelper.ts | 2 +- project/src/helpers/HttpServerHelper.ts | 1 + project/src/helpers/RagfairOfferHelper.ts | 5 ++++- project/src/helpers/TraderHelper.ts | 1 + project/src/servers/http/AkiHttpListener.ts | 2 ++ project/src/services/InsuranceService.ts | 4 ++-- project/src/utils/TimeUtil.ts | 4 ++-- 10 files changed, 16 insertions(+), 8 deletions(-) diff --git a/project/src/controllers/RagfairController.ts b/project/src/controllers/RagfairController.ts index b76d12e6..9400de68 100644 --- a/project/src/controllers/RagfairController.ts +++ b/project/src/controllers/RagfairController.ts @@ -688,7 +688,7 @@ export class RagfairController const pmcData = this.saveServer.getProfile(sessionID).characters.pmc; const offers = pmcData.RagfairInfo.offers; const index = offers.findIndex((offer) => offer._id === info.offerId); - const secondsToAdd = info.renewalTime * TimeUtil.oneHourAsSeconds; + const secondsToAdd = info.renewalTime * TimeUtil.ONE_HOUR_AS_SECONDS; if (index === -1) { diff --git a/project/src/generators/BotWeaponGenerator.ts b/project/src/generators/BotWeaponGenerator.ts index 43a8e1ef..e0f2551a 100644 --- a/project/src/generators/BotWeaponGenerator.ts +++ b/project/src/generators/BotWeaponGenerator.ts @@ -485,6 +485,7 @@ export class BotWeaponGenerator // Define min/max of how many grenades bot will have const ubglMinMax: GenerationData = { + // eslint-disable-next-line @typescript-eslint/naming-convention weights: { "1": 1, "2": 1 }, whitelist: [], }; diff --git a/project/src/generators/RagfairOfferGenerator.ts b/project/src/generators/RagfairOfferGenerator.ts index 3fba7154..6c63def2 100644 --- a/project/src/generators/RagfairOfferGenerator.ts +++ b/project/src/generators/RagfairOfferGenerator.ts @@ -279,7 +279,7 @@ export class RagfairOfferGenerator if (this.ragfairServerHelper.isPlayer(userID)) { // Player offer - return this.timeUtil.getTimestamp() + Math.round(12 * TimeUtil.oneHourAsSeconds); + return this.timeUtil.getTimestamp() + Math.round(12 * TimeUtil.ONE_HOUR_AS_SECONDS); } if (this.ragfairServerHelper.isTrader(userID)) diff --git a/project/src/helpers/DialogueHelper.ts b/project/src/helpers/DialogueHelper.ts index 90a69dfc..f2ce8f9c 100644 --- a/project/src/helpers/DialogueHelper.ts +++ b/project/src/helpers/DialogueHelper.ts @@ -43,7 +43,7 @@ export class DialogueHelper if (maxStoreTime) { - result.maxStorageTime = maxStoreTime * TimeUtil.oneHourAsSeconds; + result.maxStorageTime = maxStoreTime * TimeUtil.ONE_HOUR_AS_SECONDS; } return result; diff --git a/project/src/helpers/HttpServerHelper.ts b/project/src/helpers/HttpServerHelper.ts index 0d20a236..d647c047 100644 --- a/project/src/helpers/HttpServerHelper.ts +++ b/project/src/helpers/HttpServerHelper.ts @@ -57,6 +57,7 @@ export class HttpServerHelper public sendTextJson(resp: any, output: any): void { + // eslint-disable-next-line @typescript-eslint/naming-convention resp.writeHead(200, "OK", { "Content-Type": this.mime.json }); resp.end(output); } diff --git a/project/src/helpers/RagfairOfferHelper.ts b/project/src/helpers/RagfairOfferHelper.ts index 1c09f087..e64998ef 100644 --- a/project/src/helpers/RagfairOfferHelper.ts +++ b/project/src/helpers/RagfairOfferHelper.ts @@ -566,7 +566,10 @@ export class RagfairOfferHelper return false; } - if (searchRequest.oneHourExpiration && offer.endTime - this.timeUtil.getTimestamp() > TimeUtil.oneHourAsSeconds) + if ( + searchRequest.oneHourExpiration + && offer.endTime - this.timeUtil.getTimestamp() > TimeUtil.ONE_HOUR_AS_SECONDS + ) { // offer doesnt expire within an hour return false; diff --git a/project/src/helpers/TraderHelper.ts b/project/src/helpers/TraderHelper.ts index ab315bbc..fc2fa31f 100644 --- a/project/src/helpers/TraderHelper.ts +++ b/project/src/helpers/TraderHelper.ts @@ -302,6 +302,7 @@ export class TraderHelper */ public addTraderPurchasesToPlayerProfile( sessionID: string, + // eslint-disable-next-line @typescript-eslint/naming-convention newPurchaseDetails: { items: { item_id: string; count: number; }[]; tid: string; }, ): void { diff --git a/project/src/servers/http/AkiHttpListener.ts b/project/src/servers/http/AkiHttpListener.ts index f2605086..cc48eb62 100644 --- a/project/src/servers/http/AkiHttpListener.ts +++ b/project/src/servers/http/AkiHttpListener.ts @@ -167,12 +167,14 @@ export class AkiHttpListener implements IHttpListener public sendJson(resp: ServerResponse, output: string, sessionID: string): void { + // eslint-disable-next-line @typescript-eslint/naming-convention resp.writeHead(200, "OK", { "Content-Type": "application/json", "Set-Cookie": `PHPSESSID=${sessionID}` }); resp.end(output); } public sendZlibJson(resp: ServerResponse, output: string, sessionID: string): void { + // eslint-disable-next-line @typescript-eslint/naming-convention resp.writeHead(200, "OK", { "Content-Type": "application/json", "Set-Cookie": `PHPSESSID=${sessionID}` }); zlib.deflate(output, (_, buf) => resp.end(buf)); } diff --git a/project/src/services/InsuranceService.ts b/project/src/services/InsuranceService.ts index c7ac6a21..122dabd1 100644 --- a/project/src/services/InsuranceService.ts +++ b/project/src/services/InsuranceService.ts @@ -205,8 +205,8 @@ export class InsuranceService const insuranceReturnTimeBonusPercent = 1.0 - (insuranceReturnTimeBonus ? Math.abs(insuranceReturnTimeBonus.value) : 0) / 100; - const traderMinReturnAsSeconds = trader.insurance.min_return_hour * TimeUtil.oneHourAsSeconds; - const traderMaxReturnAsSeconds = trader.insurance.max_return_hour * TimeUtil.oneHourAsSeconds; + const traderMinReturnAsSeconds = trader.insurance.min_return_hour * TimeUtil.ONE_HOUR_AS_SECONDS; + const traderMaxReturnAsSeconds = trader.insurance.max_return_hour * TimeUtil.ONE_HOUR_AS_SECONDS; const randomisedReturnTimeSeconds = this.randomUtil.getInt(traderMinReturnAsSeconds, traderMaxReturnAsSeconds); // Current time + randomised time calculated above diff --git a/project/src/utils/TimeUtil.ts b/project/src/utils/TimeUtil.ts index a74cc943..bea77e43 100644 --- a/project/src/utils/TimeUtil.ts +++ b/project/src/utils/TimeUtil.ts @@ -7,7 +7,7 @@ import { injectable } from "tsyringe"; @injectable() export class TimeUtil { - public static readonly oneHourAsSeconds = 3600; // Number of seconds in one hour. + public static readonly ONE_HOUR_AS_SECONDS = 3600; // Number of seconds in one hour. /** * Pads a number with a leading zero if it is less than 10. @@ -106,6 +106,6 @@ export class TimeUtil */ public getHoursAsSeconds(hours: number): number { - return hours * TimeUtil.oneHourAsSeconds; + return hours * TimeUtil.ONE_HOUR_AS_SECONDS; } }