Skip to content

linter: unicorn/no-useless-undefined does not respect checkArguments option #14368

@yunarch

Description

@yunarch

What version of Oxlint are you using?

1.14.0

But test it from >=1.14.0 to the current latest (1.19.0)

What command did you run?

oxlint

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

{
  "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
  "plugins": ["unicorn"],
  "rules": {
    "unicorn/no-useless-undefined": ["error", { "checkArguments": false }]
  }
}

What happened?

The rule unicorn/no-useless-undefined should support the checkArguments option, as indicated in the source code:

Based on the implementation, when checkArguments is set to false, the rule should not report an error for cases where undefined is passed as an argument.

However, the following code snippet incorrectly triggers a lint error in oxlint, while eslint (with unicorn/no-useless-undefined and checkArguments: false) does not report any issue:

function run(name?: string) {
  return `hi ${name}`;
}

run(undefined);

I think oxlint may not be correctly handling the checkArguments option in the rule configuration and could be the same for checkArrowFunctionBody. There are tests in place to check that behavior but unsure if there is something wrong or what I understand is wrong.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions