Skip to content

linter: valid_describe_callback should not execute in Vitest #9060

@baseballyama

Description

@baseballyama

What version of Oxlint are you using?

0.15.10

What command did you run?

oxlint -c=../../../.oxlintrc.json

What does your .oxlintrc.json config file look like?

{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "categories": {
    "correctness": "error"
  },
  "plugins": ["typescript", "unicorn", "oxc", "security", "n", "vitest"],
  "env": {},
  "settings": {},
  "rules": {
    "eqeqeq": ["error", "always", { "null": "ignore" }],
    "vitest/expect-expect": "off",
    "vitest/no-disabled-tests": "off",
    "vitest/no-conditional-expect": "off",
    "jest/no-standalone-expect": "off",
    "jest/no-export": "off",
    "jest/valid-title": "off",
    "no-document-cookie": "off",
    "no-unused-vars": "off"
  }
}

What happened?

describe('FixtureTest', async () => {
  const files = collectTsFiles('./tests/fixtures');
  for (const file of files) {
    const { config } = await import(file);

    test(file, async () => {
      await runFixtureTest(config);
    });
  }
});

oxlint reports below error.

  × eslint-plugin-jest(valid-describe-callback): No async describe callback
     ╭─[tests/fixture-test.spec.ts:116:25]
 115 │     
 116 │ ╭─▶ describe('FixtureTest', async () => {
 117 │ │     const files = collectTsFiles('./tests/fixtures');
 118 │ │     for (const file of files) {
 119 │ │       const { config } = await import(file);
 120 │ │   
 121 │ │       test(file, async () => {
 122 │ │         // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
 123 │ │         await runFixtureTest(config);
 124 │ │       });
 125 │ │     }
 126 │ ╰─▶ });
     ╰────
  help: Remove `async` keyword

However, I believe that Vitest does not need to report this because it supports async functions for describe.
ref: vitest-dev/vitest#703 (comment)

Metadata

Metadata

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