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

Handling the "unnecessary await" linter warning #1177

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

jaybuidl
Copy link
Member

@jaybuidl jaybuidl commented Aug 22, 2023

The initial goal of this PR was to remove some await because of this:
image
https://codeclimate.com/github/kleros/kleros-v2/web/src/hooks/queries/useCounter.ts?from_sha=d01a8886&to_sha=c04e8c78

Looking further into, ESLint has deprecated the no-return-await rule:

This rule was deprecated in ESLint v8.46.0 with no replacement. The original intent of this rule no longer applies due to the fact JavaScript now handles native Promises differently. It can now be slower to remove await rather than keeping it. More technical information can be found in this V8 blog entry.

It turns out that there is a tradeoff between a potentially small perf improvement (without await, but it encourages bad dev habits) vs better stack traces in the V8 engine only (with await).

This additional rule @typescript-eslint/return-await provides more granularity

This rule builds on top of the eslint/no-return-await rule. It expands upon the base rule to add support for optionally requiring return await in certain cases.

@netlify
Copy link

netlify bot commented Aug 22, 2023

Deploy Preview for kleros-v2 ready!

Name Link
🔨 Latest commit cc905b0
🔍 Latest deploy log https://app.netlify.com/sites/kleros-v2/deploys/64e4938192eceb00082dd1fa
😎 Deploy Preview https://deploy-preview-1177--kleros-v2.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Aug 22, 2023

Deploy Preview for kleros-v2-contracts ready!

Name Link
🔨 Latest commit cc905b0
🔍 Latest deploy log https://app.netlify.com/sites/kleros-v2-contracts/deploys/64e49381f1cdb800080c3bcc
😎 Deploy Preview https://deploy-preview-1177--kleros-v2-contracts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jaybuidl jaybuidl added the Package: Web Court web frontend label Aug 22, 2023
@jaybuidl jaybuidl self-assigned this Aug 22, 2023
@jaybuidl jaybuidl requested a review from alcercu August 22, 2023 09:41
@codeclimate
Copy link

codeclimate bot commented Aug 22, 2023

Code Climate has analyzed commit cc905b0 and detected 0 issues on this pull request.

View more on Code Climate.

@sonarcloud
Copy link

sonarcloud bot commented Aug 22, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant