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

Feature request: `prefer-vi-mocked`

Open me4502 opened this issue 9 months ago • 1 comments

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.

me4502 avatar May 08 '24 01:05 me4502