oxc/crates/oxc_linter
Don Isaac 841174f73c
feat(linter/no-unused-vars): delete non-root arrows, skip await (#5083)
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)
   ```
2024-08-22 11:48:27 -04:00
..
examples refactor(linter): improve diagnostic labeling (#3960) 2024-06-29 05:19:22 +00:00
fixtures refactor(linter): replace Windows-style line breaks with Unix-style in test fixture (#4768) 2024-08-08 17:33:04 +00:00
src feat(linter/no-unused-vars): delete non-root arrows, skip await (#5083) 2024-08-22 11:48:27 -04:00
tests
Cargo.toml Release oxlint v0.7.2 (#4909) 2024-08-15 14:56:34 +08:00
CHANGELOG.md Release oxlint v0.7.2 (#4909) 2024-08-15 14:56:34 +08:00