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

Make sure there are no hanging promises #1042

Open
IanKrieger opened this issue Jan 31, 2024 · 12 comments
Open

Make sure there are no hanging promises #1042

IanKrieger opened this issue Jan 31, 2024 · 12 comments
Labels
good first issue Good for newcomers

Comments

@IanKrieger
Copy link
Contributor

IanKrieger commented Jan 31, 2024

enable the below eslint config and fix any errors:

    "@typescript-eslint/no-floating-promises": "error",
    "@typescript-eslint/no-misused-promises": "error",
@IanKrieger IanKrieger added the good first issue Good for newcomers label Jan 31, 2024
@shubrautt
Copy link
Contributor

@IanKrieger can I work on this issue?

@IanKrieger
Copy link
Contributor Author

Yes you can, @shubrautt

@shubrautt
Copy link
Contributor

image
@IanKrieger should I add void keyword or need to handle the promise?

@IanKrieger
Copy link
Contributor Author

I think in cases where we are setting a form value, we should await them, making the onClick async: onClick{async () => ...}

@shubrautt
Copy link
Contributor

I think we need to set checksVoidReturn to be false, to avoid this error @typescript-eslint/no-misused-promises": ["error", { "checksVoidReturn": false }]

@IanKrieger
Copy link
Contributor Author

I don't think we need that rule, but If you could provide an example of a line in the codebase that is failing because this check does not exist, we can go from there and I can give some direction on how to handle that.

@shubrautt
Copy link
Contributor

This is the file where I'm getting error.
image

@shubrautt
Copy link
Contributor

Same error also exist on other files also

@IanKrieger
Copy link
Contributor Author

Hmm, well since I do wish for the value updates to propagate, and I do not like the workarounds I've seen, I am fine with { "checksVoidReturn": false }

Thank you for asking

@shubrautt
Copy link
Contributor

image

what should I use while solving no-floating-promises errors, async/await or then/catch?

@IanKrieger
Copy link
Contributor Author

I think void in this scenario is ok, as any actions we want to take should be in the hook definition.

@shubrautt
Copy link
Contributor

shubrautt commented Feb 13, 2024

#1049, @IanKrieger I have pushed the code, How can I figure out where things need to be handled?.

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

No branches or pull requests

2 participants