TanStack / query

🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query.
https://tanstack.com/query
MIT License
41.89k stars 2.85k forks source link

ESLint Plugin: Flat Config Support #7544

Closed davidjbng closed 2 months ago

davidjbng commented 3 months ago

Describe the bug

eslint-plugin-query does not yet support the new Flat Config format

Your minimal, reproducible example

https://github.com/davidjbng/eslint-plugin-query-v9-example

Steps to reproduce

  1. Checkout https://github.com/davidjbng/eslint-plugin-query-v9-example
  2. Follow https://eslint.org/docs/latest/use/configure/migration-guide to add Flat Config support

Expected behavior

eslint-plugin-query works with Flat Config

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

not relevant

Tanstack Query adapter

None

TanStack Query version

v5.40.1

TypeScript version

No response

Additional context

ESLint V9 support is adressed in https://github.com/TanStack/query/pull/7543

I did some inital work to export a flat/recommended config earlier which seemed to work, but a bit more testing was still needed. See https://github.com/TanStack/query/compare/main...davidjbng:query:eslint-v9-flat-config

Resources

SimenB commented 3 months ago

Workaround, if people need it:

import { fixupPluginRules } from '@eslint/compat';
import * as eslintPluginTanstackQuery from '@tanstack/eslint-plugin-query';

export default [
  {
    plugins: {
      '@tanstack/query': fixupPluginRules(eslintPluginTanstackQuery),
    },
    rules: eslintPluginTanstackQuery.configs.recommended.rules,
  },
];
lachlancollins commented 2 months ago

Fixed in #7663, see https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query for setup instructions