mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-28 07:56:35 +01:00
feat: sort all type issues
This commit is contained in:
@@ -55,9 +55,9 @@
|
||||
};
|
||||
|
||||
interface Props {
|
||||
label: string;
|
||||
modelValue: string | ItemsObject | null | undefined;
|
||||
items: ItemsObject[] | string[];
|
||||
label?: string;
|
||||
modelValue?: string | ItemsObject | null | undefined;
|
||||
items?: ItemsObject[] | string[];
|
||||
itemText?: string;
|
||||
itemValue?: string;
|
||||
search?: string;
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
import MdiTable from "~icons/mdi/table";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button, ButtonGroup } from "@/components/ui/button";
|
||||
import BaseSectionHeader from "@/components/Base/SectionHeader.vue";
|
||||
import ItemCard from "@/components/Item/Card.vue";
|
||||
import ItemViewTable from "@/components/Item/View/Table.vue";
|
||||
|
||||
type Props = {
|
||||
view?: ViewType;
|
||||
|
||||
@@ -9,4 +9,5 @@ export type TableHeaderType = {
|
||||
type?: "price" | "boolean" | "name" | "location" | "date";
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export type TableData = Record<string, any>;
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
:sibling-count="2"
|
||||
@update:page="pagination.page = $event"
|
||||
>
|
||||
<PaginationList v-slot="{ pageItems }" class="flex items-center gap-1">
|
||||
<PaginationList v-slot="{ items: pageItems }" class="flex items-center gap-1">
|
||||
<PaginationFirst />
|
||||
<template v-for="(item, index) in pageItems">
|
||||
<PaginationListItem v-if="item.type === 'page'" :key="index" :value="item.value" as-child>
|
||||
@@ -175,6 +175,12 @@
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
||||
import { useDialog } from "@/components/ui/dialog-provider";
|
||||
import { DialogID } from "~/components/ui/dialog-provider/utils";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import BaseCard from "@/components/Base/Card.vue";
|
||||
import Currency from "~/components/global/Currency.vue";
|
||||
import { NuxtLink } from "#components";
|
||||
import DateTime from "~/components/global/DateTime.vue";
|
||||
|
||||
const { openDialog, closeDialog } = useDialog();
|
||||
|
||||
@@ -225,6 +231,9 @@
|
||||
};
|
||||
const moveHeader = (from: number, to: number) => {
|
||||
const header = headers.value[from];
|
||||
if (!header) {
|
||||
return;
|
||||
}
|
||||
headers.value.splice(from, 1);
|
||||
headers.value.splice(to, 0, header);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import MdiArrowUp from "~icons/mdi/arrow-up";
|
||||
import MdiTagOutline from "~icons/mdi/tag-outline";
|
||||
import { getContrastTextColor } from "~/lib/utils";
|
||||
import { NuxtLink } from "#components";
|
||||
|
||||
export type sizes = "sm" | "md" | "lg" | "xl";
|
||||
defineProps({
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
import BaseModal from "@/components/App/CreateModal.vue";
|
||||
import { useDialog, useDialogHotkey } from "~/components/ui/dialog-provider";
|
||||
import ColorSelector from "@/components/Form/ColorSelector.vue";
|
||||
import FormTextField from "~/components/Form/TextField.vue";
|
||||
import FormTextArea from "~/components/Form/TextArea.vue";
|
||||
import { Button, ButtonGroup } from "~/components/ui/button";
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -72,7 +75,7 @@
|
||||
|
||||
loading.value = true;
|
||||
|
||||
if (shift.value) close = false;
|
||||
if (shift?.value) close = false;
|
||||
|
||||
const { error, data } = await api.labels.create(form);
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
TagsInputItemText,
|
||||
} from "@/components/ui/tags-input";
|
||||
import type { LabelOut } from "~/lib/api/types/data-contracts";
|
||||
import { Label } from "@/components/ui/label";
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
import MdiMapMarkerOutline from "~icons/mdi/map-marker-outline";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { NuxtLink } from "#components";
|
||||
|
||||
const props = defineProps({
|
||||
location: {
|
||||
@@ -51,8 +52,6 @@
|
||||
});
|
||||
|
||||
const count = computed(() => {
|
||||
if (hasCount.value) {
|
||||
return (props.location as LocationOutCount).itemCount;
|
||||
}
|
||||
return hasCount.value ? (props.location as LocationOutCount).itemCount : undefined;
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
import BaseModal from "@/components/App/CreateModal.vue";
|
||||
import type { LocationSummary } from "~~/lib/api/types/data-contracts";
|
||||
import { useDialog, useDialogHotkey } from "~/components/ui/dialog-provider";
|
||||
import LocationSelector from "~/components/Location/Selector.vue";
|
||||
import FormTextField from "~/components/Form/TextField.vue";
|
||||
import FormTextArea from "~/components/Form/TextArea.vue";
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -94,7 +97,7 @@
|
||||
}
|
||||
loading.value = true;
|
||||
|
||||
if (shift.value) close = false;
|
||||
if (shift?.value) close = false;
|
||||
|
||||
const { data, error } = await api.locations.create({
|
||||
name: form.name,
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
import MdiChevronRight from "~icons/mdi/chevron-right";
|
||||
import MdiMapMarker from "~icons/mdi/map-marker";
|
||||
import MdiPackageVariant from "~icons/mdi/package-variant";
|
||||
import LocationTreeNode from "./Node.vue";
|
||||
import { NuxtLink } from "#components";
|
||||
|
||||
type Props = {
|
||||
treeId: string;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { TreeItem } from "~~/lib/api/types/data-contracts";
|
||||
import LocationTreeNode from "./Node.vue";
|
||||
|
||||
type Props = {
|
||||
locs: TreeItem[];
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
import DatePicker from "~~/components/Form/DatePicker.vue";
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
||||
import { useDialog } from "@/components/ui/dialog-provider";
|
||||
import FormTextField from "~/components/Form/TextField.vue";
|
||||
import FormTextArea from "~/components/Form/TextArea.vue";
|
||||
import Button from "@/components/ui/button/Button.vue";
|
||||
|
||||
const { openDialog, closeDialog } = useDialog();
|
||||
|
||||
|
||||
@@ -14,6 +14,13 @@
|
||||
import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from "@/components/ui/tooltip";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { ButtonGroup, Button } from "@/components/ui/button";
|
||||
import StatCard from "~/components/global/StatCard/StatCard.vue";
|
||||
import BaseCard from "@/components/Base/Card.vue";
|
||||
import BaseSectionHeader from "@/components/Base/SectionHeader.vue";
|
||||
import DateTime from "~/components/global/DateTime.vue";
|
||||
import Currency from "~/components/global/Currency.vue";
|
||||
import Markdown from "~/components/global/Markdown.vue";
|
||||
import { NuxtLink } from "#components";
|
||||
|
||||
const maintenanceFilterStatus = ref(MaintenanceFilterStatus.MaintenanceFilterStatusScheduled);
|
||||
const maintenanceEditModal = ref<InstanceType<typeof MaintenanceEditModal>>();
|
||||
|
||||
@@ -50,13 +50,13 @@
|
||||
import { Label } from "@/components/ui/label";
|
||||
|
||||
type Props = {
|
||||
label: string;
|
||||
label?: string;
|
||||
options: {
|
||||
name: string;
|
||||
id: string;
|
||||
treeString?: string;
|
||||
}[];
|
||||
modelValue: {
|
||||
modelValue?: {
|
||||
name: string;
|
||||
id: string;
|
||||
treeString?: string;
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
const props = defineProps({
|
||||
text: {
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
||||
type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R>
|
||||
? R
|
||||
: any;
|
||||
type AsyncReturnType<T extends (...args: unknown[]) => unknown> = Awaited<ReturnType<T>>;
|
||||
|
||||
const fmt = ref<AsyncReturnType<typeof useFormatCurrency> | null>(null);
|
||||
|
||||
|
||||
@@ -74,6 +74,11 @@
|
||||
import MdiOpenInNew from "~icons/mdi/open-in-new";
|
||||
import { badgeVariants } from "~/components/ui/badge";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from "@/components/ui/tooltip";
|
||||
import DateTime from "@/components/global/DateTime.vue";
|
||||
import Currency from "@/components/global/Currency.vue";
|
||||
import { ClientOnly } from "#components";
|
||||
import Markdown from "@/components/global/Markdown.vue";
|
||||
import CopyText from "@/components/global/CopyText.vue";
|
||||
|
||||
defineProps({
|
||||
details: {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import DOMPurify from "dompurify";
|
||||
|
||||
type Props = {
|
||||
source: string | null | undefined;
|
||||
source?: string | null;
|
||||
};
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
|
||||
@@ -5,4 +5,5 @@ export type TableHeader = {
|
||||
align?: "left" | "center" | "right";
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export type TableData = Record<string, any>;
|
||||
|
||||
@@ -14,6 +14,7 @@ export function defineObserver(key: string, observer: Observer): RemoveObserver
|
||||
observers[key] = observer;
|
||||
|
||||
return () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete observers[key];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class AuthContext implements IAuthContext {
|
||||
private _attachmentToken: CookieRef<string | null>;
|
||||
|
||||
get token() {
|
||||
// @ts-ignore sometimes it's a boolean I guess?
|
||||
// @ts-expect-error sometimes it's a boolean I guess?
|
||||
return this._token.value === "true" || this._token.value === true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import type { UseConfirmDialogRevealResult, UseConfirmDialogReturn } from "@vueuse/core";
|
||||
import type { Ref } from "vue";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
type DeferFunction<TArgs extends any[], TReturn> = (...args: TArgs) => TReturn;
|
||||
|
||||
// useDefer is a function that takes a function and returns a function that
|
||||
|
||||
@@ -8,6 +8,7 @@ export function useRouteQuery(q: string, def: string): WritableComputedRef<strin
|
||||
export function useRouteQuery(q: string, def: boolean): WritableComputedRef<boolean>;
|
||||
export function useRouteQuery(q: string, def: number): WritableComputedRef<number>;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export function useRouteQuery(q: string, def: any): WritableComputedRef<any> {
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
@@ -39,7 +39,7 @@ function connect(onmessage: (m: EventMessage) => void) {
|
||||
console.error("websocket error", err);
|
||||
};
|
||||
|
||||
const thorttled = new Map<ServerEvent, any>();
|
||||
const thorttled = new Map<ServerEvent, (m: EventMessage) => void>();
|
||||
|
||||
thorttled.set(ServerEvent.LocationMutation, useThrottleFn(onmessage, 1000));
|
||||
thorttled.set(ServerEvent.ItemMutation, useThrottleFn(onmessage, 1000));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { NuxtError } from "#app";
|
||||
import { NuxtLink } from "#components";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
|
||||
const props = defineProps({
|
||||
|
||||
@@ -42,6 +42,7 @@ export default withNuxt([
|
||||
caughtErrors: "none",
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-invalid-void-type": "off",
|
||||
|
||||
"prettier/prettier": [
|
||||
"warn",
|
||||
|
||||
@@ -216,6 +216,16 @@
|
||||
import OutdatedModal from "~/components/App/OutdatedModal.vue";
|
||||
import ItemCreateModal from "~/components/Item/CreateModal.vue";
|
||||
|
||||
import LabelCreateModal from "~/components/Label/CreateModal.vue";
|
||||
import LocationCreateModal from "~/components/Location/CreateModal.vue";
|
||||
import ItemBarcodeModal from "~/components/Item/BarcodeModal.vue";
|
||||
import AppQuickMenuModal from "~/components/App/QuickMenuModal.vue";
|
||||
import AppScannerModal from "~/components/App/ScannerModal.vue";
|
||||
import { NuxtLink } from "#components";
|
||||
import AppLogo from "~/components/App/Logo.vue";
|
||||
import AppHeaderDecor from "~/components/App/HeaderDecor.vue";
|
||||
import AppHeaderText from "~/components/App/HeaderText.vue";
|
||||
|
||||
const { t, locale } = useI18n();
|
||||
const username = computed(() => authCtx.user?.name || "User");
|
||||
|
||||
@@ -348,7 +358,7 @@
|
||||
...dropdown.map(v => ({
|
||||
text: computed(() => v.name.value),
|
||||
dialogId: v.dialogId as NoParamDialogIDs,
|
||||
shortcut: v.shortcut.split("+")[1],
|
||||
shortcut: v.shortcut.split("+")[1] as string,
|
||||
type: "create" as const,
|
||||
})),
|
||||
...nav.map(v => ({
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Requests } from "../../../requests";
|
||||
|
||||
function itemField(id = null): ItemField {
|
||||
return {
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error - not actually an issue
|
||||
id,
|
||||
name: faker.lorem.word(),
|
||||
type: "text",
|
||||
@@ -45,7 +45,7 @@ function label(): LabelCreate {
|
||||
return {
|
||||
name: faker.lorem.word(),
|
||||
description: faker.lorem.sentence(),
|
||||
color: faker.internet.color(),
|
||||
color: faker.color.rgb(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import type { Requests } from "../../requests";
|
||||
import { route } from ".";
|
||||
|
||||
@@ -47,7 +48,7 @@ export function parseDate<T>(obj: T, keys: Array<keyof T> = []): T {
|
||||
throw new Error(`Invalid date format: ${value}`);
|
||||
}
|
||||
|
||||
const [year, month, day] = split;
|
||||
const [year, month, day] = split as [string, string, string];
|
||||
|
||||
const dt = new Date();
|
||||
|
||||
@@ -90,9 +91,9 @@ export class BaseAPI {
|
||||
protected dropFields<T>(obj: T, keys: Array<keyof T> = []): T {
|
||||
const result = { ...obj };
|
||||
[...keys, "createdAt", "updatedAt"].forEach(key => {
|
||||
// @ts-ignore - we are checking for the key above
|
||||
// @ts-expect-error - TS doesn't know that we're checking for the key above
|
||||
if (hasKey(result, key)) {
|
||||
// @ts-ignore - we are guarding against this above
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete result[key];
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { toast } from "@/components/ui/sonner";
|
||||
import BaseContainer from "@/components/Base/Container.vue";
|
||||
import BaseSectionHeader from "@/components/Base/SectionHeader.vue";
|
||||
import ItemCard from "~/components/Item/Card.vue";
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -26,7 +29,7 @@
|
||||
navigateTo("/home");
|
||||
break;
|
||||
case 1:
|
||||
navigateTo(`/item/${data.items[0].id}`, { replace: true, redirectCode: 302 });
|
||||
navigateTo(`/item/${data.items[0]!.id}`, { replace: true, redirectCode: 302 });
|
||||
break;
|
||||
default:
|
||||
return data.items;
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
import { Button } from "@/components/ui/button";
|
||||
import LanguageSelector from "~/components/App/LanguageSelector.vue";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from "@/components/ui/tooltip";
|
||||
import AppLogo from "~/components/App/Logo.vue";
|
||||
import FormTextField from "~/components/Form/TextField.vue";
|
||||
import FormPassword from "~/components/Form/Password.vue";
|
||||
import FormCheckbox from "~/components/Form/Checkbox.vue";
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { ItemOut } from "~~/lib/api/types/data-contracts";
|
||||
import BaseContainer from "@/components/Base/Container.vue";
|
||||
import MaintenanceListView from "~/components/Maintenance/ListView.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
item: ItemOut;
|
||||
|
||||
Reference in New Issue
Block a user