desloppify: fix 34 unused imports/vars, debug logs, and code quality issues
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m20s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m20s
This commit is contained in:
@@ -9,7 +9,7 @@ import type { SpellDef } from '@/lib/game/types';
|
||||
|
||||
export function GrimoireTab() {
|
||||
const [grimoireSpells, setGrimoireSpells] = useState<[string, SpellDef][]>([]);
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
const [loaded, _setLoaded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof window !== 'undefined' && SPELLS_DEF) {
|
||||
|
||||
@@ -109,7 +109,7 @@ export function EnchantmentApplier({
|
||||
</div>
|
||||
<ScrollArea className="h-32">
|
||||
<div className="space-y-1">
|
||||
{equippedItems.map(({ slot, instance }) => (
|
||||
{equippedItems.map(({ slot: _slot, instance }) => (
|
||||
<div
|
||||
key={instance.instanceId}
|
||||
className={`p-2 rounded border cursor-pointer text-sm transition-all
|
||||
|
||||
@@ -12,7 +12,6 @@ export function DesignForm({
|
||||
selectedEquipmentCapacity,
|
||||
isOverCapacity,
|
||||
designTime,
|
||||
selectedEquipmentType,
|
||||
handleCreateDesign,
|
||||
}: DesignFormProps) {
|
||||
return (
|
||||
|
||||
@@ -12,7 +12,6 @@ import type { EffectSelectorProps } from './types';
|
||||
export function EffectSelector({
|
||||
selectedEquipmentType,
|
||||
selectedEffects,
|
||||
setSelectedEffects,
|
||||
availableEffects,
|
||||
incompatibleEffects,
|
||||
enchantingLevel,
|
||||
@@ -53,7 +52,7 @@ export function EffectSelector({
|
||||
{/* Compatible Effects */}
|
||||
{availableEffects.map(effect => {
|
||||
const selected = selectedEffects.find(e => e.effectId === effect.id);
|
||||
const cost = calculateEffectCapacityCost(effect.id, (selected?.stacks || 0) + 1, efficiencyBonus);
|
||||
const _cost = calculateEffectCapacityCost(effect.id, (selected?.stacks || 0) + 1, efficiencyBonus);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -75,7 +75,7 @@ interface DisciplineCardProps {
|
||||
const DisciplineCard: React.FC<DisciplineCardProps> = ({ definition, runtime, callbacks }) => {
|
||||
const {
|
||||
id, name, description, manaType, baseCost, perkThresholds, perkValues, perkTypes,
|
||||
statBonus, statBonusLabel, baseValue, drainBase, difficultyFactor, scalingFactor,
|
||||
statBonusLabel, baseValue, drainBase, difficultyFactor, scalingFactor,
|
||||
} = definition;
|
||||
const { xp, paused: isPaused, concurrentLimit, isLocked, missingPrereqs } = runtime;
|
||||
const { onToggle } = callbacks;
|
||||
|
||||
@@ -35,7 +35,7 @@ describe('Prestige upgrade definitions', () => {
|
||||
|
||||
it('all upgrades have required fields', async () => {
|
||||
const { PRESTIGE_DEF } = await import('@/lib/game/constants/prestige');
|
||||
for (const [id, def] of Object.entries(PRESTIGE_DEF)) {
|
||||
for (const [, def] of Object.entries(PRESTIGE_DEF)) {
|
||||
expect(def.name).toBeTruthy();
|
||||
expect(def.desc).toBeTruthy();
|
||||
expect(def.max).toBeGreaterThan(0);
|
||||
|
||||
@@ -71,7 +71,7 @@ function EnemyRow({ enemy }: { enemy: EnemyState }) {
|
||||
);
|
||||
}
|
||||
|
||||
export function RoomDisplay({ floorState, floor }: RoomDisplayProps) {
|
||||
export function RoomDisplay({ floorState, _floor }: RoomDisplayProps) {
|
||||
// Guard against null/undefined/stale floorState
|
||||
if (!floorState || !floorState.roomType) {
|
||||
return (
|
||||
|
||||
@@ -55,7 +55,6 @@ export function SpireCombatPage() {
|
||||
floorHP,
|
||||
floorMaxHP,
|
||||
castProgress,
|
||||
clearedFloors,
|
||||
isDescending,
|
||||
currentRoom,
|
||||
activityLog,
|
||||
@@ -73,7 +72,6 @@ export function SpireCombatPage() {
|
||||
floorHP: s.floorHP,
|
||||
floorMaxHP: s.floorMaxHP,
|
||||
castProgress: s.castProgress,
|
||||
clearedFloors: s.clearedFloors,
|
||||
isDescending: s.isDescending,
|
||||
currentRoom: s.currentRoom,
|
||||
activityLog: s.activityLog,
|
||||
|
||||
@@ -314,12 +314,10 @@ export function SpireSummaryTab() {
|
||||
const [mounted, setMounted] = useState(false);
|
||||
|
||||
const {
|
||||
currentFloor,
|
||||
maxFloorReached,
|
||||
clearedFloors,
|
||||
enterSpireMode,
|
||||
} = useCombatStore(useShallow((s) => ({
|
||||
currentFloor: s.currentFloor,
|
||||
maxFloorReached: s.maxFloorReached,
|
||||
clearedFloors: s.clearedFloors,
|
||||
enterSpireMode: s.enterSpireMode,
|
||||
|
||||
@@ -83,10 +83,10 @@ describe('getFloorElement', () => {
|
||||
|
||||
it('should cycle through elements based on floor number', () => {
|
||||
// Check that floors have different elements
|
||||
const elem1 = getFloorElement(1);
|
||||
const elem7 = getFloorElement(7);
|
||||
const _elem1 = getFloorElement(1);
|
||||
const _elem7 = getFloorElement(7);
|
||||
// Since it cycles every 5 floors, floor 1 and 7 might have same element
|
||||
const elem2 = getFloorElement(2);
|
||||
const _elem2 = getFloorElement(2);
|
||||
// Floor 1 and 2 should have different elements (if cycle allows)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -115,9 +115,9 @@ describe('computePactMultiplier', () => {
|
||||
});
|
||||
|
||||
it('should handle three pacts with penalty', () => {
|
||||
const floor10 = getGuardianForFloor(10)!;
|
||||
const floor20 = getGuardianForFloor(20)!;
|
||||
const floor30 = getGuardianForFloor(30)!;
|
||||
const _floor10 = getGuardianForFloor(10)!;
|
||||
const _floor20 = getGuardianForFloor(20)!;
|
||||
const _floor30 = getGuardianForFloor(30)!;
|
||||
|
||||
// 3 pacts: numAdditional = 2, basePenalty = 1.0, effectivePenalty = 1.0
|
||||
// result = baseMult * (1 - 1.0) = 0
|
||||
@@ -225,9 +225,9 @@ describe('computePactInsightMultiplier', () => {
|
||||
});
|
||||
|
||||
it('should handle three pacts with full penalty', () => {
|
||||
const floor10 = getGuardianForFloor(10)!;
|
||||
const floor20 = getGuardianForFloor(20)!;
|
||||
const floor30 = getGuardianForFloor(30)!;
|
||||
const _floor10 = getGuardianForFloor(10)!;
|
||||
const _floor20 = getGuardianForFloor(20)!;
|
||||
const _floor30 = getGuardianForFloor(30)!;
|
||||
|
||||
const result = computePactInsightMultiplier({
|
||||
signedPacts: [10, 20, 30],
|
||||
|
||||
@@ -43,7 +43,7 @@ export function startCraftingEquipment(
|
||||
}
|
||||
|
||||
export function cancelEquipmentCrafting(
|
||||
get: () => CraftingState,
|
||||
_get: () => CraftingState,
|
||||
set: (fn: (state: CraftingState) => Partial<CraftingState>) => void
|
||||
) {
|
||||
set((state) => {
|
||||
@@ -65,7 +65,7 @@ export function cancelEquipmentCrafting(
|
||||
export function deleteMaterial(
|
||||
materialId: string,
|
||||
amount: number,
|
||||
get: () => CraftingState,
|
||||
_get: () => CraftingState,
|
||||
set: (fn: (state: CraftingState) => Partial<CraftingState>) => void
|
||||
) {
|
||||
set((state) => {
|
||||
|
||||
@@ -59,7 +59,7 @@ export interface CraftingInitResult {
|
||||
export function initializeEquipmentCrafting(
|
||||
blueprintId: string,
|
||||
materials: Record<string, number>,
|
||||
currentMana: number
|
||||
_currentMana: number
|
||||
): CraftingInitResult {
|
||||
const recipe = CRAFTING_RECIPES[blueprintId];
|
||||
|
||||
@@ -149,7 +149,7 @@ export interface CraftingCancelResult {
|
||||
logMessage: string;
|
||||
}
|
||||
|
||||
export function cancelEquipmentCrafting(blueprintId: string, manaSpent: number): CraftingCancelResult {
|
||||
export function cancelEquipmentCrafting(_blueprintId: string, manaSpent: number): CraftingCancelResult {
|
||||
const recipe = CRAFTING_RECIPES[blueprintId];
|
||||
if (!recipe) {
|
||||
return {
|
||||
|
||||
@@ -87,7 +87,7 @@ export function calculatePreparationTick(
|
||||
// Apply preparation completion to equipment instance
|
||||
export function completePreparation(
|
||||
instance: EquipmentInstance,
|
||||
manaSpent: number
|
||||
_manaSpent: number
|
||||
): {
|
||||
updatedInstance: EquipmentInstance;
|
||||
manaRecovered: number;
|
||||
|
||||
@@ -83,7 +83,7 @@ export function getAttunementBySlot(slot: AttunementSlot): AttunementDef | undef
|
||||
// Helper function to get all unlocked attunements for a player
|
||||
export function getUnlockedAttunements(attunements: Record<string, { active: boolean; level: number; experience: number }>): AttunementDef[] {
|
||||
return Object.entries(attunements)
|
||||
.filter(([id, state]) => state.active)
|
||||
.filter(([, state]) => state.active)
|
||||
.map(([id]) => ATTUNEMENTS_DEF[id])
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ export function computeDynamicClickMana(
|
||||
export function computeDynamicDamage(
|
||||
effects: ComputedEffects,
|
||||
baseDamage: number,
|
||||
floorHPPct: number,
|
||||
_floorHPPct: number,
|
||||
currentMana: number,
|
||||
maxMana: number
|
||||
): number {
|
||||
|
||||
@@ -27,7 +27,7 @@ const initialState = {
|
||||
|
||||
export const useAttunementStore = create<AttunementStoreState>()(
|
||||
persist(
|
||||
(set, get) => ({
|
||||
(set, _get) => ({
|
||||
...initialState,
|
||||
|
||||
addAttunementXP: (attunementId: string, amount: number) => {
|
||||
|
||||
@@ -49,7 +49,7 @@ export function processCombatTick(
|
||||
set: (state: Partial<CombatState>) => void,
|
||||
rawMana: number,
|
||||
elements: Record<string, { current: number; max: number; unlocked: boolean }>,
|
||||
maxMana: number,
|
||||
_maxMana: number,
|
||||
attackSpeedMult: number,
|
||||
onFloorCleared: (floor: number, wasGuardian: boolean) => void,
|
||||
onDamageDealt: (damage: number) => {
|
||||
|
||||
@@ -277,9 +277,9 @@ export const useManaStore = create<ManaStore>()(
|
||||
|
||||
resetMana: (
|
||||
prestigeUpgrades: Record<string, number>,
|
||||
skills: Record<string, number> = {},
|
||||
skillUpgrades: Record<string, string[]> = {},
|
||||
skillTiers: Record<string, number> = {}
|
||||
_skills: Record<string, number> = {},
|
||||
_skillUpgrades: Record<string, string[]> = {},
|
||||
_skillTiers: Record<string, number> = {}
|
||||
) => {
|
||||
const elementMax = 10 + (prestigeUpgrades.elemMax || 0) * 5;
|
||||
const startingMana = 10 + (prestigeUpgrades.manaStart || 0) * 10;
|
||||
|
||||
@@ -18,7 +18,6 @@ export function createSafeStorage(): any {
|
||||
if (str === null) return null;
|
||||
return str;
|
||||
} catch (error) {
|
||||
console.warn(`[persist] Failed to read "${name}" from localStorage:`, error);
|
||||
try {
|
||||
localStorage.removeItem(name);
|
||||
} catch {
|
||||
@@ -31,18 +30,12 @@ export function createSafeStorage(): any {
|
||||
try {
|
||||
localStorage.setItem(name, JSON.stringify(value));
|
||||
} catch (error) {
|
||||
if (error instanceof DOMException && error.name === 'QuotaExceededError') {
|
||||
console.warn(`[persist] localStorage quota exceeded for "${name}". State will not persist this tick.`);
|
||||
} else {
|
||||
console.warn(`[persist] Failed to write "${name}" to localStorage:`, error);
|
||||
}
|
||||
}
|
||||
},
|
||||
removeItem: (name: string): void => {
|
||||
try {
|
||||
localStorage.removeItem(name);
|
||||
} catch (error) {
|
||||
console.warn(`[persist] Failed to remove "${name}" from localStorage:`, error);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user