fix a bunch of lint issues

This commit is contained in:
Michael Genson 2025-06-18 19:46:23 +00:00
commit 5e9117f1ff
4 changed files with 26 additions and 23 deletions

View file

@ -139,7 +139,7 @@ export default defineNuxtComponent({
const loggedInCookbooks = useCookbooks(); const loggedInCookbooks = useCookbooks();
const publicCookbooks = usePublicCookbooks(groupSlug.value || ""); const publicCookbooks = usePublicCookbooks(groupSlug.value || "");
const cookbooks = computed(() => const cookbooks = computed(() =>
isOwnGroup.value ? loggedInCookbooks.cookbooks.value : publicCookbooks.cookbooks.value isOwnGroup.value ? loggedInCookbooks.cookbooks.value : publicCookbooks.cookbooks.value,
); );
const cookbookPreferences = useCookbookPreferences(); const cookbookPreferences = useCookbookPreferences();
@ -199,7 +199,8 @@ export default defineNuxtComponent({
} }
if (cookbooks[0].householdId === currentUserHouseholdId.value) { if (cookbooks[0].householdId === currentUserHouseholdId.value) {
ownLinks.push(...cookbooks.map(cookbookAsLink)); ownLinks.push(...cookbooks.map(cookbookAsLink));
} else { }
else {
links.push({ links.push({
key: householdName, key: householdName,
icon: $globals.icons.book, icon: $globals.icons.book,
@ -213,7 +214,8 @@ export default defineNuxtComponent({
links.sort((a, b) => a.title.localeCompare(b.title)); links.sort((a, b) => a.title.localeCompare(b.title));
if ($auth.user.value && cookbookPreferences.value.hideOtherHouseholds) { if ($auth.user.value && cookbookPreferences.value.hideOtherHouseholds) {
return ownLinks; return ownLinks;
} else { }
else {
return [...ownLinks, ...links]; return [...ownLinks, ...links];
} }
}); });

View file

@ -93,20 +93,21 @@ export function useShoppingListItemActions(shoppingListId: string) {
function mergeListItemsByLatest( function mergeListItemsByLatest(
list1: ShoppingListItemOut[], list1: ShoppingListItemOut[],
list2: ShoppingListItemOut[] list2: ShoppingListItemOut[],
) { ) {
const mergedList = [...list1]; const mergedList = [...list1];
list2.forEach((list2Item) => { list2.forEach((list2Item) => {
const conflictingItem = mergedList.find((item) => item.id === list2Item.id) const conflictingItem = mergedList.find(item => item.id === list2Item.id);
if (conflictingItem && if (conflictingItem
list2Item.updatedAt && conflictingItem.updatedAt && && list2Item.updatedAt && conflictingItem.updatedAt
list2Item.updatedAt > conflictingItem.updatedAt) { && list2Item.updatedAt > conflictingItem.updatedAt) {
mergedList.splice(mergedList.indexOf(conflictingItem), 1, list2Item) mergedList.splice(mergedList.indexOf(conflictingItem), 1, list2Item);
} else if (!conflictingItem) {
mergedList.push(list2Item)
} }
}) else if (!conflictingItem) {
return mergedList mergedList.push(list2Item);
}
});
return mergedList;
} }
async function getList() { async function getList() {
@ -115,7 +116,7 @@ export function useShoppingListItemActions(shoppingListId: string) {
const createAndUpdateQueues = mergeListItemsByLatest(queue.update, queue.create); const createAndUpdateQueues = mergeListItemsByLatest(queue.update, queue.create);
response.data.listItems = mergeListItemsByLatest(response.data.listItems ?? [], createAndUpdateQueues); response.data.listItems = mergeListItemsByLatest(response.data.listItems ?? [], createAndUpdateQueues);
} }
return response.data return response.data;
} }
function createItem(item: ShoppingListItemOut) { function createItem(item: ShoppingListItemOut) {

View file

@ -169,12 +169,12 @@ export default defineNuxtComponent({
watch( watch(
allCookbooks, allCookbooks,
(cookbooks) => { (cookbooks) => {
myCookbooks.value = myCookbooks.value
cookbooks?.filter( = cookbooks?.filter(
(cookbook) => cookbook.householdId === $auth.user.value?.householdId, cookbook => cookbook.householdId === $auth.user.value?.householdId,
) ?? []; ) ?? [];
}, },
{ immediate: true } { immediate: true },
); );
const { household } = useHouseholdSelf(); const { household } = useHouseholdSelf();
@ -211,7 +211,7 @@ export default defineNuxtComponent({
return; return;
} }
await actions.deleteOne(deleteTarget.value.id); await actions.deleteOne(deleteTarget.value.id);
myCookbooks.value = myCookbooks.value.filter((c) => c.id !== deleteTarget.value?.id); myCookbooks.value = myCookbooks.value.filter(c => c.id !== deleteTarget.value?.id);
dialogStates.delete = false; dialogStates.delete = false;
deleteTarget.value = null; deleteTarget.value = null;
} }
@ -221,7 +221,7 @@ export default defineNuxtComponent({
return; return;
} }
await actions.deleteOne(createTarget.value.id); await actions.deleteOne(createTarget.value.id);
myCookbooks.value = myCookbooks.value.filter((c) => c.id !== createTarget.value?.id); myCookbooks.value = myCookbooks.value.filter(c => c.id !== createTarget.value?.id);
dialogStates.create = false; dialogStates.create = false;
createTarget.value = null; createTarget.value = null;
} }

View file

@ -144,7 +144,7 @@
:delay-on-touch-only="true" :delay-on-touch-only="true"
@start="loadingCounter += 1" @start="loadingCounter += 1"
@end="loadingCounter -= 1" @end="loadingCounter -= 1"
@update:modelValue="updateIndexUnchecked" @update:model-value="updateIndexUnchecked"
> >
<v-lazy <v-lazy
v-for="(item, index) in listItems.unchecked" v-for="(item, index) in listItems.unchecked"
@ -197,7 +197,7 @@
:delay-on-touch-only="true" :delay-on-touch-only="true"
@start="loadingCounter += 1" @start="loadingCounter += 1"
@end="loadingCounter -= 1" @end="loadingCounter -= 1"
@update:modelValue="updateIndexUncheckedByLabel(key.toString(), $event)" @update:model-value="updateIndexUncheckedByLabel(key.toString(), $event)"
> >
<v-lazy <v-lazy
v-for="(item, index) in value" v-for="(item, index) in value"
@ -268,7 +268,7 @@
:delay="250" :delay="250"
:delay-on-touch-only="true" :delay-on-touch-only="true"
class="my-2" class="my-2"
@update:modelValue="updateLabelOrder" @update:model-value="updateLabelOrder"
> >
<div <div
v-for="(labelSetting, index) in localLabels" v-for="(labelSetting, index) in localLabels"