Skip to content

Commit

Permalink
fix(deps): update dependency eslint-plugin-react-hooks to v5 (#1280)
Browse files Browse the repository at this point in the history
* fix(deps): update dependency eslint-plugin-react-hooks to v5

* fix: lint issues after reenabling hook rules

* fix: format issues

---------

Co-authored-by: homarr-renovate[bot] <158783068+homarr-renovate[bot]@users.noreply.github.com>
Co-authored-by: Meier Lukas <[email protected]>
  • Loading branch information
homarr-renovate[bot] and Meierschlumpf authored Oct 16, 2024
1 parent ea43ed0 commit a87c937
Show file tree
Hide file tree
Showing 39 changed files with 251 additions and 224 deletions.
1 change: 1 addition & 0 deletions apps/nextjs/src/app/[locale]/boards/(content)/_context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const BoardProvider = ({

useEffect(() => {
setReadySections((previous) => previous.filter((id) => data.sections.some((section) => section.id === id)));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [data.sections.length, setReadySections]);

const markAsReady = useCallback((id: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const ApiKeysManagement = ({ apiKeys }: ApiKeysManagementProps) => {
),
},
],
[],
[t],
);

const table = useMantineReactTable({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const UserProfileForm = ({ user }: UserProfileFormProps) => {
id: user.id,
});
},
[user.id, mutate],
[isProviderCredentials, mutate, user.id],
);

return (
Expand Down
4 changes: 1 addition & 3 deletions apps/nextjs/src/components/board/items/item-move-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { useI18n, useScopedI18n } from "@homarr/translation/client";
import { z } from "@homarr/validation";

import type { Item } from "~/app/[locale]/boards/_types";
import { useItemActions } from "./item-actions";

interface InnerProps {
gridStack: GridStack;
Expand All @@ -21,7 +20,6 @@ export const ItemMoveModal = createModal<InnerProps>(({ actions, innerProps }) =
const t = useI18n();
// Keep track of the maximum width based on the x offset
const maxWidthRef = useRef(innerProps.columnCount - innerProps.item.xOffset);
const { moveAndResizeItem } = useItemActions();
const form = useZodForm(
z.object({
xOffset: z
Expand Down Expand Up @@ -62,7 +60,7 @@ export const ItemMoveModal = createModal<InnerProps>(({ actions, innerProps }) =
});
actions.closeModal();
},
[moveAndResizeItem],
[actions, innerProps.gridStack, innerProps.item.id],
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const GridStackItem = ({
if (type !== "section") return;
innerRef.current.gridstackNode.minW = minWidth;
innerRef.current.gridstackNode.minH = minHeight;
}, [minWidth, minHeight, innerRef]);
}, [minWidth, minHeight, innerRef, type]);

return (
<Box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ export const useGridstack = (section: Omit<Section, "items">, itemIds: string[])
}

// Only run this effect when the section items change
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [itemIds.length, columnCount]);

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/src/components/user-avatar-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const UserAvatarMenu = ({ children }: UserAvatarMenuProps) => {
router.refresh();
},
});
}, [openModal, router]);
}, [logoutUrl, openModal, router]);

return (
<Menu width={300} withArrow withinPortal>
Expand Down
4 changes: 2 additions & 2 deletions packages/modals/src/confirm-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const ConfirmModal = createModal<Omit<ConfirmModalProps, "title">>(({ act
actions.closeModal();
}
},
[cancelProps?.onClick, onCancel, actions.closeModal],
[cancelProps, onCancel, closeOnCancel, actions],
);

const handleConfirm = useCallback(
Expand All @@ -73,7 +73,7 @@ export const ConfirmModal = createModal<Omit<ConfirmModalProps, "title">>(({ act
}
setLoading(false);
},
[confirmProps?.onClick, onConfirm, actions.closeModal],
[confirmProps, onConfirm, closeOnConfirm, actions],
);

return (
Expand Down
7 changes: 2 additions & 5 deletions packages/modals/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const ModalProvider = ({ children }: PropsWithChildren) => {
(id: string, canceled?: boolean) => {
dispatch({ type: "CLOSE", modalId: id, canceled });
},
[stateRef, dispatch],
[dispatch],
);

const openModalInner: ModalContextProps["openModalInner"] = useCallback(
Expand All @@ -63,10 +63,7 @@ export const ModalProvider = ({ children }: PropsWithChildren) => {
[dispatch],
);

const handleCloseModal = useCallback(
() => state.current && closeModal(state.current.id),
[closeModal, state.current?.id],
);
const handleCloseModal = useCallback(() => state.current && closeModal(state.current.id), [closeModal, state]);

const activeModals = state.modals.filter((modal) => modal.id === state.current?.id || modal.props.keepMounted);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const ChildrenActionItem = ({ childrenOptions, action, query }: ChildrenA

return (
<Spotlight.Action renderRoot={renderRoot} onClick={onClick} className={classes.spotlightAction}>
<action.component {...childrenOptions.option} />
<action.Component {...childrenOptions.option} />
</Spotlight.Action>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const SpotlightGroupActionItem = <TOption extends Record<string, unknown>
closeSpotlightOnTrigger={interaction.type !== "mode" && interaction.type !== "children"}
className={classes.spotlightAction}
>
<group.component {...option} />
<group.Component {...option} />
</Spotlight.Action>
);
};
2 changes: 1 addition & 1 deletion packages/spotlight/src/components/spotlight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const Spotlight = () => {

{childrenOptions ? (
<Group>
<childrenOptions.detailComponent options={childrenOptions.option as never} />
<childrenOptions.DetailComponent options={childrenOptions.option as never} />
</Group>
) : null}

Expand Down
4 changes: 2 additions & 2 deletions packages/spotlight/src/lib/children.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import type { ReactNode } from "react";
import type { inferSearchInteractionDefinition } from "./interaction";

export interface CreateChildrenOptionsProps<TParentOptions extends Record<string, unknown>> {
detailComponent: ({ options }: { options: TParentOptions }) => ReactNode;
DetailComponent: ({ options }: { options: TParentOptions }) => ReactNode;
useActions: (options: TParentOptions, query: string) => ChildrenAction<TParentOptions>[];
}

export interface ChildrenAction<TParentOptions extends Record<string, unknown>> {
key: string;
component: (option: TParentOptions) => JSX.Element;
Component: (option: TParentOptions) => JSX.Element;
useInteraction: (option: TParentOptions, query: string) => inferSearchInteractionDefinition<"link" | "javaScript">;
hide?: boolean | ((option: TParentOptions) => boolean);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/spotlight/src/lib/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type CommonSearchGroup<TOption extends Record<string, unknown>, TOptionProps ext
// key path is used to define the path to a unique key in the option object
keyPath: keyof TOption;
title: stringOrTranslation;
component: (option: TOption) => JSX.Element;
Component: (option: TOption) => JSX.Element;
useInteraction: (option: TOption, query: string) => inferSearchInteractionDefinition<SearchInteraction>;
onKeyDown?: (
event: KeyboardEvent,
Expand Down
2 changes: 1 addition & 1 deletion packages/spotlight/src/lib/interaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const searchInteractions = [
// eslint-disable-next-line @typescript-eslint/no-explicit-any
useActions: CreateChildrenOptionsProps<any>["useActions"];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
detailComponent: CreateChildrenOptionsProps<any>["detailComponent"];
DetailComponent: CreateChildrenOptionsProps<any>["DetailComponent"];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
option: any;
}>(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const appChildrenOptions = createChildrenOptions<App>({
useActions: () => [
{
key: "open",
component: () => {
Component: () => {
const t = useI18n();

return (
Expand All @@ -34,7 +34,7 @@ const appChildrenOptions = createChildrenOptions<App>({
},
{
key: "edit",
component: () => {
Component: () => {
const t = useI18n();

return (
Expand All @@ -47,7 +47,7 @@ const appChildrenOptions = createChildrenOptions<App>({
useInteraction: interaction.link(({ id }) => ({ href: `/manage/apps/edit/${id}` })),
},
],
detailComponent: ({ options }) => {
DetailComponent: ({ options }) => {
const t = useI18n();

return (
Expand Down Expand Up @@ -75,7 +75,7 @@ const appChildrenOptions = createChildrenOptions<App>({
export const appsSearchGroup = createGroup<App>({
keyPath: "id",
title: (t) => t("search.mode.appIntegrationBoard.group.app.title"),
component: (app) => (
Component: (app) => (
<Group px="md" py="sm">
<Avatar
size="sm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const boardChildrenOptions = createChildrenOptions<Board>({
const actions: (ChildrenAction<Board> & { hidden?: boolean })[] = [
{
key: "open",
component: () => {
Component: () => {
const t = useI18n();

return (
Expand All @@ -37,7 +37,7 @@ const boardChildrenOptions = createChildrenOptions<Board>({
},
{
key: "homeBoard",
component: () => {
Component: () => {
const t = useI18n();

return (
Expand All @@ -61,7 +61,7 @@ const boardChildrenOptions = createChildrenOptions<Board>({
},
{
key: "settings",
component: () => {
Component: () => {
const t = useI18n();

return (
Expand All @@ -78,7 +78,7 @@ const boardChildrenOptions = createChildrenOptions<Board>({

return actions;
},
detailComponent: ({ options: board }) => {
DetailComponent: ({ options: board }) => {
const t = useI18n();

return (
Expand All @@ -102,7 +102,7 @@ const boardChildrenOptions = createChildrenOptions<Board>({
export const boardsSearchGroup = createGroup<Board>({
keyPath: "id",
title: "Boards",
component: (board) => (
Component: (board) => (
<Group px="md" py="sm">
{board.logoImageUrl ? (
<img src={board.logoImageUrl} alt={board.name} width={24} height={24} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { interaction } from "../../lib/interaction";
export const integrationsSearchGroup = createGroup<{ id: string; kind: IntegrationKind; name: string }>({
keyPath: "id",
title: (t) => t("search.mode.appIntegrationBoard.group.integration.title"),
component: (integration) => (
Component: (integration) => (
<Group px="md" py="sm">
<IntegrationAvatar size="sm" kind={integration.kind} />

Expand Down
4 changes: 2 additions & 2 deletions packages/spotlight/src/modes/command/children/language.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const languageChildrenOptions = createChildrenOptions<Record<string, unkn
)
.map(({ localeKey, attributes }) => ({
key: localeKey,
component() {
Component() {
return (
<Group mx="md" my="sm" wrap="nowrap" justify="space-between" w="100%">
<Group wrap="nowrap">
Expand All @@ -53,7 +53,7 @@ export const languageChildrenOptions = createChildrenOptions<Record<string, unkn
},
}));
},
detailComponent: () => {
DetailComponent: () => {
const t = useI18n();

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const newIntegrationChildrenOptions = createChildrenOptions<Record<string
)
.map(([kind, integrationDef]) => ({
key: kind,
component() {
Component() {
return (
<Group mx="md" my="sm" wrap="nowrap" w="100%">
<IntegrationAvatar kind={kind} size="sm" />
Expand All @@ -31,7 +31,7 @@ export const newIntegrationChildrenOptions = createChildrenOptions<Record<string
useInteraction: interaction.link(() => ({ href: `/manage/integrations/new?kind=${kind}` })),
}));
},
detailComponent() {
DetailComponent() {
const t = useI18n();

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/spotlight/src/modes/command/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const commandMode = {
keyPath: "commandKey",
title: "Global commands",
useInteraction: (option, query) => option.useInteraction(option, query),
component: ({ icon: Icon, name }) => (
Component: ({ icon: Icon, name }) => (
<Group px="md" py="sm">
<Icon stroke={1.5} />
<Text>{name}</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const searchEnginesChildrenOptions = createChildrenOptions<SearchEngine>(
useActions: () => [
{
key: "search",
component: ({ name }) => {
Component: ({ name }) => {
const tChildren = useScopedI18n("search.mode.external.group.searchEngine.children");

return (
Expand All @@ -30,7 +30,7 @@ export const searchEnginesChildrenOptions = createChildrenOptions<SearchEngine>(
})),
},
],
detailComponent({ options }) {
DetailComponent({ options }) {
const tChildren = useScopedI18n("search.mode.external.group.searchEngine.children");
return (
<Stack mx="md" my="sm">
Expand All @@ -47,7 +47,7 @@ export const searchEnginesChildrenOptions = createChildrenOptions<SearchEngine>(
export const searchEnginesSearchGroups = createGroup<SearchEngine>({
keyPath: "short",
title: (t) => t("search.mode.external.group.searchEngine.title"),
component: ({ iconUrl, name, short, description }) => {
Component: ({ iconUrl, name, short, description }) => {
return (
<Group w="100%" wrap="nowrap" justify="space-between" align="center" px="md" py="xs">
<Group wrap="nowrap">
Expand Down
4 changes: 2 additions & 2 deletions packages/spotlight/src/modes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const helpMode = {
keyPath: "character",
title: (t) => t("search.mode.help.group.mode.title"),
options: searchModesWithoutHelp.map(({ character, modeKey }) => ({ character, modeKey })),
component: ({ modeKey, character }) => {
Component: ({ modeKey, character }) => {
const t = useScopedI18n(`search.mode.${modeKey}`);

return (
Expand Down Expand Up @@ -59,7 +59,7 @@ const helpMode = {
},
];
},
component: (props) => (
Component: (props) => (
<Group px="md" py="xs" w="100%" wrap="nowrap" align="center">
<props.icon />
<Text>{props.label}</Text>
Expand Down
2 changes: 1 addition & 1 deletion packages/spotlight/src/modes/page/pages-search-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const pagesSearchGroup = createGroup<{
}>({
keyPath: "path",
title: (t) => t("search.mode.page.group.page.title"),
component: ({ name, icon: Icon }) => (
Component: ({ name, icon: Icon }) => (
<Group px="md" py="sm">
<Icon stroke={1.5} />
<Text>{name}</Text>
Expand Down
Loading

0 comments on commit a87c937

Please sign in to comment.