Page MenuHomePhabricator

Fix ESLint issues identified by consistent-return rule
ClosedPublic

Authored by ashoat on Apr 26 2023, 12:57 PM.
Tags
None
Referenced Files
F3174888: D7635.diff
Thu, Nov 7, 6:49 PM
Unknown Object (File)
Fri, Oct 11, 11:50 PM
Unknown Object (File)
Fri, Oct 11, 11:50 PM
Unknown Object (File)
Fri, Oct 11, 11:50 PM
Unknown Object (File)
Fri, Oct 11, 11:40 PM
Unknown Object (File)
Oct 4 2024, 3:20 AM
Unknown Object (File)
Sep 17 2024, 6:58 PM
Unknown Object (File)
Sep 17 2024, 6:58 PM
Subscribers
None

Details

Summary

The consistent-return rule will be introduced in the next diff. This diff addresses all of the errors it identified.

They are mostly in three categories:

  1. Spurious errors that result from ESLint not realizing invariant is equivalent to throw
  2. ESLint pushing us to be more explicit with return undefined instead of return in functions where there are other return statements that aren't just return
    • In some of these cases, if the function's return didn't matter, I removed the return X statement instead of replacing return with return undefined
  3. Legitimate errors that ESLint identified
    • I will point these out with inline comments
Test Plan

In combination with the next diff, run yarn eslint:fix in the repo root and make sure there are no errors

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

native/avatars/avatar-hooks.js
251

This was a real error. We were emitting a success event instead of a failure event here. @ginsu

327

This was a real error. We were emitting a success event instead of a failure event here. @ginsu

365

This was a real error. We were emitting a success event instead of a failure event here. @ginsu

403

This was a real error. We were emitting a success event instead of a failure event here. @ginsu

436

This was a real error. We were emitting a success event instead of a failure event here. @ginsu

native/chat/settings/delete-thread.react.js
163

This was a real error. We were emitting a success event instead of a failure event here

native/profile/delete-account.react.js
181

This was a real error. We were emitting a success event instead of a failure event here

atul published this revision for review.Apr 26 2023, 1:04 PM
atul accepted this revision.
This revision is now accepted and ready to land.Apr 26 2023, 1:04 PM
This revision was landed with ongoing or failed builds.Apr 26 2023, 1:18 PM
This revision was automatically updated to reflect the committed changes.