From 22b20898d631d79982d014168505b797ca2e2305 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Mon, 12 Dec 2022 18:26:03 -0330 Subject: [PATCH] Allow async functions without any 'await' (#262) 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. --- packages/typescript/rules-snapshot.json | 2 +- packages/typescript/src/index.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/typescript/rules-snapshot.json b/packages/typescript/rules-snapshot.json index 200f4f98..327f48a4 100644 --- a/packages/typescript/rules-snapshot.json +++ b/packages/typescript/rules-snapshot.json @@ -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", diff --git a/packages/typescript/src/index.js b/packages/typescript/src/index.js index a597ddf5..c7226717 100644 --- a/packages/typescript/src/index.js +++ b/packages/typescript/src/index.js @@ -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': [