eslint-plugin-eslint-plugin
eslint-plugin-eslint-plugin copied to clipboard
Incorrect type inference for exported configs object: {}
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. 🙂
I’m +1 to generate types for this module
Will be handled by this issue which should be in the works soon:
- https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/310
Fixed in:
- https://github.com/eslint-community/eslint-plugin-eslint-plugin/releases/tag/v7.0.0