Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: prefer-vi-mocked #443

Open
me4502 opened this issue May 8, 2024 · 1 comment
Open

Feature request: prefer-vi-mocked #443

me4502 opened this issue May 8, 2024 · 1 comment

Comments

@me4502
Copy link

me4502 commented May 8, 2024

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.

@veritem
Copy link
Owner

veritem commented May 9, 2024

We do have other rules that depend on type information. If you want to implement this, a pr is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants