Skip to content

eslint-plugin-query: mutation function is turned into mutation key #4938

@henribru

Description

@henribru

Describe the bug

The ESLint plugin is turning the mutation function into the mutation key

Your minimal, reproducible example

https://stackblitz.com/edit/vitejs-vite-6buzvj?file=src%2Fmain.ts&terminal=dev

Steps to reproduce

  1. Press ctrl-c to exit the vite dev server
  2. Run npx eslint src/main.ts --fix
  3. Observe that useMutation(() => Promise.resolve(3)); turned into useMutation({ mutationKey: () => Promise.resolve(3) });

Expected behavior

I expected useMutation({ mutationFn: () => Promise.resolve(3) });

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • Linux
  • Firefox
  • 109.0

TanStack Query version

v4.24.5 of @tanstack/eslint-plugin-query

TypeScript version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions