Skip to content

Commit

Permalink
Allow async functions without any 'await' (#262)
Browse files Browse the repository at this point in the history
The lint rules have been updated to allow functions to be `async` even
when they do not use `await`. It can be useful to make functions
`async` sometimes even when `await` is not used, because it can
simplify error handling for functions that return a Promise without
`await`-ing it (it ensures errors are always rejected, not thrown). It
can also be useful in cases when a function that does synchronous work
needs to be async to match an interface.
  • Loading branch information
Gudahtt committed Dec 12, 2022
1 parent d1e6352 commit 22b2089
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/typescript/rules-snapshot.json
Expand Up @@ -129,7 +129,7 @@
"@typescript-eslint/prefer-reduce-type-parameter": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-await": "error",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/restrict-template-expressions": [
"error",
Expand Down
3 changes: 3 additions & 0 deletions packages/typescript/src/index.js
Expand Up @@ -72,6 +72,9 @@ module.exports = {
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',

// Recommended rules that we do not want to use
'@typescript-eslint/require-await': 'off',

// Our rules that require type information
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/naming-convention': [
Expand Down

0 comments on commit 22b2089

Please sign in to comment.