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:
@@ -4,8 +4,13 @@ import { useConfirm } from "@probo/ui";
|
||||
import { useMutation } from "react-relay";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
import type { AuditGraphCreateMutation } from "#/__generated__/core/AuditGraphCreateMutation.graphql";
|
||||
import type { AuditGraphUpdateMutation } from "#/__generated__/core/AuditGraphUpdateMutation.graphql";
|
||||
|
||||
import { useMutationWithToasts } from "../useMutationWithToasts";
|
||||
|
||||
/* eslint-disable relay/unused-fields, relay/must-colocate-fragment-spreads */
|
||||
|
||||
export const auditsQuery = graphql`
|
||||
query AuditGraphListQuery($organizationId: ID!) {
|
||||
node(id: $organizationId) {
|
||||
@@ -156,7 +161,7 @@ export const useDeleteAudit = (
|
||||
};
|
||||
|
||||
export const useCreateAudit = (connectionId: string) => {
|
||||
const [mutate] = useMutation(createAuditMutation);
|
||||
const [mutate] = useMutation<AuditGraphCreateMutation>(createAuditMutation);
|
||||
const { __ } = useTranslate();
|
||||
|
||||
return (input: {
|
||||
@@ -193,7 +198,7 @@ export const useCreateAudit = (connectionId: string) => {
|
||||
};
|
||||
|
||||
export const useUpdateAudit = () => {
|
||||
const [mutate] = useMutation(updateAuditMutation);
|
||||
const [mutate] = useMutation<AuditGraphUpdateMutation>(updateAuditMutation);
|
||||
const { __ } = useTranslate();
|
||||
|
||||
return (input: {
|
||||
|
||||
Reference in New Issue
Block a user