mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
This PR updates no-unused-var's fixer for `VariableDeclarator`s in two
ways:
1. Unused function expressions and arrow functions not declared in the
top scope
will now be removed.
```ts
// not deleted, no change
const x = function() {}
const y = (a) => a
function z() {}
// new behavior
function foo() { // <- not deleted
const x = () => {} // <- deleted
const y = function() {} // <- this too
}
```
2. Variables initialized to an `await` expression will not be deleted.
```ts
// unused await-initialized variables are often API calls with side
effects
// in the real world; we don't want to delete these.
const res = await createUser(data)
```
|
||
|---|---|---|
| .. | ||
| examples | ||
| fixtures | ||
| src | ||
| tests | ||
| Cargo.toml | ||
| CHANGELOG.md | ||