fix(deps): update dependency typescript-eslint to v8 (#896)

* fix(deps): update dependency typescript-eslint to v8

* fix: lint issues

* fix: more lint issues

---------

Co-authored-by: homarr-renovate[bot] <158783068+homarr-renovate[bot]@users.noreply.github.com>
Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
homarr-renovate[bot]
2024-08-01 10:13:12 +02:00
committed by GitHub
parent 1811e1de79
commit a9a46024e2
12 changed files with 124 additions and 99 deletions

View File

@@ -41,7 +41,7 @@ export class PiHoleIntegration extends Integration implements DnsHoleSummaryInte
try {
const result = (await response.json()) as unknown;
if (typeof result === "object" && result !== null && "status" in result) return;
} catch (error) {
} catch {
throw new IntegrationTestConnectionError("invalidJson");
}

View File

@@ -41,9 +41,17 @@ export const ConfirmModal = createModal<Omit<ConfirmModalProps, "title">>(({ act
const handleCancel = useCallback(
async (event: React.MouseEvent<HTMLButtonElement>) => {
typeof cancelProps?.onClick === "function" && cancelProps.onClick(event);
typeof onCancel === "function" && (await onCancel());
closeOnCancel && actions.closeModal();
if (typeof cancelProps?.onClick === "function") {
cancelProps.onClick(event);
}
if (typeof onCancel === "function") {
await onCancel();
}
if (closeOnCancel) {
actions.closeModal();
}
},
[cancelProps?.onClick, onCancel, actions.closeModal],
);
@@ -51,9 +59,18 @@ export const ConfirmModal = createModal<Omit<ConfirmModalProps, "title">>(({ act
const handleConfirm = useCallback(
async (event: React.MouseEvent<HTMLButtonElement>) => {
setLoading(true);
typeof confirmProps?.onClick === "function" && confirmProps.onClick(event);
typeof onConfirm === "function" && (await onConfirm());
closeOnConfirm && actions.closeModal();
if (typeof confirmProps?.onClick === "function") {
confirmProps.onClick(event);
}
if (typeof onConfirm === "function") {
await onConfirm();
}
if (closeOnConfirm) {
actions.closeModal();
}
setLoading(false);
},
[confirmProps?.onClick, onConfirm, actions.closeModal],

View File

@@ -1,15 +1,16 @@
import { supportedLanguages } from ".";
const enTranslations = () => import("./lang/en");
const _enTranslations = () => import("./lang/en");
type EnTranslation = typeof _enTranslations;
export const languageMapping = () => {
const mapping: Record<string, unknown> = {};
for (const language of supportedLanguages) {
mapping[language] = () => import(`./lang/${language}`) as ReturnType<typeof enTranslations>;
mapping[language] = () => import(`./lang/${language}`) as ReturnType<EnTranslation>;
}
return mapping as Record<(typeof supportedLanguages)[number], () => ReturnType<typeof enTranslations>>;
return mapping as Record<(typeof supportedLanguages)[number], () => ReturnType<EnTranslation>>;
};
type NestedKeyOf<ObjectType extends object> = {
@@ -18,4 +19,4 @@ type NestedKeyOf<ObjectType extends object> = {
: `${Key}`;
}[keyof ObjectType & (string | number)];
export type TranslationKeys = NestedKeyOf<typeof enTranslations>;
export type TranslationKeys = NestedKeyOf<EnTranslation>;

View File

@@ -506,6 +506,7 @@ export default {
symbols: {
colon: ": ",
},
error: "Error",
action: {
add: "Add",
apply: "Apply",

View File

@@ -3,6 +3,7 @@
import { useCallback } from "react";
import {
ActionIcon,
Alert,
Anchor,
Button,
Fieldset,
@@ -125,7 +126,11 @@ const LocationSearchModal = createModal<LocationSearchInnerProps>(({ actions, in
});
if (error) {
throw error;
return (
<Alert title={tCommon("error")} color="red">
{error.message}
</Alert>
);
}
return (

View File

@@ -19,7 +19,7 @@ export default async function getServerDataAsync({ options }: WidgetProps<"app">
}
return { app, pingResult };
} catch (error) {
} catch {
return { app: null, pingResult: null };
}
}

View File

@@ -27,7 +27,7 @@ export default async function getServerDataAsync({ integrationIds, itemId }: Wid
)
.flatMap((item) => item.data),
};
} catch (error) {
} catch {
return {
initialData: [],
};

View File

@@ -16,7 +16,7 @@ export default async function getServerDataAsync({ integrationIds }: WidgetProps
return {
initialData: data,
};
} catch (error) {
} catch {
return {
initialData: undefined,
};