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
Unknown Object (File)
Mon, Sep 2, 3:50 PM
Unknown Object (File)
Sat, Aug 31, 3:42 AM
Unknown Object (File)
Fri, Aug 30, 12:13 PM
Unknown Object (File)
Aug 10 2024, 8:32 AM
Unknown Object (File)
Jul 29 2024, 7:27 AM
Unknown Object (File)
Jul 14 2024, 7:21 PM
Unknown Object (File)
Jul 14 2024, 7:21 PM
Unknown Object (File)
Jul 14 2024, 7:21 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
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

native/avatars/avatar-hooks.js
251 ↗(On Diff #25782)

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

327 ↗(On Diff #25782)

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

365 ↗(On Diff #25782)

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

403 ↗(On Diff #25782)

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

436 ↗(On Diff #25782)

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 ↗(On Diff #25782)

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

native/profile/delete-account.react.js
181 ↗(On Diff #25782)

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.