diff --git a/project/.eslintrc.json b/project/.eslintrc.json index 2923eff8..49d679c8 100644 --- a/project/.eslintrc.json +++ b/project/.eslintrc.json @@ -68,7 +68,13 @@ "ignoreRegExpLiterals": true }], "@stylistic/multiline-ternary": ["error", "always-multiline"], - "@stylistic/no-extra-parens": ["error", "all"], + "@stylistic/no-confusing-arrow": ["error", {"allowParens": true}], + "@stylistic/no-extra-parens": ["error", "all", { + "returnAssign": false, + "nestedBinaryExpressions": false, + "ternaryOperandBinaryExpressions": false, + "enforceForArrowConditionals": false + }], "@stylistic/new-parens": "error", "@stylistic/newline-per-chained-call": ["error", { "ignoreChainWithDepth": 3 }], "@stylistic/no-extra-semi": "error", diff --git a/project/src/controllers/GameController.ts b/project/src/controllers/GameController.ts index 56754f03..79b211ae 100644 --- a/project/src/controllers/GameController.ts +++ b/project/src/controllers/GameController.ts @@ -738,13 +738,13 @@ export class GameController const currentTimeStamp = this.timeUtil.getTimestamp(); // One day post-profile creation - if (currentTimeStamp > timeStampProfileCreated + oneDaySeconds) + if (currentTimeStamp > (timeStampProfileCreated + oneDaySeconds)) { this.giftService.sendPraporStartingGift(pmcProfile.sessionId, 1); } // Two day post-profile creation - if (currentTimeStamp > timeStampProfileCreated + oneDaySeconds * 2) + if (currentTimeStamp > (timeStampProfileCreated + oneDaySeconds * 2)) { this.giftService.sendPraporStartingGift(pmcProfile.sessionId, 2); } diff --git a/project/src/controllers/InventoryController.ts b/project/src/controllers/InventoryController.ts index ca944493..e6a9d8e1 100644 --- a/project/src/controllers/InventoryController.ts +++ b/project/src/controllers/InventoryController.ts @@ -168,7 +168,7 @@ export class InventoryController return; } - const profileToRemoveItemFrom = !request.fromOwner || request.fromOwner.id === pmcData._id + const profileToRemoveItemFrom = (!request.fromOwner || request.fromOwner.id === pmcData._id) ? pmcData : this.profileHelper.getFullProfile(sessionID).characters.scav; diff --git a/project/src/controllers/ProfileController.ts b/project/src/controllers/ProfileController.ts index ba0cc4dc..d7f9bedb 100644 --- a/project/src/controllers/ProfileController.ts +++ b/project/src/controllers/ProfileController.ts @@ -152,7 +152,7 @@ export class ProfileController pmcData.Customization.Head = info.headId; pmcData.Health.UpdateTime = this.timeUtil.getTimestamp(); pmcData.Quests = []; - pmcData.Hideout.Seed = this.timeUtil.getTimestamp() + 8 * 60 * 60 * 24 * 365; // 8 years in future why? who knows, we saw it in live + pmcData.Hideout.Seed = this.timeUtil.getTimestamp() + (8 * 60 * 60 * 24 * 365); // 8 years in future why? who knows, we saw it in live pmcData.RepeatableQuests = []; pmcData.CarExtractCounts = {}; pmcData.CoopExtractCounts = {}; diff --git a/project/src/controllers/QuestController.ts b/project/src/controllers/QuestController.ts index ebe61769..cc8e7e80 100644 --- a/project/src/controllers/QuestController.ts +++ b/project/src/controllers/QuestController.ts @@ -863,7 +863,7 @@ export class QuestController childItems.shift(); // Remove the parent // Sort by the current `location` and update - childItems.sort((a, b) => a.location > b.location ? 1 : -1); + childItems.sort((a, b) => (a.location > b.location ? 1 : -1)); for (const [index, item] of childItems.entries()) { item.location = index; diff --git a/project/src/controllers/RepeatableQuestController.ts b/project/src/controllers/RepeatableQuestController.ts index 6b9cebac..db06db64 100644 --- a/project/src/controllers/RepeatableQuestController.ts +++ b/project/src/controllers/RepeatableQuestController.ts @@ -99,8 +99,8 @@ export class RepeatableQuestController const currentRepeatableQuestType = this.getRepeatableQuestSubTypeFromProfile(repeatableConfig, pmcData); if ( - repeatableConfig.side === "Pmc" && pmcData.Info.Level >= repeatableConfig.minPlayerLevel - || repeatableConfig.side === "Scav" && scavQuestUnlocked + (repeatableConfig.side === "Pmc" && pmcData.Info.Level >= repeatableConfig.minPlayerLevel) + || (repeatableConfig.side === "Scav" && scavQuestUnlocked) ) { if (time > currentRepeatableQuestType.endTime - 1) diff --git a/project/src/generators/BotLootGenerator.ts b/project/src/generators/BotLootGenerator.ts index f9523e20..b9ec4192 100644 --- a/project/src/generators/BotLootGenerator.ts +++ b/project/src/generators/BotLootGenerator.ts @@ -291,7 +291,7 @@ export class BotLootGenerator // Secure // only add if not a pmc or is pmc and flag is true - if (!isPmc || isPmc && this.pmcConfig.addSecureContainerLootFromBotConfig) + if (!isPmc || (isPmc && this.pmcConfig.addSecureContainerLootFromBotConfig)) { this.addLootFromPool( this.botLootCacheService.getLootFromCache(botRole, isPmc, LootCacheType.SECURE, botJsonTemplate), diff --git a/project/src/helpers/QuestHelper.ts b/project/src/helpers/QuestHelper.ts index 0a9c0700..6d461838 100644 --- a/project/src/helpers/QuestHelper.ts +++ b/project/src/helpers/QuestHelper.ts @@ -385,7 +385,7 @@ export class QuestHelper { // Iterate over all rewards with the desired status, flatten out items that have a type of Item const questRewards = quest.rewards[QuestStatus[status]].flatMap((reward: IQuestReward) => - reward.type === "Item" ? this.processReward(reward) : [], + (reward.type === "Item" ? this.processReward(reward) : []), ); return questRewards; diff --git a/project/src/services/FenceService.ts b/project/src/services/FenceService.ts index a8a2f631..c1ce8f01 100644 --- a/project/src/services/FenceService.ts +++ b/project/src/services/FenceService.ts @@ -759,7 +759,7 @@ export class FenceService const itemIsPreset = this.presetHelper.isPreset(chosenBaseAssortRoot._id); const price = baseFenceAssortClone.barter_scheme[chosenBaseAssortRoot._id][0][0].count; - if (price === 0 || price === 1 && !itemIsPreset || price === 100) + if (price === 0 || (price === 1 && !itemIsPreset) || price === 100) { // Don't allow "special" items / presets i--; diff --git a/project/src/services/InsuranceService.ts b/project/src/services/InsuranceService.ts index b031977b..1c9fea39 100644 --- a/project/src/services/InsuranceService.ts +++ b/project/src/services/InsuranceService.ts @@ -249,7 +249,7 @@ export class InsuranceService // Check if item missing in post-raid gear OR player died + item slot flagged as lost on death // Catches both events: player died with item on + player survived but dropped item in raid - if (!itemOnPlayerPostRaid || playerDied && itemShouldBeLostOnDeath) + if (!itemOnPlayerPostRaid || (playerDied && itemShouldBeLostOnDeath)) { equipmentPkg.push({ pmcData: pmcData, diff --git a/project/src/services/ProfileFixerService.ts b/project/src/services/ProfileFixerService.ts index 199b60a6..5d5c59af 100644 --- a/project/src/services/ProfileFixerService.ts +++ b/project/src/services/ProfileFixerService.ts @@ -699,7 +699,7 @@ export class ProfileFixerService // Have an item property and it has at least one item in it // Or // Have no item property - area.slots = area.slots.filter(x => "item" in x && x.item?.length > 0 || !("item" in x)); + area.slots = area.slots.filter(x => ("item" in x && x.item?.length > 0) || !("item" in x)); } }