From c43d48f930d36b25cfc4ac41f00d799bb358a2aa Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sat, 3 Feb 2024 10:20:21 +0200 Subject: [PATCH] Upgrade deps --- app/components/AbilitiesSelector.tsx | 4 +- app/components/BuildCard.tsx | 4 +- app/db/seed/index.ts | 12 +- app/db/tables.ts | 7 +- app/features/build-analyzer/core/stats.ts | 8 +- .../build-stats/build-stats-utils.test.ts | 8 +- .../build-stats/routes/builds.$slug.stats.tsx | 2 +- app/features/builds/BuildRepository.server.ts | 6 +- .../builds/queries/buildsBy.server.ts | 6 +- app/features/builds/routes/builds.$slug.tsx | 33 +- app/features/calendar/routes/calendar.$id.tsx | 4 +- .../core/map-list-generator/map-list.ts | 2 +- .../map-list-generator/core/map-pool.ts | 2 +- .../core/objectDamage.test.ts | 10 +- .../core/objectDamage.ts | 4 +- app/features/sendouq/core/groups.server.ts | 10 +- app/features/team/routes/t.tsx | 2 +- .../top-search/routes/xsearch.player.$id.tsx | 14 +- app/features/top-search/routes/xsearch.tsx | 10 +- .../components/ScoreReporter.tsx | 4 +- .../components/TeamRosterInputs.tsx | 6 +- .../tournament-bracket/core/bestOf.server.ts | 8 +- .../tournament/routes/to.$id.join.tsx | 5 +- app/features/tournament/tournament-utils.ts | 2 +- .../user-page/routes/u.$identifier.index.tsx | 2 +- app/features/vods/routes/vods.$id.tsx | 2 +- app/features/vods/routes/vods.new.tsx | 2 +- app/modules/brackets-manager/helpers.ts | 4 +- .../generation.test.ts | 24 +- .../tournament-map-list.ts | 16 +- .../tournament-map-list-generator/utils.ts | 2 +- package-lock.json | 3498 +++++++++-------- package.json | 56 +- scripts/check-translation-jsons.ts | 9 +- tsconfig.json | 8 +- 35 files changed, 1970 insertions(+), 1826 deletions(-) diff --git a/app/components/AbilitiesSelector.tsx b/app/components/AbilitiesSelector.tsx index b3f9ecaad..0247c419f 100644 --- a/app/components/AbilitiesSelector.tsx +++ b/app/components/AbilitiesSelector.tsx @@ -179,7 +179,7 @@ function addAbility({ // were given an atRowIndex and atAbilityIndex if (canPlaceAbilityAtSlot(atRowIndex, atAbilityIndex, ability)) { // Assign this ability to the slot - abilitiesClone[atRowIndex]![atAbilityIndex] = ability.name; + abilitiesClone[atRowIndex][atAbilityIndex] = ability.name; } } else { // Loop through all slots and attempt to place this ability @@ -197,7 +197,7 @@ function addAbility({ } // Assign this ability to the slot - abilitiesClone[rowIndex]![abilityIndex] = ability.name; + abilitiesClone[rowIndex][abilityIndex] = ability.name; return abilitiesClone; } diff --git a/app/components/BuildCard.tsx b/app/components/BuildCard.tsx index 286ce9f3d..827fe9050 100644 --- a/app/components/BuildCard.tsx +++ b/app/components/BuildCard.tsx @@ -158,7 +158,7 @@ export function BuildCard({ build, owner, canEdit = false }: BuildProps) { ))} {weapons.length === 1 && (
- {t(`weapons:MAIN_${weapons[0]!.weaponSplId}` as any)} + {t(`weapons:MAIN_${weapons[0].weaponSplId}` as any)}
)} @@ -182,7 +182,7 @@ export function BuildCard({ build, owner, canEdit = false }: BuildProps) {
diff --git a/app/db/seed/index.ts b/app/db/seed/index.ts index ebe1bc5e0..fe2d654ab 100644 --- a/app/db/seed/index.ts +++ b/app/db/seed/index.ts @@ -1253,9 +1253,9 @@ async function adminBuilds() { ownerId: ADMIN_ID, private: 0, description: Math.random() < 0.75 ? faker.lorem.paragraph() : null, - headGearSplId: randomOrderHeadGear[0]!, - clothesGearSplId: randomOrderClothesGear[0]!, - shoesGearSplId: randomOrderShoesGear[0]!, + headGearSplId: randomOrderHeadGear[0], + clothesGearSplId: randomOrderClothesGear[0], + shoesGearSplId: randomOrderShoesGear[0], weaponSplIds: new Array( faker.helpers.arrayElement([1, 1, 1, 2, 2, 3, 4, 5]), ) @@ -1317,9 +1317,9 @@ async function manySplattershotBuilds() { )}`, ownerId, description: Math.random() < 0.75 ? faker.lorem.paragraph() : null, - headGearSplId: randomOrderHeadGear[0]!, - clothesGearSplId: randomOrderClothesGear[0]!, - shoesGearSplId: randomOrderShoesGear[0]!, + headGearSplId: randomOrderHeadGear[0], + clothesGearSplId: randomOrderClothesGear[0], + shoesGearSplId: randomOrderShoesGear[0], weaponSplIds: new Array( faker.helpers.arrayElement([1, 1, 1, 2, 2, 3, 4, 5]), ) diff --git a/app/db/tables.ts b/app/db/tables.ts index e7fd0bd8d..f4d75c6fb 100644 --- a/app/db/tables.ts +++ b/app/db/tables.ts @@ -15,9 +15,10 @@ import type { import type { GroupSkillDifference, UserSkillDifference } from "./types"; import type { ParticipantResult } from "~/modules/brackets-model"; -export type Generated = T extends ColumnType - ? ColumnType - : ColumnType; +export type Generated = + T extends ColumnType + ? ColumnType + : ColumnType; export interface AllTeam { avatarImgId: number | null; diff --git a/app/features/build-analyzer/core/stats.ts b/app/features/build-analyzer/core/stats.ts index f4f72fe86..9e4d2db8b 100644 --- a/app/features/build-analyzer/core/stats.ts +++ b/app/features/build-analyzer/core/stats.ts @@ -652,8 +652,8 @@ function subWeaponDefenseDamages( ), ), ], - baseValue: secondHalfValues[0]!.baseValue, - value: secondHalfValues[0]!.value, + baseValue: secondHalfValues[0].baseValue, + value: secondHalfValues[0].value, type, }, { @@ -667,8 +667,8 @@ function subWeaponDefenseDamages( ...firstHalfValues.map((value) => value.distance as number), ), ], - baseValue: firstHalfValues[0]!.baseValue, - value: firstHalfValues[0]!.value, + baseValue: firstHalfValues[0].baseValue, + value: firstHalfValues[0].value, type, }, ]; diff --git a/app/features/build-stats/build-stats-utils.test.ts b/app/features/build-stats/build-stats-utils.test.ts index 5b145b758..fada1e10f 100644 --- a/app/features/build-stats/build-stats-utils.test.ts +++ b/app/features/build-stats/build-stats-utils.test.ts @@ -92,8 +92,8 @@ PopularBuilds("calculates popular build", () => { ]); assert.is(builds.length, 1); - assert.is(builds[0]!.count, 10); - assert.is(builds[0]!.abilities[0]!.ability, "QR"); + assert.is(builds[0].count, 10); + assert.is(builds[0].abilities[0].ability, "QR"); }); PopularBuilds("calculates second most popular build (sorted by count)", () => { @@ -110,7 +110,7 @@ PopularBuilds("calculates second most popular build (sorted by count)", () => { ]); assert.is(builds.length, 3); - assert.is(builds[1]!.abilities[0]!.ability, "SSU"); + assert.is(builds[1].abilities[0].ability, "SSU"); }); PopularBuilds("sums up abilities", () => { @@ -143,7 +143,7 @@ PopularBuilds("sorts abilities", () => { }, ]); - assert.is(builds[0]!.abilities[1]!.ability, "QR"); + assert.is(builds[0].abilities[1].ability, "QR"); }); AbilityPointCountsToAverages.run(); diff --git a/app/features/build-stats/routes/builds.$slug.stats.tsx b/app/features/build-stats/routes/builds.$slug.stats.tsx index b09654e93..fca412228 100644 --- a/app/features/build-stats/routes/builds.$slug.stats.tsx +++ b/app/features/build-stats/routes/builds.$slug.stats.tsx @@ -117,7 +117,7 @@ export default function BuildStatsPage() { {data.stats.stackableAbilities.map((stats) => { const apToPx = (ap: number) => Math.floor( - (ap / data.stats.stackableAbilities[0]!.apAverage.weapon) * 200, + (ap / data.stats.stackableAbilities[0].apAverage.weapon) * 200, ); return ( diff --git a/app/features/builds/BuildRepository.server.ts b/app/features/builds/BuildRepository.server.ts index 3ff58d7d8..09bbd9717 100644 --- a/app/features/builds/BuildRepository.server.ts +++ b/app/features/builds/BuildRepository.server.ts @@ -108,9 +108,9 @@ function dbAbilitiesToArrayOfArrays( invariant(sorted.length === 12, "expected 12 abilities"); return [ - [sorted[0]!, sorted[1]!, sorted[2]!, sorted[3]!], - [sorted[4]!, sorted[5]!, sorted[6]!, sorted[7]!], - [sorted[8]!, sorted[9]!, sorted[10]!, sorted[11]!], + [sorted[0], sorted[1], sorted[2], sorted[3]], + [sorted[4], sorted[5], sorted[6], sorted[7]], + [sorted[8], sorted[9], sorted[10], sorted[11]], ]; } diff --git a/app/features/builds/queries/buildsBy.server.ts b/app/features/builds/queries/buildsBy.server.ts index 3b51303f7..c81790cdd 100644 --- a/app/features/builds/queries/buildsBy.server.ts +++ b/app/features/builds/queries/buildsBy.server.ts @@ -280,8 +280,8 @@ function dbAbilitiesToArrayOfArrays( invariant(sorted.length === 12, "expected 12 abilities"); return [ - [sorted[0]!, sorted[1]!, sorted[2]!, sorted[3]!], - [sorted[4]!, sorted[5]!, sorted[6]!, sorted[7]!], - [sorted[8]!, sorted[9]!, sorted[10]!, sorted[11]!], + [sorted[0], sorted[1], sorted[2], sorted[3]], + [sorted[4], sorted[5], sorted[6], sorted[7]], + [sorted[8], sorted[9], sorted[10], sorted[11]], ]; } diff --git a/app/features/builds/routes/builds.$slug.tsx b/app/features/builds/routes/builds.$slug.tsx index 801c1025c..a45ae8657 100644 --- a/app/features/builds/routes/builds.$slug.tsx +++ b/app/features/builds/routes/builds.$slug.tsx @@ -107,25 +107,24 @@ export const shouldRevalidate: ShouldRevalidateFunction = (args) => { } // all meaningful filters identical -> skip revalidation if ( - newFilters?.every( - (f1) => - oldFilters?.some((f2) => { - if (f1.type !== f2.type) return false; + newFilters?.every((f1) => + oldFilters?.some((f2) => { + if (f1.type !== f2.type) return false; - if (f1.type === "mode" && f2.type === "mode") { - return f1.mode === f2.mode; - } - if (f1.type === "date" && f2.type === "date") { - return f1.date === f2.date; - } - if (f1.type !== "ability" || f2.type !== "ability") return false; + if (f1.type === "mode" && f2.type === "mode") { + return f1.mode === f2.mode; + } + if (f1.type === "date" && f2.type === "date") { + return f1.date === f2.date; + } + if (f1.type !== "ability" || f2.type !== "ability") return false; - return ( - f1.ability === f2.ability && - f1.comparison === f2.comparison && - f1.value === f2.value - ); - }), + return ( + f1.ability === f2.ability && + f1.comparison === f2.comparison && + f1.value === f2.value + ); + }), ) ) { return false; diff --git a/app/features/calendar/routes/calendar.$id.tsx b/app/features/calendar/routes/calendar.$id.tsx index 8b0d2c521..ecfe26d37 100644 --- a/app/features/calendar/routes/calendar.$id.tsx +++ b/app/features/calendar/routes/calendar.$id.tsx @@ -68,7 +68,7 @@ export const action: ActionFunction = async ({ params, request }) => { canDeleteCalendarEvent({ user, event, - startTime: databaseTimestampToDate(event.startTimes[0]!), + startTime: databaseTimestampToDate(event.startTimes[0]), }), ); @@ -233,7 +233,7 @@ export default function CalendarEventPage() { {canDeleteCalendarEvent({ user, - startTime: databaseTimestampToDate(data.event.startTimes[0]!), + startTime: databaseTimestampToDate(data.event.startTimes[0]), event: data.event, }) ? ( ({ value: data[++index]!, done: !(index in data) }), + next: () => ({ value: data[++index], done: !(index in data) }), }; } diff --git a/app/features/object-damage-calculator/core/objectDamage.test.ts b/app/features/object-damage-calculator/core/objectDamage.test.ts index e7083a33d..c5e462f75 100644 --- a/app/features/object-damage-calculator/core/objectDamage.test.ts +++ b/app/features/object-damage-calculator/core/objectDamage.test.ts @@ -105,8 +105,9 @@ CalculateDamage("BRU increases Splash Wall hitpoints", () => { abilityPoints: new Map([["BRU", 10]]), }); - const hpWithoutBRU = withoutBRU.find((d) => d.receiver === "Wsb_Shield") - ?.hitPoints; + const hpWithoutBRU = withoutBRU.find( + (d) => d.receiver === "Wsb_Shield", + )?.hitPoints; const hpWithBRU = withBRU.find((d) => d.receiver === "Wsb_Shield")?.hitPoints; assert.ok(typeof hpWithoutBRU === "number"); @@ -123,8 +124,9 @@ CalculateDamage("SPU increases Big Bubbler hitpoints", () => { const hpWithoutSPU = withoutSPU.find( (d) => d.receiver === "GreatBarrier_Barrier", )?.hitPoints; - const hpWithSPU = withSPU.find((d) => d.receiver === "GreatBarrier_Barrier") - ?.hitPoints; + const hpWithSPU = withSPU.find( + (d) => d.receiver === "GreatBarrier_Barrier", + )?.hitPoints; assert.ok(typeof hpWithoutSPU === "number"); assert.ok(typeof hpWithSPU === "number"); diff --git a/app/features/object-damage-calculator/core/objectDamage.ts b/app/features/object-damage-calculator/core/objectDamage.ts index a5175b48f..825c93153 100644 --- a/app/features/object-damage-calculator/core/objectDamage.ts +++ b/app/features/object-damage-calculator/core/objectDamage.ts @@ -271,7 +271,7 @@ export function calculateDamage({ return damage.value; }; const baseMultiplier = () => { - const normalMultiplier = multipliers[damage.type]![receiver]; + const normalMultiplier = multipliers[damage.type][receiver]; if (toCombine) { const actualDamage = () => { if (toCombine.multiplierOnly) { @@ -283,7 +283,7 @@ export function calculateDamage({ }; const otherMultiplier = - multipliers[toCombine.combineWith]![receiver]; + multipliers[toCombine.combineWith][receiver]; // calculate "made up" multiplier that is taking the // weighted average of the two multipliers diff --git a/app/features/sendouq/core/groups.server.ts b/app/features/sendouq/core/groups.server.ts index 02dba54db..e99013811 100644 --- a/app/features/sendouq/core/groups.server.ts +++ b/app/features/sendouq/core/groups.server.ts @@ -85,11 +85,13 @@ export function addReplayIndicator({ }): DividedGroupsUncensored { if (!recentMatchPlayers.length) return groups; - const ownGroupId = recentMatchPlayers.find((u) => u.userId === userId) - ?.groupId; + const ownGroupId = recentMatchPlayers.find( + (u) => u.userId === userId, + )?.groupId; invariant(ownGroupId, "own group not found"); - const otherGroupId = recentMatchPlayers.find((u) => u.groupId !== ownGroupId) - ?.groupId; + const otherGroupId = recentMatchPlayers.find( + (u) => u.groupId !== ownGroupId, + )?.groupId; invariant(otherGroupId, "other group not found"); const opponentPlayers = recentMatchPlayers diff --git a/app/features/team/routes/t.tsx b/app/features/team/routes/t.tsx index ea8512b55..57e1d1563 100644 --- a/app/features/team/routes/t.tsx +++ b/app/features/team/routes/t.tsx @@ -233,7 +233,7 @@ export default function TeamSearchPage() {
{team.members.length === 1 - ? team.members[0]!.discordName + ? team.members[0].discordName : joinListToNaturalString( team.members.map((member) => member.discordName), "&", diff --git a/app/features/top-search/routes/xsearch.player.$id.tsx b/app/features/top-search/routes/xsearch.player.$id.tsx index 636e7bd7a..d2b085a9a 100644 --- a/app/features/top-search/routes/xsearch.player.$id.tsx +++ b/app/features/top-search/routes/xsearch.player.$id.tsx @@ -27,7 +27,7 @@ export const handle: SendouRouteHandle = { if (!data) return []; - const firstName = data.placements[0]!.name; + const firstName = data.placements[0].name; return [ { @@ -38,7 +38,7 @@ export const handle: SendouRouteHandle = { { text: firstName, type: "TEXT", - href: topSearchPlayerPage(data.placements[0]!.playerId), + href: topSearchPlayerPage(data.placements[0].playerId), }, ]; }, @@ -57,7 +57,7 @@ export const meta: MetaFunction = (args) => { { title: data.title }, { name: "description", - content: `Splatoon 3 X Battle for the player ${data.placements[0]!.name}`, + content: `Splatoon 3 X Battle for the player ${data.placements[0].name}`, }, ]; }; @@ -71,7 +71,7 @@ export const loader = async ({ params, request }: LoaderFunctionArgs) => { return { placements, - title: makeTitle([placements[0]!.name, t("pages.xsearch")]), + title: makeTitle([placements[0].name, t("pages.xsearch")]), }; }; @@ -79,21 +79,21 @@ export default function XSearchPlayerPage() { const { t } = useTranslation(["common"]); const data = useLoaderData(); - const firstName = data.placements[0]!.name; + const firstName = data.placements[0].name; const aliases = removeDuplicates( data.placements .map((placement) => placement.name) .filter((name) => name !== firstName), ); - const hasUserLinked = Boolean(data.placements[0]!.discordId); + const hasUserLinked = Boolean(data.placements[0].discordId); return (

{hasUserLinked ? ( - {firstName} + {firstName} ) : ( <>{firstName} )}{" "} diff --git a/app/features/top-search/routes/xsearch.tsx b/app/features/top-search/routes/xsearch.tsx index 1bda3ab8c..d2763efd5 100644 --- a/app/features/top-search/routes/xsearch.tsx +++ b/app/features/top-search/routes/xsearch.tsx @@ -47,7 +47,7 @@ export const meta: MetaFunction = (args) => { export const loader = async ({ request }: LoaderFunctionArgs) => { const availableMonthYears = monthYears(); - const { month: latestMonth, year: latestYear } = availableMonthYears[0]!; + const { month: latestMonth, year: latestYear } = availableMonthYears[0]; // #region parse URL params const url = new URL(request.url); @@ -128,8 +128,8 @@ export default function XSearchPage() { }; const selectValue = `${ - searchParams.get("month") ?? data.availableMonthYears[0]!.month - }-${searchParams.get("year") ?? data.availableMonthYears[0]!.year}-${ + searchParams.get("month") ?? data.availableMonthYears[0].month + }-${searchParams.get("year") ?? data.availableMonthYears[0].year}-${ searchParams.get("mode") ?? "SZ" }-${searchParams.get("region") ?? "WEST"}`; @@ -143,8 +143,8 @@ export default function XSearchPage() { > {selectOptions(data.availableMonthYears).map((group) => ( {group.map((option) => (