Fixes Linting Issues

Fixes a number of Biome linting issues:
- Variable implicitly has the any type.
- Use a function type instead of a call signature.
- Reassigning a function parameter is confusing.
- Suppression comment is not being used
This commit is contained in:
Refringe 2024-04-22 23:43:35 -04:00
parent a572e8e67e
commit 01d97953fa
No known key found for this signature in database
GPG Key ID: 7715B85B4A6306ED
6 changed files with 34 additions and 22 deletions

View File

@ -270,13 +270,14 @@ export class PMCLootGenerator
protected gcd(a: number, b: number): number
{
while (b !== 0)
let x = a;
let y = b;
while (y !== 0)
{
const temp = b;
b = a % b;
a = temp;
const temp = y;
y = x % y;
x = temp;
}
return a;
return x;
}
}

View File

@ -37,6 +37,8 @@ export class AssortHelper
flea = false,
): ITraderAssort
{
let strippedTraderAssorts = traderAssorts;
// Trader assort does not always contain loyal_level_items
if (!traderAssorts.loyal_level_items)
{
@ -59,11 +61,11 @@ export class AssortHelper
const questStatusInProfile = this.questHelper.getQuestStatus(pmcProfile, unlockValues.questId);
if (!unlockValues.status.includes(questStatusInProfile))
{
traderAssorts = this.removeItemFromAssort(traderAssorts, assortId, flea);
strippedTraderAssorts = this.removeItemFromAssort(traderAssorts, assortId, flea);
}
}
return traderAssorts;
return strippedTraderAssorts;
}
/**
@ -108,12 +110,14 @@ export class AssortHelper
*/
public stripLockedLoyaltyAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort): ITraderAssort
{
let strippedAssort = assort;
// Trader assort does not always contain loyal_level_items
if (!assort.loyal_level_items)
{
this.logger.warning(this.localisationService.getText("assort-missing_loyalty_level_object", traderId));
return assort;
return strippedAssort;
}
// Remove items restricted by loyalty levels above those reached by the player
@ -121,11 +125,11 @@ export class AssortHelper
{
if (assort.loyal_level_items[itemId] > pmcProfile.TradersInfo[traderId].loyaltyLevel)
{
assort = this.removeItemFromAssort(assort, itemId);
strippedAssort = this.removeItemFromAssort(assort, itemId);
}
}
return assort;
return strippedAssort;
}
/**

View File

@ -1463,7 +1463,6 @@ export class ItemHelper
const modItemDbDetails = this.getItem(modItemToAdd._tpl)[1];
// Include conflicting items of newly added mod in pool to be used for next mod choice
// biome-ignore lint/complexity/noForEach: <explanation>
modItemDbDetails._props.ConflictingItems.forEach(incompatibleModTpls.add, incompatibleModTpls);
}
@ -1472,7 +1471,7 @@ export class ItemHelper
/**
* Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter
* @param possibleTpls Tpls to randomply choose from
* @param possibleTpls Tpls to randomly choose from
* @param incompatibleModTpls Incompatible tpls to not allow
* @returns Chosen tpl or null
*/

View File

@ -692,12 +692,12 @@ export class QuestHelper
*/
public getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest
{
quest = this.jsonUtil.clone(quest);
quest.conditions.AvailableForStart = quest.conditions.AvailableForStart.filter((q) =>
const updatedQuest = this.jsonUtil.clone(quest);
updatedQuest.conditions.AvailableForStart = updatedQuest.conditions.AvailableForStart.filter((q) =>
q.conditionType === "Level"
);
return quest;
return updatedQuest;
}
/**
@ -714,14 +714,22 @@ export class QuestHelper
output: IItemEventRouterResponse = null,
): void
{
let updatedOutput = output;
// Prepare response to send back to client
if (!output)
if (!updatedOutput)
{
output = this.eventOutputHolder.getOutput(sessionID);
updatedOutput = this.eventOutputHolder.getOutput(sessionID);
}
this.updateQuestState(pmcData, QuestStatus.Fail, failRequest.qid);
const questRewards = this.applyQuestReward(pmcData, failRequest.qid, QuestStatus.Fail, sessionID, output);
const questRewards = this.applyQuestReward(
pmcData,
failRequest.qid,
QuestStatus.Fail,
sessionID,
updatedOutput,
);
// Create a dialog message for completing the quest.
const quest = this.getQuestFromDb(failRequest.qid, pmcData);
@ -747,7 +755,7 @@ export class QuestHelper
}
}
output.profileChanges[sessionID].quests.push(...this.failedUnlocked(failRequest.qid, sessionID));
updatedOutput.profileChanges[sessionID].quests.push(...this.failedUnlocked(failRequest.qid, sessionID));
}
/**

View File

@ -72,7 +72,7 @@ export class TradeHelper
): void
{
let offerItems: Item[] = [];
let buyCallback: { (buyCount: number); };
let buyCallback: (buyCount: number) => void;
if (buyRequestData.tid.toLocaleLowerCase() === "ragfair")
{
buyCallback = (buyCount: number) =>

View File

@ -134,7 +134,7 @@ export class DatabaseImporter implements OnLoad
try
{
const finalPath = filePathAndName.replace(this.filepath, "").replace(".json", "");
let tempObject;
let tempObject: any;
for (const prop of finalPath.split("/"))
{
if (!tempObject)