Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
spaceemotion opened this issue Oct 11, 2024 · 1 comment · Fixed by #6455
Assignees
Labels
A-linter Area - Linter C-bug Category - Bug

Comments

@spaceemotion
Copy link

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.

@spaceemotion spaceemotion added A-linter Area - Linter C-bug Category - Bug labels Oct 11, 2024
@shulaoda
Copy link
Contributor

Let me take a quick look, it should be quite simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-bug Category - Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants