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

Fix some incorrect async functions, improve frontend document. #17597

Merged
merged 7 commits into from
Nov 12, 2021

Conversation

wxiaoguang
Copy link
Contributor

As discussed in #17448 , this PR fixes some incorrect async functions, and improve frontend document about async functions.

Reference: https://github.com/github/eslint-plugin-github/blob/main/docs/rules/async-preventdefault.md

(In future we may use this plugin, but not now)

@wxiaoguang wxiaoguang added topic/ui Change the appearance of the Gitea UI skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. labels Nov 9, 2021
@wxiaoguang wxiaoguang added this to the 1.16.0 milestone Nov 9, 2021
@wxiaoguang wxiaoguang added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Nov 9, 2021
@wxiaoguang wxiaoguang linked an issue Nov 10, 2021 that may be closed by this pull request
@Gusted
Copy link
Contributor

Gusted commented Nov 11, 2021

Is there any specific reason to have code like const _promise =, as _promise will be a unused variable.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 11, 2021
@wxiaoguang
Copy link
Contributor Author

Is there any specific reason to have code like const _promise =, as _promise will be a unused variable.

Yep, there are reasons since we call an async in a non-async context.

  1. Tell the readers that this is done by purpose, we want to call the async function and ignore the Promise.
  2. Some lint rules or IDEs report warnings about "returned Promise is ignored", so this method can make them happy.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Nov 12, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 12, 2021
@wxiaoguang wxiaoguang merged commit 7f80263 into go-gitea:main Nov 12, 2021
@wxiaoguang wxiaoguang deleted the fix-async branch November 12, 2021 12:37
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. topic/ui Change the appearance of the Gitea UI type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong async/await/preventDefault usage
4 participants