-
-
Notifications
You must be signed in to change notification settings - Fork 26
rules not assignable to definitely typed eslint Rules which are used by config.plugin #172
Comments
Not 100% yet, could you link me the definitely typed and maybe also provide a reproducible so I understand better what the issue is? |
https://stackblitz.com/edit/typescript-zgntds?file=index.ts import type { Rules } from 'eslint-define-config';
import type { Linter } from 'eslint';
const rules1: Rules = {};
const rules2: Linter.RulesRecord = {};
const rules: Linter.RulesRecord = {
...rules1,
...rules2,
}; Yes here is a minimal example showing the problem with a stackblitz. In strict mode |
Could you try downgrading and pin your |
ahh I see - ok - yah that works, I can pin my version to be the same. thanks for the quick help @Shinigami92! Going to leave this open for the community in case someone else runs into the same thing, but feel free to close if you want. |
Perfect 👍 |
I had a first look and it takes more time than just some minutes I need to update many rules especially the generation for
I assume one of these both breaks it Maybe I could even harden the types on https://github.com/DefinitelyTyped/DefinitelyTyped/blob/808bf075ca716aab85e3e317b49d8638cacc23a5/types/eslint/index.d.ts#L717-L719 instead of loosing my types The biggest problem!: I cannot use ... I need more time to investigate this and dig deeper (so sadly maybe not today) |
@spence-s would you like to give me feedback if everything is working as needed? |
@Shinigami92 - I actually changed my approach a bit so that this libs types override anything from eslint so I no longer have the problem at all. (even without the patch) - I do appreciate your quick attention to this though! 🙌🏻 |
So the issue is this:
config.plugins is typed using
ESLint.Plugin
which contains a rules field which is typed:Record<string, ((...args: any[]) => any) | Rule.RuleModule> | undefined;
However, there are a lot of assignability issues between the way the definitely typed eslint package types rules and the way rules are typed here.
Is there a way we can fix this so that they are properly assignable?
Hope that issue was clear, thanks!
The text was updated successfully, but these errors were encountered: