Add eslint-disable and TypeScript generics to graph hooks

Centralized graph files (hooks/graph/*.ts) define GraphQL
queries consumed by multiple page components. This architecture
intentionally separates field definitions from usage, triggering
relay/unused-fields and relay/must-colocate-fragment-spreads.
File-level eslint-disable comments suppress these false positives.

Also adds explicit TypeScript generics to useMutation and
usePaginationFragment calls to satisfy relay/generated-typescript-types
without eslint-disable.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-03-15 13:32:18 +01:00
parent dbb4811a2c
commit d263cda3f6
21 changed files with 98 additions and 24 deletions

View File

@@ -4,8 +4,13 @@ import { useConfirm } from "@probo/ui";
import { useMutation } from "react-relay";
import { graphql } from "relay-runtime";
import type { ObligationGraphCreateMutation } from "#/__generated__/core/ObligationGraphCreateMutation.graphql";
import type { ObligationGraphUpdateMutation } from "#/__generated__/core/ObligationGraphUpdateMutation.graphql";
import { useMutationWithToasts } from "../useMutationWithToasts";
/* eslint-disable relay/unused-fields, relay/must-colocate-fragment-spreads */
export const ObligationsConnectionKey = "ObligationsPage_obligations";
export const obligationsQuery = graphql`
@@ -150,7 +155,7 @@ export const useDeleteObligation = (
};
export const useCreateObligation = (connectionId: string) => {
const [mutate] = useMutation(createObligationMutation);
const [mutate] = useMutation<ObligationGraphCreateMutation>(createObligationMutation);
const { __ } = useTranslate();
return (input: {
@@ -195,7 +200,7 @@ export const useCreateObligation = (connectionId: string) => {
};
export const useUpdateObligation = () => {
const [mutate] = useMutation(updateObligationMutation);
const [mutate] = useMutation<ObligationGraphUpdateMutation>(updateObligationMutation);
const { __ } = useTranslate();
return (input: {