From 8806910f5e9d4ca102116cab444a6a09f39acc7b Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Wed, 19 Apr 2023 21:37:28 -0500 Subject: [PATCH] Resolving problems --- src/features/achievements/achievement.tsx | 12 ++++++------ src/features/bars/bar.ts | 4 ++-- src/features/challenges/challenge.tsx | 8 ++++---- src/features/clickables/clickable.ts | 4 ++-- src/features/decorators/common.ts | 4 ++-- src/features/particles/Particles.vue | 2 +- src/features/repeatable.tsx | 6 +++--- src/features/upgrades/upgrade.ts | 12 +++++------- src/game/requirements.tsx | 2 ++ tests/features/conversions.test.ts | 8 ++++---- tests/game/formulas.test.ts | 9 ++++----- 11 files changed, 35 insertions(+), 36 deletions(-) diff --git a/src/features/achievements/achievement.tsx b/src/features/achievements/achievement.tsx index f55d6ea..007dd0c 100644 --- a/src/features/achievements/achievement.tsx +++ b/src/features/achievements/achievement.tsx @@ -2,19 +2,19 @@ import { computed } from "@vue/reactivity"; import { isArray } from "@vue/shared"; import Select from "components/fields/Select.vue"; import AchievementComponent from "features/achievements/Achievement.vue"; -import { Decorator, GenericDecorator } from "features/decorators/common"; +import { GenericDecorator } from "features/decorators/common"; import { CoercableComponent, Component, GatherProps, GenericComponent, - getUniqueID, - jsx, OptionsFunc, Replace, - setDefault, StyleValue, - Visibility + Visibility, + getUniqueID, + jsx, + setDefault } from "features/feature"; import { globalBus } from "game/events"; import "game/notifications"; @@ -22,10 +22,10 @@ import type { Persistent } from "game/persistence"; import { persistent } from "game/persistence"; import player from "game/player"; import { + Requirements, createBooleanRequirement, createVisibilityRequirement, displayRequirements, - Requirements, requirementsMet } from "game/requirements"; import settings, { registerSettingField } from "game/settings"; diff --git a/src/features/bars/bar.ts b/src/features/bars/bar.ts index 100a3c3..8179001 100644 --- a/src/features/bars/bar.ts +++ b/src/features/bars/bar.ts @@ -1,5 +1,5 @@ import BarComponent from "features/bars/Bar.vue"; -import { Decorator, GenericDecorator } from "features/decorators/common"; +import { GenericDecorator } from "features/decorators/common"; import type { CoercableComponent, GenericComponent, @@ -7,7 +7,7 @@ import type { Replace, StyleValue } from "features/feature"; -import { Component, GatherProps, getUniqueID, setDefault, Visibility } from "features/feature"; +import { Component, GatherProps, Visibility, getUniqueID, setDefault } from "features/feature"; import type { DecimalSource } from "util/bignum"; import { Direction } from "util/common"; import type { diff --git a/src/features/challenges/challenge.tsx b/src/features/challenges/challenge.tsx index 16ed080..d9fc04d 100644 --- a/src/features/challenges/challenge.tsx +++ b/src/features/challenges/challenge.tsx @@ -1,7 +1,7 @@ import { isArray } from "@vue/shared"; import Toggle from "components/fields/Toggle.vue"; import ChallengeComponent from "features/challenges/Challenge.vue"; -import { Decorator, GenericDecorator } from "features/decorators/common"; +import { GenericDecorator } from "features/decorators/common"; import type { CoercableComponent, GenericComponent, @@ -12,17 +12,17 @@ import type { import { Component, GatherProps, + Visibility, getUniqueID, isVisible, jsx, - setDefault, - Visibility + setDefault } from "features/feature"; import type { GenericReset } from "features/reset"; import { globalBus } from "game/events"; import type { Persistent } from "game/persistence"; import { persistent } from "game/persistence"; -import { maxRequirementsMet, Requirements } from "game/requirements"; +import { Requirements, maxRequirementsMet } from "game/requirements"; import settings, { registerSettingField } from "game/settings"; import type { DecimalSource } from "util/bignum"; import Decimal from "util/bignum"; diff --git a/src/features/clickables/clickable.ts b/src/features/clickables/clickable.ts index 170e7b7..cfd578e 100644 --- a/src/features/clickables/clickable.ts +++ b/src/features/clickables/clickable.ts @@ -1,5 +1,5 @@ import ClickableComponent from "features/clickables/Clickable.vue"; -import { Decorator, GenericDecorator } from "features/decorators/common"; +import { GenericDecorator } from "features/decorators/common"; import type { CoercableComponent, GenericComponent, @@ -7,7 +7,7 @@ import type { Replace, StyleValue } from "features/feature"; -import { Component, GatherProps, getUniqueID, setDefault, Visibility } from "features/feature"; +import { Component, GatherProps, Visibility, getUniqueID, setDefault } from "features/feature"; import type { BaseLayer } from "game/layers"; import type { Unsubscribe } from "nanoevents"; import type { diff --git a/src/features/decorators/common.ts b/src/features/decorators/common.ts index 899f29e..8d76b37 100644 --- a/src/features/decorators/common.ts +++ b/src/features/decorators/common.ts @@ -28,7 +28,7 @@ export type Decorator< export type GenericDecorator = Decorator; export interface EffectFeatureOptions { - effect: Computable; + effect: Computable; } export type EffectFeature = Replace< @@ -38,7 +38,7 @@ export type EffectFeature = Replace< export type GenericEffectFeature = Replace< EffectFeature, - { effect: ProcessedComputable } + { effect: ProcessedComputable } >; /** diff --git a/src/features/particles/Particles.vue b/src/features/particles/Particles.vue index 1f7de78..6fee1e9 100644 --- a/src/features/particles/Particles.vue +++ b/src/features/particles/Particles.vue @@ -14,7 +14,7 @@ import { globalBus } from "game/events"; import "lib/pixi"; import { processedPropType } from "util/vue"; import type { PropType } from "vue"; -import { defineComponent, nextTick, onBeforeUnmount, onMounted, ref, shallowRef, unref } from "vue"; +import { defineComponent, nextTick, onBeforeUnmount, onMounted, shallowRef, unref } from "vue"; // TODO get typing support on the Particles component export default defineComponent({ diff --git a/src/features/repeatable.tsx b/src/features/repeatable.tsx index b15fe0f..d9bf372 100644 --- a/src/features/repeatable.tsx +++ b/src/features/repeatable.tsx @@ -7,14 +7,14 @@ import type { Replace, StyleValue } from "features/feature"; -import { Component, GatherProps, getUniqueID, jsx, setDefault, Visibility } from "features/feature"; +import { Component, GatherProps, Visibility, getUniqueID, jsx, setDefault } from "features/feature"; import { DefaultValue, Persistent, persistent } from "game/persistence"; import { + Requirements, createVisibilityRequirement, displayRequirements, maxRequirementsMet, payRequirements, - Requirements, requirementsMet } from "game/requirements"; import type { DecimalSource } from "util/bignum"; @@ -30,7 +30,7 @@ import { createLazyProxy } from "util/proxies"; import { coerceComponent, isCoercableComponent } from "util/vue"; import type { Ref } from "vue"; import { computed, unref } from "vue"; -import { Decorator, GenericDecorator } from "./decorators/common"; +import { GenericDecorator } from "./decorators/common"; /** A symbol used to identify {@link Repeatable} features. */ export const RepeatableType = Symbol("Repeatable"); diff --git a/src/features/upgrades/upgrade.ts b/src/features/upgrades/upgrade.ts index 094c641..5de63f1 100644 --- a/src/features/upgrades/upgrade.ts +++ b/src/features/upgrades/upgrade.ts @@ -1,5 +1,5 @@ import { isArray } from "@vue/shared"; -import { Decorator, GenericDecorator } from "features/decorators/common"; +import { GenericDecorator } from "features/decorators/common"; import type { CoercableComponent, GenericComponent, @@ -9,22 +9,20 @@ import type { } from "features/feature"; import { Component, - findFeatures, GatherProps, + Visibility, + findFeatures, getUniqueID, - setDefault, - Visibility + setDefault } from "features/feature"; -import { createResource } from "features/resources/resource"; import UpgradeComponent from "features/upgrades/Upgrade.vue"; import type { GenericLayer } from "game/layers"; import type { Persistent } from "game/persistence"; import { persistent } from "game/persistence"; import { - createCostRequirement, + Requirements, createVisibilityRequirement, payRequirements, - Requirements, requirementsMet } from "game/requirements"; import { isFunction } from "util/common"; diff --git a/src/game/requirements.tsx b/src/game/requirements.tsx index 35504b6..ac0f551 100644 --- a/src/game/requirements.tsx +++ b/src/game/requirements.tsx @@ -267,6 +267,7 @@ export function displayRequirements(requirements: Requirements, amount: DecimalS
Costs:{" "} {joinJSX( + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion withCosts.map(r => r.partialDisplay!(amount)), <>, )} @@ -276,6 +277,7 @@ export function displayRequirements(requirements: Requirements, amount: DecimalS
Requires:{" "} {joinJSX( + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion withoutCosts.map(r => r.partialDisplay!(amount)), <>, )} diff --git a/tests/features/conversions.test.ts b/tests/features/conversions.test.ts index c94df0a..dc89ac0 100644 --- a/tests/features/conversions.test.ts +++ b/tests/features/conversions.test.ts @@ -8,7 +8,7 @@ import { createResource, Resource } from "features/resources/resource"; import { GenericFormula } from "game/formulas/types"; import { createLayer, GenericLayer } from "game/layers"; import Decimal from "util/bignum"; -import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; +import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import { ref, unref } from "vue"; import "../utils"; @@ -472,15 +472,15 @@ describe("Passive generation", () => { setupPassiveGeneration(layer, conversion); layer.emit("preUpdate", 1); expect(gainResource.value).compare_tolerance(2); - }) + }); test("Rate is 100", () => { setupPassiveGeneration(layer, conversion, () => 100); layer.emit("preUpdate", 1); expect(gainResource.value).compare_tolerance(101); - }) + }); test("Obeys cap", () => { setupPassiveGeneration(layer, conversion, 100, () => 100); layer.emit("preUpdate", 1); expect(gainResource.value).compare_tolerance(100); - }) + }); }); diff --git a/tests/game/formulas.test.ts b/tests/game/formulas.test.ts index 7da6226..86ec8c4 100644 --- a/tests/game/formulas.test.ts +++ b/tests/game/formulas.test.ts @@ -2,11 +2,10 @@ import { createResource, Resource } from "features/resources/resource"; import Formula, { calculateCost, calculateMaxAffordable, - printFormula, unrefFormulaSource } from "game/formulas/formulas"; import type { GenericFormula, InvertibleFormula } from "game/formulas/types"; -import Decimal, { DecimalSource, format } from "util/bignum"; +import Decimal, { DecimalSource } from "util/bignum"; import { beforeAll, describe, expect, test } from "vitest"; import { ref } from "vue"; import "../utils"; @@ -151,7 +150,7 @@ describe("Formula Equality Checking", () => { describe("Formula aliases", () => { function testAliases( aliases: T[], - args: Parameters + args: Parameters<(typeof Formula)[T]> ) { describe(aliases[0], () => { let formula: GenericFormula; @@ -239,7 +238,7 @@ describe("Creating Formulas", () => { function checkFormula( functionName: T, - args: Readonly> + args: Readonly> ) { let formula: GenericFormula; beforeAll(() => { @@ -261,7 +260,7 @@ describe("Creating Formulas", () => { // It's a lot of tests, but I'd rather be exhaustive function testFormulaCall( functionName: T, - args: Readonly> + args: Readonly> ) { if ((functionName === "slog" || functionName === "layeradd") && args[0] === -1) { // These cases in particular take a long time, so skip them