Skip to content
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

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:

src/components/structures/RoomView.tsx Show resolved Hide resolved
@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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Task Refactoring, enabling or disabling functionality, other engineering tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants