Skip to content

@tanstack/eslint-plugin-query config types are incompatible with Eslint defineConfig() types #9689

@joel-daros

Description

@joel-daros

Describe the bug

The @tanstack/eslint-plugin-query types for Eslint configs aren't compatible with the defineConfig() Eslint function.

This is my Eslint config file with @ts-check enabled:

// eslint.config.mjs

// @ts-check
import pluginTanstackQuery from "@tanstack/eslint-plugin-query";
import { defineConfig } from "eslint/config";

export default defineConfig([
  ...pluginTanstackQuery.configs['flat/recommended'],
  // Any other config...
]);

Error:

Argument of type 'Config<RulesRecord>[]' is not assignable to parameter of type 'InfiniteArray<ConfigWithExtends>'.
  Type 'Config<RulesRecord>[]' is not assignable to type 'InfiniteArray<ConfigWithExtends>[]'.
    Type 'Config<RulesRecord>' is not assignable to type 'InfiniteArray<ConfigWithExtends>'.
      Type 'Config<RulesRecord>' is not assignable to type 'ConfigWithExtends'.
        Types of property 'languageOptions' are incompatible.
          Type 'import("/Users/xxx/my-project/node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/types/index").Linter.LanguageOptions | undefined' is not assignable to type 'import("/Users/xxx/my-project/node_modules/.pnpm/@[email protected]/node_modules/@types/eslint/index").Linter.LanguageOptions | undefined'.
            Type 'import("/Users/xxx/my-project/node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/types/index").Linter.LanguageOptions' is not assignable to type 'import("/Users/xxx/my-project/node_modules/.pnpm/@[email protected]/node_modules/@types/eslint/index").Linter.LanguageOptions'.
              Types of property 'ecmaVersion' are incompatible.
                Type 'import("/Users/xxx/my-project/node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/types/index").Linter.EcmaVersion | undefined' is not assignable to type 'import("/Users/xxx/my-project/node_modules/.pnpm/@[email protected]/node_modules/@types/eslint/index").Linter.EcmaVersion | undefined'.
                  Type '17' is not assignable to type 'EcmaVersion | undefined'.ts(2345)

I'm using:

Eslint: 9.36
@tanstack/eslint-plugin-query: 5.90.1

Related issue with typescript-eslint that was solved recently:
typescript-eslint/typescript-eslint#10899

Your minimal, reproducible example

Not applicable

Steps to reproduce

  1. Follow the example above.

Expected behavior

Types must be compatible with defineConfig()

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

All

Tanstack Query adapter

None

TanStack Query version

5.90.1

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