-
-
Notifications
You must be signed in to change notification settings - Fork 923
Labels
A-linterArea - LinterArea - Linter
Description
What version of Oxlint are you using?
1.51.0
What command did you run?
npx oxlint
What does your .oxlintrc.json (or oxlint.config.ts) config file look like?
What happened?
Ran oxlint on the following with prefer-const set to "prefer-const": ["error", { "destructuring": "all" }],
async function destroyItems() {
return Promise.resolve(4);
}
async function myFunction() {
let nItemsDestroyed: number;
nItemsDestroyed = await destroyItems();
nItemsDestroyed += await destroyItems();
console.info(`destroyItem: ${nItemsDestroyed} items destroyed.`);
}
myFunction();And got the false positive report:
× eslint(prefer-const): `nItemsDestroyed` is never reassigned.
╭─[index.ts:7:7]
6 │ async function myFunction() {
7 │ let nItemsDestroyed: number;
· ───────────────
8 │ nItemsDestroyed = await destroyItems();
╰────
help: Use `const` instead.
ESLint does not flag on the same configuration.
Reproduction: https://github.com/MichaelGoff/oxlint-prefer-const
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-linterArea - LinterArea - Linter
Type
Fields
Give feedbackPriority
None yet
Effort
None yet
{ "env": { "browser": true, "node": true, "jest": true }, "categories": { "correctness": "error" }, "plugins": ["import", "unicorn", "typescript", "oxc", "vue"], "rules": { "prefer-const": ["error", { "destructuring": "all" }], } }