Skip to content

prefer-importing-vitest-globals does not flag or fix imports that are immediately called with a method #766

@stern-shawn

Description

@stern-shawn

First off, thanks a bunch for this plugin!

While using this to migrate away from globals: true to explicit imports, I noticed that the plugin with prefer-importing-vitest-globals enabled autofixes all direct instances where a vitest import should take place. For example, it('...'), describe('...'), etc all get auto-fixed and imported, great!

Unfortunately, instances like the following do not seem to be picked up by the linter and require manual fixes (which is a lot for a large mono-repo).

vi.spyOn();
it.each()
describe.skip();

The common difference between what works and what doesn't appears to be that the uncaught imports all deal with using a global import and immediately calling a method on it.

Have I possibly misconfigured something or is this working as intended? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions