eslint-plugin-vitest
eslint-plugin-vitest copied to clipboard
Feature request: `prefer-vi-mocked`
This rule would require access to TypeScript types, so unsure if this fits into the scope of the plugin.
Basically my request is a rule called something like prefer-vi-mocked, that prefers usage of vi.mocked(thing) over (thing as Mock). The vi.mocked utility retains type information of the underlying mocked object, allowing proper type checking on function arguments and return types. Casting instead to Mock loses that information, and prevents type safety when mocking implementation or return value.
We do have other rules that depend on type information. If you want to implement this, a pr is welcome.