matrix-js-sdk icon indicating copy to clipboard operation
matrix-js-sdk copied to clipboard

Enable eslint rules: @typescript-eslint/await-thenable and @typescript-eslint/no-misused-promises

Open hughns opened this issue 2 years ago • 3 comments

These rules help encourage correct handling of promises and make promise abuse more explicit.

Part of https://github.com/matrix-org/matrix-js-sdk/issues/2118


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

hughns avatar Apr 09 '22 15:04 hughns

Codecov Report

Merging #2290 (93ed2f6) into develop (5937e6a) will increase coverage by 0.00%. The diff coverage is 57.57%.

@@           Coverage Diff            @@
##           develop    #2290   +/-   ##
========================================
  Coverage    59.56%   59.57%           
========================================
  Files           91       91           
  Lines        16416    16424    +8     
  Branches      3784     3784           
========================================
+ Hits          9778     9784    +6     
- Misses        6638     6640    +2     
Impacted Files Coverage Δ
src/http-api.ts 54.42% <0.00%> (ø)
src/crypto/dehydration.ts 11.81% <12.50%> (ø)
src/webrtc/callEventHandler.ts 8.45% <33.33%> (+0.64%) :arrow_up:
src/models/relations.ts 50.65% <66.66%> (-0.01%) :arrow_down:
src/webrtc/call.ts 36.14% <75.00%> (+0.03%) :arrow_up:
src/crypto/CrossSigning.ts 83.89% <100.00%> (ø)
src/crypto/backup.ts 63.38% <100.00%> (ø)
src/crypto/index.ts 64.38% <100.00%> (+0.05%) :arrow_up:
src/models/thread.ts 69.35% <100.00%> (+0.24%) :arrow_up:
src/utils.ts 88.23% <100.00%> (ø)

codecov-commenter avatar Apr 09 '22 15:04 codecov-commenter

In my absence last week I missed the web meetings, was applying this rule discussed with the team?

Not to my knowledge. Code style discussion lives at https://github.com/vector-im/element-meta/pull/216 where this rule (and the inverse of this rule) aren't mentioned.

turt2live avatar Apr 11 '22 15:04 turt2live

This was a speculative PR on my part, so do please dismiss if you wish.

It is a step towards https://github.com/matrix-org/matrix-js-sdk/pull/2291 which I believe has higher value as it identifies some possible bug sites.

hughns avatar Apr 11 '22 17:04 hughns

Cleaning up this stale PR. I would still advocate for the application of the @typescript-eslint/await-thenable and @typescript-eslint/no-misused-promises rules on this project.

hughns avatar Jan 04 '23 17:01 hughns

@hughns I suggest bringing it up in a Web Weekly meeting where it can be voted upon

t3chguy avatar Jan 11 '23 11:01 t3chguy