Skip to content

linter: vitest/valid-expect throws error for when a message is used as second parameter, and first parameter is not a variable #6454

@spaceemotion

Description

@spaceemotion

What version of Oxlint are you using?

latest

What command did you run?

pnpm dlx oxlint@latest --import-plugin --promise-plugin --vitest-plugin --fix-suggestions --tsconfig=../../tsconfig.json -D vitest/valid-expect

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

none, just pure CLI

What happened?

I am getting errors on all the expect calls where I am using a second argument for the error message, like so:

  × eslint-plugin-vitest(valid-expect): Expect requires at least 1 argument
    ╭─[src/utils/text.test.ts:30:3]
 29 │ ])(`counts words correctly: %s`, (input: string, expected: number, lang: string = 'en') => {
 30 │   expect(getWordCount(input, lang), `${input} (${lang})`).toEqual(expected);
    ·   ───────────────────────────────────────────────────────
 31 │ });
    ╰────
  help: Add the missing arguments.

I noticed that this only seems to happen that when the first argument is not a variable, but a function call instead.

Metadata

Metadata

Assignees

Labels

A-linterArea - LinterC-bugCategory - Bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions