Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Add lint for unused locals #8007

Merged
merged 3 commits into from
Mar 9, 2022
Merged

Add lint for unused locals #8007

merged 3 commits into from
Mar 9, 2022

Conversation

jryans
Copy link
Collaborator

@jryans jryans commented Mar 9, 2022

TypeScript supports checking for "unused locals", which actually includes
locals, private fields, private methods, etc. If a private thing is actually
needed as part of the API surface, you can change it to public to resolve the
error.

This seems like a good check to have, as it highlights unused bits of code that
perhaps got lost while refactoring. This changes our config to reject them and
fixes up a few existing cases.

See also matrix-org/matrix-js-sdk#2223


This change is marked as an internal change (Task), so will not be included in the changelog.

Preview: https://pr8007--matrix-react-sdk.netlify.app
⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts.

TypeScript supports checking for "unused locals", which actually includes
locals, private fields, private methods, etc. If a private thing is actually
needed as part of the API surface, you can change it to public to resolve the
error.

This seems like a good check to have, as it highlights unused bits of code that
perhaps got lost while refactoring. This changes our config to reject them and
fixes up a few existing cases.
@jryans jryans added the T-Task Refactoring, enabling or disabling functionality, other engineering tasks label Mar 9, 2022
@jryans jryans requested a review from a team as a code owner March 9, 2022 11:26
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

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

Looks awesome otherwise

:shipit:

@jryans jryans merged commit 6569120 into develop Mar 9, 2022
@jryans jryans deleted the jryans/no-unused-locals branch March 9, 2022 12:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, enabling or disabling functionality, other engineering tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants