fix(deps): update dependency eslint-plugin-react-hooks to v5 (#1280)

* 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 <meierschlumpf@gmail.com>
This commit is contained in:
homarr-renovate[bot]
2024-10-16 21:43:51 +02:00
committed by GitHub
parent ea43ed0ca4
commit a87c937b69
39 changed files with 251 additions and 224 deletions

View File

@@ -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>
);
};

View File

@@ -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>
);
};

View File

@@ -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}

View File

@@ -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);
}

View File

@@ -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,

View File

@@ -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;
}>(),

View File

@@ -16,7 +16,7 @@ const appChildrenOptions = createChildrenOptions<App>({
useActions: () => [
{
key: "open",
component: () => {
Component: () => {
const t = useI18n();
return (
@@ -34,7 +34,7 @@ const appChildrenOptions = createChildrenOptions<App>({
},
{
key: "edit",
component: () => {
Component: () => {
const t = useI18n();
return (
@@ -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 (
@@ -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"

View File

@@ -23,7 +23,7 @@ const boardChildrenOptions = createChildrenOptions<Board>({
const actions: (ChildrenAction<Board> & { hidden?: boolean })[] = [
{
key: "open",
component: () => {
Component: () => {
const t = useI18n();
return (
@@ -37,7 +37,7 @@ const boardChildrenOptions = createChildrenOptions<Board>({
},
{
key: "homeBoard",
component: () => {
Component: () => {
const t = useI18n();
return (
@@ -61,7 +61,7 @@ const boardChildrenOptions = createChildrenOptions<Board>({
},
{
key: "settings",
component: () => {
Component: () => {
const t = useI18n();
return (
@@ -78,7 +78,7 @@ const boardChildrenOptions = createChildrenOptions<Board>({
return actions;
},
detailComponent: ({ options: board }) => {
DetailComponent: ({ options: board }) => {
const t = useI18n();
return (
@@ -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} />

View File

@@ -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} />

View File

@@ -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">
@@ -53,7 +53,7 @@ export const languageChildrenOptions = createChildrenOptions<Record<string, unkn
},
}));
},
detailComponent: () => {
DetailComponent: () => {
const t = useI18n();
return (

View File

@@ -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" />
@@ -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 (

View File

@@ -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>

View File

@@ -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 (
@@ -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">
@@ -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">

View File

@@ -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 (
@@ -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>

View File

@@ -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>

View File

@@ -16,7 +16,7 @@ const groupChildrenOptions = createChildrenOptions<Group>({
useActions: () => [
{
key: "detail",
component: () => {
Component: () => {
const t = useI18n();
return (
<Group mx="md" my="sm">
@@ -29,7 +29,7 @@ const groupChildrenOptions = createChildrenOptions<Group>({
},
{
key: "manageMember",
component: () => {
Component: () => {
const t = useI18n();
return (
<Group mx="md" my="sm">
@@ -42,7 +42,7 @@ const groupChildrenOptions = createChildrenOptions<Group>({
},
{
key: "managePermission",
component: () => {
Component: () => {
const t = useI18n();
return (
<Group mx="md" my="sm">
@@ -54,7 +54,7 @@ const groupChildrenOptions = createChildrenOptions<Group>({
useInteraction: interaction.link(({ id }) => ({ href: `/manage/users/groups/${id}/permissions` })),
},
],
detailComponent: ({ options }) => {
DetailComponent: ({ options }) => {
const t = useI18n();
return (
<Stack mx="md" my="sm">
@@ -71,7 +71,7 @@ const groupChildrenOptions = createChildrenOptions<Group>({
export const groupsSearchGroup = createGroup<Group>({
keyPath: "id",
title: "Groups",
component: ({ name }) => (
Component: ({ name }) => (
<Group px="md" py="sm">
<Text>{name}</Text>
</Group>

View File

@@ -17,7 +17,7 @@ const userChildrenOptions = createChildrenOptions<User>({
useActions: () => [
{
key: "detail",
component: () => {
Component: () => {
const t = useI18n();
return (
@@ -30,7 +30,7 @@ const userChildrenOptions = createChildrenOptions<User>({
useInteraction: interaction.link(({ id }) => ({ href: `/manage/users/${id}/general` })),
},
],
detailComponent: ({ options }) => {
DetailComponent: ({ options }) => {
const t = useI18n();
return (
@@ -49,7 +49,7 @@ const userChildrenOptions = createChildrenOptions<User>({
export const usersSearchGroup = createGroup<User>({
keyPath: "id",
title: (t) => t("search.mode.userGroup.group.user.title"),
component: (user) => (
Component: (user) => (
<Group px="md" py="sm">
<UserAvatar user={user} size="sm" />
<Text>{user.name}</Text>