From c9aefa81ca1950121d2357fc66afe15eb400f537 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Fri, 15 Mar 2024 00:13:40 +0000 Subject: Fix eslint errors --- stores/session.ts | 83 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 40 deletions(-) (limited to 'stores/session.ts') diff --git a/stores/session.ts b/stores/session.ts index 50bcde7..c593b78 100644 --- a/stores/session.ts +++ b/stores/session.ts @@ -1,4 +1,4 @@ -import { defineStore } from 'pinia' +import { defineStore } from 'pinia'; export interface EditorQuest { id: string; @@ -7,9 +7,9 @@ export interface EditorQuest { lore: { normal: string[]; started: string[]; - } + }; type: string; - } + }; tasks: { [key: string]: EditorTask }; rewards: string[]; startCommands?: string[]; @@ -26,18 +26,18 @@ export interface EditorQuest { cooldown: { enabled: boolean; time: number; - } + }; timeLimit: { enabled: boolean; time: number; - } + }; sortOrder: number; autostart: boolean; completedDisplay?: string; cooldownDisplay?: string; permissionDisplay?: string; lockedDisplay?: string; - } + }; } export interface EditorTask { @@ -45,7 +45,7 @@ export interface EditorTask { config: { type: string; [key: string]: any; - } + }; } export interface EditorCategory { @@ -54,14 +54,14 @@ export interface EditorCategory { name: string; lore: string[]; type: string; - } + }; permissionRequired: string; } export interface EditorItem { id: string; type: string; - config: any + config: any; } export interface TaskDefinition { @@ -69,7 +69,7 @@ export interface TaskDefinition { icon: { style: string; name: string; - } + }; configuration: { [key: string]: { type: string | string[]; @@ -77,8 +77,8 @@ export interface TaskDefinition { default?: any; required?: boolean; note?: string; - } - } + }; + }; } export interface QuestItemDefinition { @@ -89,8 +89,8 @@ export interface QuestItemDefinition { [key: string]: { type: string | string[]; description: string; - } - } + }; + }; } export type SessionType = 'none' | 'filesystem' | 'demo'; @@ -104,69 +104,72 @@ export const useSessionStore = defineStore('session', { items: [] as EditorItem[], taskDefinitions: {} as { [key: string]: TaskDefinition }, taskTypeAliases: {} as { [key: string]: string }, - questItemDefinitions: {} as { [key: string]: QuestItemDefinition } - } + questItemDefinitions: {} as { [key: string]: QuestItemDefinition }, + }, }), getters: { getSessionType: (state) => () => { - return state.sessionType + return state.sessionType; }, getQuests: (state) => () => { - return state.session.quests + return state.session.quests; }, getCategories: (state) => () => { - return state.session.categories + return state.session.categories; }, getItems: (state) => () => { - return state.session.items + return state.session.items; }, getQuestById: (state) => (id: string) => { if (!id) return null; - return state.session.quests.find(quest => quest.id === id) + return state.session.quests.find((quest) => quest.id === id); }, getCategoryById: (state) => (id: string) => { if (!id) return null; - return state.session.categories.find(quest => quest.id === id) + return state.session.categories.find((quest) => quest.id === id); }, getItemById: (state) => (id: string) => { if (!id) return null; - return state.session.items.find(item => item.id === id); + return state.session.items.find((item) => item.id === id); }, getQuestsInCategory: (state) => (id: string) => { if (!id) return []; - return state.session.quests.filter(quest => quest.options.category === id) + return state.session.quests.filter((quest) => quest.options.category === id); }, getTaskDefinitions: (state) => { - return state.session.taskDefinitions + return state.session.taskDefinitions; }, getTaskDefinitionByTaskType: (state) => (type: string) => { - return state.session.taskDefinitions[type] || state.session.taskDefinitions[state.session.taskTypeAliases[type]] + return ( + state.session.taskDefinitions[type] || + state.session.taskDefinitions[state.session.taskTypeAliases[type]] + ); }, getKnownTaskTypes: (state) => () => { - return Object.keys(state.session.taskDefinitions) + return Object.keys(state.session.taskDefinitions); }, getQuestItemDefintions: (state) => { - return state.session.questItemDefinitions + return state.session.questItemDefinitions; }, getQuestItemDefinitionByTaskType: (state) => (type: string) => { - return state.session.questItemDefinitions[type] + return state.session.questItemDefinitions[type]; }, getKnownQuestItemTypes: (state) => () => { - return Object.keys(state.session.questItemDefinitions) - } + return Object.keys(state.session.questItemDefinitions); + }, }, actions: { setSessionType(type: SessionType) { - this.sessionType = type + this.sessionType = type; }, setQuests(quests: EditorQuest[]) { - this.session.quests = quests + this.session.quests = quests; }, setCategories(categories: EditorCategory[]) { - this.session.categories = categories + this.session.categories = categories; }, setItems(items: EditorItem[]) { - this.session.items = items + this.session.items = items; }, setTaskDefinitions(definitions: { [key: string]: TaskDefinition }) { this.session.taskDefinitions = definitions; @@ -181,12 +184,12 @@ export const useSessionStore = defineStore('session', { const quest = this.getQuestById(oldId); if (!quest) return; - quest.id = newId + quest.id = newId; }, deleteQuest(id: string) { - const index = this.session.quests.findIndex(quest => quest.id === id) + const index = this.session.quests.findIndex((quest) => quest.id === id); if (index === -1) return; - this.session.quests.splice(index, 1) + this.session.quests.splice(index, 1); }, duplicateQuest(id: string, newQuestId: string) { const quest = this.getQuestById(id); @@ -195,6 +198,6 @@ export const useSessionStore = defineStore('session', { const newQuest = JSON.parse(JSON.stringify(quest)); newQuest.id = newQuestId; this.session.quests.push(newQuest); - } - } + }, + }, }); -- cgit v1.2.3-70-g09d2