Take your brackets back!

I don't want em'. Grumble. Ahem...

This change allows for "extra" parentheses to be added in situations where, without them, the code could possibly, potentially be seen as maybe a little-bit, tiny confusing.

Also, fixes a bunch of other ESLint errors. Mostly down to naming warnings now. Mostly.
This commit is contained in:
Refringe 2024-05-13 17:03:47 -04:00
parent 65e2b87190
commit 14e8f8fa19
No known key found for this signature in database
GPG Key ID: 7715B85B4A6306ED
11 changed files with 19 additions and 13 deletions

View File

@ -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",

View File

@ -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);
}

View File

@ -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;

View File

@ -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 = {};

View File

@ -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;

View File

@ -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)

View File

@ -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),

View File

@ -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;

View File

@ -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--;

View File

@ -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,

View File

@ -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));
}
}