-
Notifications
You must be signed in to change notification settings - Fork 173
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
feat: add no-sync-fn-in-async-fn rule #1178
Conversation
seems like there is a lot of code like this https://github.com/search?q=%2Fasync.*%5Cn.*Deno.*Sync%2F+language%3ATypeScript&type=code |
couple of notes
|
docs/rules/no_sync_fn_in_async_fn.md
Outdated
### Valid: | ||
|
||
```javascript | ||
function foo() { | ||
Deno.readTextFileSync(""); | ||
} | ||
|
||
const fooFn = function foo() { | ||
Deno.readTextFileSync(""); | ||
}; | ||
|
||
const fooFn = () => { | ||
Deno.readTextFileSync(""); | ||
}; | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be even better to also show valid examples with async
functions containing async version of built-in functions, because we prefer async functions in general. Something like:
async function foo() {
await Deno.readTextFile("");
}
Co-authored-by: Yusuke Tanaka <[email protected]>
Co-authored-by: Yusuke Tanaka <[email protected]>
Co-authored-by: Yusuke Tanaka <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks so much!
fix #1177