-
-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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) ```
- Loading branch information
Showing
2 changed files
with
82 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters