From cc7ee7b13381e452ba5032652ab4c60972fc71de Mon Sep 17 00:00:00 2001 From: alex-mcgovern Date: Fri, 24 Jan 2025 15:58:44 +0000 Subject: [PATCH] chore: enforce use of useToastMutation --- eslint.config.js | 16 ++++++++++++++-- src/hooks/use-toast-mutation.ts | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 6a4c2802..25f88697 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -3,7 +3,7 @@ import globals from "globals"; import reactHooks from "eslint-plugin-react-hooks"; import reactRefresh from "eslint-plugin-react-refresh"; import tseslint from "typescript-eslint"; -import tailwindPlugin from 'eslint-plugin-tailwindcss' +import tailwindPlugin from "eslint-plugin-tailwindcss"; export default tseslint.config( { ignores: ["dist"] }, @@ -56,6 +56,18 @@ export default tseslint.config( ], }, ], + "no-restricted-imports": [ + "error", + { + paths: [ + { + importNames: ["useMutation"], + message: "Use the custom `useToastMutation` instead", + name: "@tanstack/react-query", + }, + ], + }, + ], }, - } + }, ); diff --git a/src/hooks/use-toast-mutation.ts b/src/hooks/use-toast-mutation.ts index a087de57..29b8686a 100644 --- a/src/hooks/use-toast-mutation.ts +++ b/src/hooks/use-toast-mutation.ts @@ -1,6 +1,7 @@ import { toast } from "@stacklok/ui-kit"; import { DefaultError, + // eslint-disable-next-line no-restricted-imports useMutation, UseMutationOptions, } from "@tanstack/react-query";