Skip to content

Handle BindingElement in fixUnusedIdentifier #23819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
2 commits merged into from
May 8, 2018

Conversation

ghost
Copy link

@ghost ghost commented May 2, 2018

Fixes half of #22330 -- other half fixed by #23805.

@ghost ghost requested a review from amcasey May 2, 2018 15:44
//// x;
////}
////{
//// const { x, y } = o;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be interesting to test the case where only one variable is declared and it is unused? Or is that covered by the other PR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be covered by #23805.

@@ -171,6 +171,10 @@ namespace ts.codefix {
}
break;

case SyntaxKind.BindingElement:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ArrayBindingPatterens are positional, so not sure how that works with them.. can you add a test for:

var [x, y, z] = [0, 1, 2];
y;

@ghost ghost force-pushed the codeFixUnusedIdentifier_destructure_partlyUnused branch from e892692 to 8671615 Compare May 8, 2018 17:00
@ghost ghost force-pushed the codeFixUnusedIdentifier_destructure_partlyUnused branch from 8671615 to 2b47e15 Compare May 8, 2018 17:06
@ghost ghost merged commit ccfd3bf into master May 8, 2018
@ghost ghost deleted the codeFixUnusedIdentifier_destructure_partlyUnused branch May 8, 2018 18:23
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants