---
url: /docs/guide/usage/linter/rules/vitest/prefer-importing-vitest-globals.md
---

### What it does

Enforces explicit imports from 'vitest' instead of using Vitest globals.

### Why is this bad?

Using Vitest globals without importing them relies on implicit global configuration
(`globals: true` in vitest config). Explicit imports make dependencies clear,
improve IDE support, and ensure compatibility across different setups.

### Examples

Examples of **incorrect** code for this rule:

```js
describe("suite", () => {
  it("test", () => {
    expect(true).toBe(true);
  });
});
```

Examples of **correct** code for this rule:

```js
import { describe, it, expect } from "vitest";

describe("suite", () => {
  it("test", () => {
    expect(true).toBe(true);
  });
});
```

## How to use

## Version

This rule was added in v1.59.0.

## References
