Skip to content

linter: jest and vitest plugins do not work with vite-plus/test #20955

@dvanoni

Description

@dvanoni

What version of Oxlint are you using?

1.58.0

What command did you run?

vp lint

What does your .oxlintrc.json (or oxlint.config.ts) config file look like?

vite.config.ts

import { defineConfig } from "vite-plus";

export default defineConfig({
  lint: {
    options: { typeAware: true, typeCheck: true },
    plugins: ["jest", "vitest"],
    rules: {
      "jest/expect-expect": "error",
      "vitest/warn-todo": "error",
    },
  },
});

What happened?

When test is imported from vite-plus/test instead of vitest, the Oxlint jest and vitest plugins do not recognize it as a test function, so the plugin rules silently do nothing.

See a reproduction here: https://github.com/dvanoni/vite-plus-test-lint-issue

import { test as vpTest } from "vite-plus/test";
import { test as vitestTest } from "vitest";

// ✗ Should error (jest/expect-expect) — but does NOT
vpTest(
  "vite-plus/test does not have expected jest/expect-expect lint error",
  () => {},
);

// ✗ Should error (vitest/warn-todo) — but does NOT
vpTest.todo(
  "vite-plus/test does not have expected vitest/warn-todo lint error",
  () => {},
);

// ✓ Correctly errors (jest/expect-expect)
vitestTest("vitest does have expected jest/expect-expect lint error", () => {});

// ✓ Correctly errors (vitest/warn-todo)
vitestTest.todo(
  "vitest does have expected vitest/warn-todo lint error",
  () => {},
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions