eslint-plugin-eslint-plugin icon indicating copy to clipboard operation
eslint-plugin-eslint-plugin copied to clipboard

Incorrect type inference for exported configs object: {}

Open JoshuaKGoldberg opened this issue 1 year ago • 1 comments

Right now, when I try to use the plugin in files with type-aware linting and typescript-eslint's recommendedTypeChecked config, I get:

/Users/josh/repos/typescript-eslint-examples/packages/eslint-plugin-example-typed-linting/eslint.config.mjs
  9:5  error  Unsafe argument of type `any` assigned to a parameter of type `ConfigWithExtends`  @typescript-eslint/no-unsafe-argument

...on lines like:


export default tseslint.config(
    eslintPlugin.configs['flat/recommended'],
);

Example: https://github.com/typescript-eslint/examples/blob/b91625d418f63b4bcc5127f2fb213222dcadf3cc/packages/eslint-plugin-example-typed-linting/eslint.config.mjs

The root cause is that the module's exported config object is inferred from .js to be {}:

https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/95b1980c87ba1a35a1c9e3e45a3f68b170a30bf4/lib/index.js#L51

Normally for a project that isn't written in TypeScript I'd just send a PR to DefinitelyTyped. But because this project already has #310 in its issues, I figured I'd give this a shot. 🙂

JoshuaKGoldberg avatar Aug 01 '24 16:08 JoshuaKGoldberg

I’m +1 to generate types for this module

voxpelli avatar Aug 01 '24 19:08 voxpelli

Will be handled by this issue which should be in the works soon:

  • https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/310

bmish avatar Jun 21 '25 16:06 bmish

Fixed in:

  • https://github.com/eslint-community/eslint-plugin-eslint-plugin/releases/tag/v7.0.0

bmish avatar Aug 04 '25 15:08 bmish