vitest-dev / eslint-plugin-vitest

eslint plugin for vitest
MIT License
325 stars 44 forks source link

Feature request: support typecheck in rule: `valid-expect` #524

Open levchak0910 opened 1 month ago

levchak0910 commented 1 month ago

Hi, thanks for such a great plugin, it helps a lot )

Based on tests seems like the rule valid-expect doesn't (or not entirely) supports typecheck

import { describe, expectTypeOf, test } from "vitest"

describe("valid-expect", () => {
  test("cases", async () => {
    const fn = (arg: string): number => Number(arg)

    expectTypeOf(fn).toBeFunction() // OK
    expectTypeOf(fn).parameter(0).toMatchTypeOf<string>() // OK
    expectTypeOf(fn).returns.toMatchTypeOf<number>() // Fail: Expect has unknown modifier eslint test/valid-expect
  })
})

Do you have any plans to fix or add support for it?