Lint: ts files (!82)

Co-authored-by: alimoncul <alimoncul@gmail.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/82
Co-authored-by: CZPZ <czpz@noreply.dev.sp-tarkov.com>
Co-committed-by: CZPZ <czpz@noreply.dev.sp-tarkov.com>
This commit is contained in:
CZPZ 2023-03-22 14:31:05 +00:00 committed by chomp
parent d595e26ee6
commit 8c37bc7837
63 changed files with 123 additions and 124 deletions

View File

@ -1,6 +1,6 @@
import readline from "readline";
import { ILogger } from "./models/spt/utils/ILogger";
import { AsyncQueue } from "./utils/AyncQueue";
import { AsyncQueue } from "./utils/AsyncQueue";
import { WinstonMainLogger } from "./utils/logging/WinstonMainLogger";
import { UUidGenerator } from "./utils/UUidGenerator";

View File

@ -158,7 +158,6 @@ export class DataCallbacks
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetItemPricesResponse>
{
const traderId = url.replace("/client/items/prices/", "");
const handbookPrices = this.ragfairController.getStaticPrices();
const response: IGetItemPricesResponse = {
supplyNextTime: 1672236024, // todo: get trader refresh time?

View File

@ -227,7 +227,7 @@ import { SeasonalEventService } from "../services/SeasonalEventService";
import { TraderAssortService } from "../services/TraderAssortService";
import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService";
import { App } from "../utils/App";
import { AsyncQueue } from "../utils/AyncQueue";
import { AsyncQueue } from "../utils/AsyncQueue";
import { DatabaseImporter } from "../utils/DatabaseImporter";
import { EncodingUtil } from "../utils/EncodingUtil";
import { HashUtil } from "../utils/HashUtil";

View File

@ -1,4 +1,4 @@
import { ILocations } from "../../spt/server/ILocations"
import { ILocations } from "../../spt/server/ILocations";
export interface ILocationsGenerateAllResponse
{

View File

@ -1,4 +1,4 @@
import { Item } from "./IItem"
import { Item } from "./IItem";
export interface ILootBase
{

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { Item } from "./IItem"
import { Item } from "./IItem";
export interface ITrader
{

View File

@ -1,4 +1,4 @@
import { Message } from "../profile/IAkiProfile"
import { Message } from "../profile/IAkiProfile";
export interface IGetAllAttachmentsResponse
{

View File

@ -1,4 +1,4 @@
import { MemberCategory } from "../../enums/MemberCategory"
import { MemberCategory } from "../../enums/MemberCategory";
export interface IGetFriendListDataResponse
{

View File

@ -1,4 +1,4 @@
import { MessageType } from "../../enums/MessageType"
import { MessageType } from "../../enums/MessageType";
export interface ISendMessageRequest
{

View File

@ -1,4 +1,4 @@
import { IBaseInteractionRequestData } from "../common/request/IBaseInteractionRequestData"
import { IBaseInteractionRequestData } from "../common/request/IBaseInteractionRequestData";
export interface IOffraidEatRequestData extends IBaseInteractionRequestData
{

View File

@ -1,4 +1,4 @@
import { IBaseInteractionRequestData } from "../common/request/IBaseInteractionRequestData"
import { IBaseInteractionRequestData } from "../common/request/IBaseInteractionRequestData";
export interface IOffraidHealRequestData extends IBaseInteractionRequestData
{

View File

@ -1,4 +1,4 @@
import { MinMax } from "../../common/MinMax"
import { MinMax } from "../../common/MinMax";
export interface IHideoutScavCase
{

View File

@ -1,5 +1,5 @@
import { IPmcData } from "../common/IPmcData"
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"
import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
export interface ISaveProgressRequestData
{

View File

@ -1,4 +1,4 @@
import { IBaseInteractionRequestData } from "../common/request/IBaseInteractionRequestData"
import { IBaseInteractionRequestData } from "../common/request/IBaseInteractionRequestData";
export interface IInsureRequestData extends IBaseInteractionRequestData
{

View File

@ -1,4 +1,4 @@
import { Item, Location } from "../common/tables/IItem"
import { Item, Location } from "../common/tables/IItem";
export interface IAddItemTempObject
{

View File

@ -1,4 +1,4 @@
import { IBaseInteractionRequestData } from "../common/request/IBaseInteractionRequestData"
import { IBaseInteractionRequestData } from "../common/request/IBaseInteractionRequestData";
export interface IInventoryBaseActionRequestData extends IBaseInteractionRequestData
{

View File

@ -1,4 +1,4 @@
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData";
export interface IInventoryCreateMarkerRequestData extends IInventoryBaseActionRequestData
{

View File

@ -1,4 +1,4 @@
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData";
export interface IInventoryDeleteMarkerRequestData extends IInventoryBaseActionRequestData
{

View File

@ -1,4 +1,4 @@
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData";
export interface IInventoryEditMarkerRequestData extends IInventoryBaseActionRequestData
{

View File

@ -1,4 +1,4 @@
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData";
export interface IInventoryExamineRequestData extends IInventoryBaseActionRequestData
{

View File

@ -1,4 +1,4 @@
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData";
export interface IInventoryFoldRequestData extends IInventoryBaseActionRequestData
{

View File

@ -1,4 +1,4 @@
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData";
export interface IInventoryMergeRequestData extends IInventoryBaseActionRequestData
{

View File

@ -1,4 +1,4 @@
import { IInventoryBaseActionRequestData, To } from "./IInventoryBaseActionRequestData"
import { IInventoryBaseActionRequestData, To } from "./IInventoryBaseActionRequestData";
export interface IInventoryMoveRequestData extends IInventoryBaseActionRequestData
{

View File

@ -1,4 +1,4 @@
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData";
export interface IInventoryReadEncyclopediaRequestData extends IInventoryBaseActionRequestData
{

View File

@ -1,4 +1,4 @@
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData";
export interface IInventoryRemoveRequestData extends IInventoryBaseActionRequestData
{

View File

@ -1,5 +1,5 @@
import { Upd } from "../common/tables/IItem"
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"
import { Upd } from "../common/tables/IItem";
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData";
export interface IInventorySortRequestData extends IInventoryBaseActionRequestData
{

View File

@ -1,4 +1,4 @@
import { Container, IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"
import { Container, IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData";
export interface IInventorySplitRequestData extends IInventoryBaseActionRequestData
{

View File

@ -1,4 +1,4 @@
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData";
export interface IInventoryTagRequestData extends IInventoryBaseActionRequestData
{

View File

@ -1,4 +1,4 @@
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData";
export interface IInventoryToggleRequestData extends IInventoryBaseActionRequestData
{

View File

@ -1,4 +1,4 @@
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"
import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData";
export interface IInventoryTransferRequestData extends IInventoryBaseActionRequestData
{

View File

@ -1,4 +1,4 @@
import { IItemEventRouterBase } from "./IItemEventRouterBase"
import { IItemEventRouterBase } from "./IItemEventRouterBase";
export interface IItemEventRouterResponse extends IItemEventRouterBase
{}

View File

@ -1,4 +1,4 @@
import { RaidMode } from "../../enums/RaidMode"
import { RaidMode } from "../../enums/RaidMode";
export interface ICreateGroupRequestData
{

View File

@ -1,4 +1,4 @@
import { RaidMode } from "../../enums/RaidMode"
import { RaidMode } from "../../enums/RaidMode";
export interface IGetGroupStatusRequestData
{

View File

@ -1,4 +1,4 @@
import { INotifierChannel } from "./INotifier"
import { INotifierChannel } from "./INotifier";
export interface ISelectProfileResponse
{

View File

@ -1,4 +1,4 @@
import { Skills } from "../common/tables/IBotBase"
import { Skills } from "../common/tables/IBotBase";
export interface IPlayerIncrementSkillLevelRequestData
{

View File

@ -1,4 +1,4 @@
import { IRagfairOffer } from "./IRagfairOffer"
import { IRagfairOffer } from "./IRagfairOffer";
export interface IGetOffersResult
{

View File

@ -1,4 +1,4 @@
import { RagfairSort } from "../../enums/RagfairSort"
import { RagfairSort } from "../../enums/RagfairSort";
export interface ISearchRequestData
{

View File

@ -1,4 +1,4 @@
import { IBaseRepairActionDataRequest } from "./IBaseRepairActionDataRequest"
import { IBaseRepairActionDataRequest } from "./IBaseRepairActionDataRequest";
export interface ITraderRepairActionDataRequest extends IBaseRepairActionDataRequest
{

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { IProcessBaseTradeRequestData } from "./IProcessBaseTradeRequestData"
import { IProcessBaseTradeRequestData } from "./IProcessBaseTradeRequestData";
export interface IProcessBuyTradeRequestData extends IProcessBaseTradeRequestData
{

View File

@ -1,4 +1,4 @@
import { IProcessBaseTradeRequestData } from "./IProcessBaseTradeRequestData"
import { IProcessBaseTradeRequestData } from "./IProcessBaseTradeRequestData";
export interface IProcessSellTradeRequestData extends IProcessBaseTradeRequestData
{

View File

@ -19,7 +19,7 @@ export const Listen = (basePath: string) =>
return class extends Base
{
// Record of each handler per HTTP method and path
handlers: Partial<Record<HttpMethods, Record<string, HandleFn>>>
handlers: Partial<Record<HttpMethods, Record<string, HandleFn>>>;
constructor(...args: any[])
{
@ -33,7 +33,7 @@ export const Listen = (basePath: string) =>
// Add each flagged handler to the Record
handlersArray.forEach(({ handlerName, path, httpMethod }) =>
{
if (!this.handlers[httpMethod]) this.handlers[httpMethod] = {}
if (!this.handlers[httpMethod]) this.handlers[httpMethod] = {};
if (this[handlerName] !== undefined && typeof this[handlerName] === "function")
{
@ -53,8 +53,8 @@ export const Listen = (basePath: string) =>
const routesHandles = this.handlers[req.method];
return Object.keys(this.handlers).some(meth => meth === req.method) &&
Object.keys(routesHandles).some(route => (new RegExp(route)).test(req.url))
}
Object.keys(routesHandles).some(route => (new RegExp(route)).test(req.url));
};
// The actual handle method dispatches the request to the registered handlers
handle = (sessionID: string, req: IncomingMessage, resp: ServerResponse): void =>
@ -70,11 +70,11 @@ export const Listen = (basePath: string) =>
// Filter to select valid routes but only use the first element since it's the most precise
const validRoutes = routes.filter(handlerKey => (new RegExp(handlerKey)).test(route));
if (validRoutes.length > 0) routesHandles[validRoutes[0]](sessionID, req, resp)
}
}
}
}
if (validRoutes.length > 0) routesHandles[validRoutes[0]](sessionID, req, resp);
};
};
};
};
/**
* Internally used to create HTTP decorators.
@ -89,17 +89,17 @@ const createHttpDecorator = (httpMethod: HttpMethods) =>
return (target: any, propertyKey: string) =>
{
// If the handlers array has not been initialized yet
if (!target["handlers"]) target["handlers"] = []
if (!target["handlers"]) target["handlers"] = [];
// Flag the method as a HTTP handler
target["handlers"].push({
handlerName: propertyKey,
path,
httpMethod
})
}
}
}
});
};
};
};
/**
* HTTP DELETE decorator

View File

@ -1,17 +1,17 @@
import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"
import { ITemplateItem } from "../../eft/common/tables/ITemplateItem";
export class BotLootCache
{
backpackLoot: ITemplateItem[]
pocketLoot: ITemplateItem[]
vestLoot: ITemplateItem[]
combinedPoolLoot: ITemplateItem[]
backpackLoot: ITemplateItem[];
pocketLoot: ITemplateItem[];
vestLoot: ITemplateItem[];
combinedPoolLoot: ITemplateItem[];
specialItems: ITemplateItem[]
healingItems: ITemplateItem[]
drugItems: ITemplateItem[]
stimItems: ITemplateItem[]
grenadeItems: ITemplateItem[]
specialItems: ITemplateItem[];
healingItems: ITemplateItem[];
drugItems: ITemplateItem[];
stimItems: ITemplateItem[];
grenadeItems: ITemplateItem[];
}
export enum LootCacheType

View File

@ -1,12 +1,12 @@
import { Mods } from "../../eft/common/tables/IBotType"
import { Item } from "../../eft/common/tables/IItem"
import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"
import { Mods } from "../../eft/common/tables/IBotType";
import { Item } from "../../eft/common/tables/IItem";
import { ITemplateItem } from "../../eft/common/tables/ITemplateItem";
export class GenerateWeaponResult
{
weapon: Item[]
chosenAmmoTpl: string
chosenUbglAmmoTpl: string
weaponMods: Mods
weaponTemplate: ITemplateItem
weapon: Item[];
chosenAmmoTpl: string;
chosenUbglAmmoTpl: string;
weaponMods: Mods;
weaponTemplate: ITemplateItem;
}

View File

@ -1,4 +1,4 @@
import { IBaseConfig } from "./IBaseConfig"
import { IBaseConfig } from "./IBaseConfig";
export interface IHealthConfig extends IBaseConfig
{

View File

@ -1,4 +1,4 @@
import { IBaseConfig } from "./IBaseConfig"
import { IBaseConfig } from "./IBaseConfig";
export interface IHideoutConfig extends IBaseConfig
{

View File

@ -1,4 +1,4 @@
import { IBaseConfig } from "./IBaseConfig"
import { IBaseConfig } from "./IBaseConfig";
export interface IHttpConfig extends IBaseConfig
{

View File

@ -1,4 +1,4 @@
import { IBaseConfig } from "./IBaseConfig"
import { IBaseConfig } from "./IBaseConfig";
export interface IInRaidConfig extends IBaseConfig
{

View File

@ -1,4 +1,4 @@
import { IBaseConfig } from "./IBaseConfig"
import { IBaseConfig } from "./IBaseConfig";
export interface IInsuranceConfig extends IBaseConfig
{

View File

@ -1,4 +1,4 @@
import { IBaseConfig } from "./IBaseConfig"
import { IBaseConfig } from "./IBaseConfig";
export interface IItemConfig extends IBaseConfig
{

View File

@ -1,4 +1,4 @@
import { IBaseConfig } from "./IBaseConfig"
import { IBaseConfig } from "./IBaseConfig";
export interface ILocaleConfig extends IBaseConfig
{

View File

@ -1,5 +1,5 @@
import { MinMax } from "../../../models/common/MinMax"
import { IBaseConfig } from "./IBaseConfig"
import { MinMax } from "../../../models/common/MinMax";
import { IBaseConfig } from "./IBaseConfig";
export interface IRepairConfig extends IBaseConfig
{

View File

@ -1,5 +1,5 @@
import { MinMax } from "../../common/MinMax"
import { IBaseConfig } from "./IBaseConfig"
import { MinMax } from "../../common/MinMax";
import { IBaseConfig } from "./IBaseConfig";
export interface IScavCaseConfig extends IBaseConfig

View File

@ -1,4 +1,4 @@
import { IBaseConfig } from "./IBaseConfig"
import { IBaseConfig } from "./IBaseConfig";
export interface ISeasonalEventConfig extends IBaseConfig
{

View File

@ -3,49 +3,49 @@ import { ITemplateItem, Props } from "../../eft/common/tables/ITemplateItem";
export abstract class NewItemDetailsBase
{
/** Price of the item on flea market */
fleaPriceRoubles: number
fleaPriceRoubles: number;
/** Price of the item in the handbook */
handbookPriceRoubles: number
handbookPriceRoubles: number;
/** Handbook ParentId for the new item */
handbookParentId : string
handbookParentId : string;
/**
* A dictionary for locale settings, key = langauge (e.g. en,cn,es-mx,jp,fr)
* If a language is not included, the first item in the array will be used in its place
*/
locales: Record<string, LocaleDetails>
locales: Record<string, LocaleDetails>;
}
export class NewItemFromCloneDetails extends NewItemDetailsBase
{
/** Id of the item to copy and use as a base */
itemTplToClone: string
itemTplToClone: string;
/** Item properties that should be applied over the top of the cloned base */
overrideProperties: Props
overrideProperties: Props;
/** ParentId for the new item (item type) */
parentId: string
parentId: string;
/**
* the id the new item should have, leave blank to have one generated for you
* This is often known as the TplId, or TemplateId
*/
newId = ""
newId = "";
}
export class NewItemDetails extends NewItemDetailsBase
{
newItem: ITemplateItem
newItem: ITemplateItem;
}
export class LocaleDetails
{
name: string
shortName: string
description: string
name: string;
shortName: string;
description: string;
}
export class CreateItemResult
@ -55,7 +55,7 @@ export class CreateItemResult
this.success = false;
}
success: boolean
itemId: string
errors: string[]
success: boolean;
itemId: string;
errors: string[];
}

View File

@ -1,6 +1,6 @@
import { ILocationBase } from "../../eft/common/ILocationBase"
import { ILooseLoot } from "../../eft/common/ILooseLoot"
import { ILocationsBase } from "../../eft/common/tables/ILocationsBase"
import { ILocationBase } from "../../eft/common/ILocationBase";
import { ILooseLoot } from "../../eft/common/ILooseLoot";
import { ILocationsBase } from "../../eft/common/tables/ILocationsBase";
export interface ILocations
{

View File

@ -1,7 +1,7 @@
export class LootItem
{
id?: string
tpl: string
isPreset: boolean
stackCount: number
id?: string;
tpl: string;
isPreset: boolean;
stackCount: number;
}

View File

@ -24,7 +24,7 @@ export class ModCompilerService
let fileExists = true; // does every js file exist (been compiled before)
for (const file of modTypeScriptFiles)
{
const fileContent = this.vfs.readFile(file)
const fileContent = this.vfs.readFile(file);
tsFileContents+= fileContent;
// Does equivalent .js file exist
@ -69,7 +69,7 @@ export class ModCompilerService
{
const tranOptions: TranspileOptions = {
compilerOptions: options
}
};
for (const filePath of fileNames)
{

View File

@ -2,9 +2,6 @@ import { inject, injectable } from "tsyringe";
import { IPmcData } from "../models/eft/common/IPmcData";
import { Common } from "../models/eft/common/tables/IBotBase";
import {
IPlayerIncrementSkillLevelRequestData
} from "../models/eft/player/IPlayerIncrementSkillLevelRequestData";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { LocalisationService } from "./LocalisationService";

View File

@ -28,7 +28,7 @@ export class RagfairCategoriesService
*/
public getBespokeCategories(offers: IRagfairOffer[]): Record<string, number>
{
return this.processOffersIntoCategories(offers)
return this.processOffersIntoCategories(offers);
}
/**

View File

@ -18,7 +18,7 @@ export class RagfairRequiredItemsService
public getRequiredItemsById(searchId: string): any
{
return this.requiredItemsCache[searchId] || []
return this.requiredItemsCache[searchId] || [];
}
public buildRequiredItemTable(): void

View File

@ -3,7 +3,7 @@ import { ICommand } from "../models/spt/utils/ICommand";
export class AsyncQueue implements IAsyncQueue
{
protected commandsQueue: ICommand[]
protected commandsQueue: ICommand[];
constructor()
{
@ -23,7 +23,7 @@ export class AsyncQueue implements IAsyncQueue
await new Promise<void>(resolve =>
{
setTimeout(resolve, 100);
})
});
}
// When the command is ready, execute it

View File

@ -44,9 +44,9 @@ export abstract class AbstractWinstonLogger implements ILogger
cyanBG: "cyanBG",
whiteBG: "whiteBG"
}
}
};
protected logger: winston.Logger & SptLogger;
protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise<void>
protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise<void>;
constructor(
protected asyncQueue: IAsyncQueue,

View File

@ -7,7 +7,7 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService";
import { LocaleService } from "@spt-aki/services/LocaleService";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { AsyncQueue } from "@spt-aki/utils/AyncQueue";
import { AsyncQueue } from "@spt-aki/utils/AsyncQueue";
import { DatabaseImporter } from "@spt-aki/utils/DatabaseImporter";
import { EncodingUtil } from "@spt-aki/utils/EncodingUtil";
import { HashUtil } from "@spt-aki/utils/HashUtil";
@ -22,7 +22,8 @@ import { VFS } from "@spt-aki/utils/VFS";
import { MockHelper } from "./MockHelper";
import WinstonLogger from "./__mocks__/WinstonLogger";
export class TestHelper {
export class TestHelper
{
logger: ILogger;
asyncQueue: AsyncQueue;
uuidGenerator: UUidGenerator;
@ -44,7 +45,8 @@ export class TestHelper {
itemBaseClassService: ItemBaseClassService;
botHelper: BotHelper;
public static async fetchTestHelper() {
public static async fetchTestHelper()
{
const initTestHelper = new TestHelper();
const mockHelper = new MockHelper();
@ -60,10 +62,11 @@ export class TestHelper {
initTestHelper.importerUtil
);
await dbImporter.onLoad();
return initTestHelper
return initTestHelper;
}
constructor() {
constructor()
{
this.logger = new WinstonLogger();
this.asyncQueue = new AsyncQueue();