-
-
Notifications
You must be signed in to change notification settings - Fork 722
Description
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?
What happened?
The rule unicorn/no-useless-undefined should support the checkArguments option, as indicated in the source code:
- https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-useless-undefined.html#unicorn-no-useless-undefined
- https://github.com/oxc-project/oxc/blob/eb6345f0c2927517ad5eff19c54a5d636f17b106/crates/oxc_linter/src/rules/unicorn/no_useless_undefined.rs
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.
{ "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json", "plugins": ["unicorn"], "rules": { "unicorn/no-useless-undefined": ["error", { "checkArguments": false }] } }