From c203c1a065a6bad30557758e3a75239760fa1f80 Mon Sep 17 00:00:00 2001 From: Timo Bechtel Date: Mon, 13 Nov 2023 14:14:56 +0100 Subject: [PATCH] feat(typescript): make no-misused-promises less strict --- eslint/rules/typescript.cjs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/eslint/rules/typescript.cjs b/eslint/rules/typescript.cjs index 43fdcf5..7254a40 100644 --- a/eslint/rules/typescript.cjs +++ b/eslint/rules/typescript.cjs @@ -76,8 +76,21 @@ module.exports = defineConfig({ 'import/namespace': 'off', 'import/no-unresolved': 'off', - // This is disabled as we feel that checking empty strings is a valid use + // This is disabled as I feel that checking empty strings is a valid use // of `||` over `??`. '@typescript-eslint/prefer-nullish-coalescing': 'off', + + // Disallow Promises in places not designed to handle them. + '@typescript-eslint/no-misused-promises': [ + 'error', + { + // Disabled as I feel that passing a async callback to a function expecting + // a void callback is a valid use case. + // e.g. fn.on('event', async () => {}) + // Strictly requiring to return 'undefined' does not have a functional benefit, + // but makes the code more verbose. + checksVoidReturn: false, + }, + ], }, });