HomePhabricator
Diffusion Comm 231394d789bc

Set prefer-const eslint rule

Description

Set prefer-const eslint rule

Summary:
A lot of comments consist of finding where const can be used instead of let. There's an eslint rule, which can automate that for us.
Most of the changes were performed automatically by eslint. There were four places changed by hand. That was caused by using destructuring in which couple of variables could be const but couple not.
There's an option to allow let in such cases {"destructuring": "all"} but I think we should avoid that: destructuring an object and then reassigning one of the variables leads to unreadable code. We have to keep track of all the changes, because an assumption that the value is still equal to what was in the object doesn't hold. So overall, we should avoid this approach and requiring const when destructuring suggests which technique is preferred.

Test Plan: Flow, clicking through app to check if it works.

Reviewers: ashoat

Reviewed By: ashoat

Subscribers: KatPo, zrebcu411, Adrian, atul, subnub

Differential Revision: https://phabricator.ashoat.com/D931

Details

Provenance
tomekAuthored on Mar 25 2021, 5:34 AM
Reviewer
ashoat
Differential Revision
Restricted Differential Revision
Parents
rCOMMb2101013d555: [web] Fix reset password modal not closing bug
Branches
Unknown
Tags
Unknown