From 1446c9fa1f1d4b8b6c9feff90d435f719885806c Mon Sep 17 00:00:00 2001 From: Takashi Sato Date: Sat, 30 Jul 2022 19:34:29 +0900 Subject: [PATCH] fix: add ignoreIIFE to @typescript-eslint/no-floating-promises Without this setting, async functions cannot be executed at the top level (Node.js 12 does not support Top Level Await) --- __snapshots__/index.test.js.snap | 9 +++++++++ __snapshots__/typescript.test.js.snap | 9 +++++++++ typescript.js | 1 + 3 files changed, 19 insertions(+) diff --git a/__snapshots__/index.test.js.snap b/__snapshots__/index.test.js.snap index 24261712..e25aaf97 100644 --- a/__snapshots__/index.test.js.snap +++ b/__snapshots__/index.test.js.snap @@ -6615,6 +6615,9 @@ Object { ], "@typescript-eslint/no-floating-promises": Array [ "error", + Object { + "ignoreIIFE": true, + }, ], "@typescript-eslint/no-for-in-array": Array [ "error", @@ -9088,6 +9091,9 @@ Object { ], "@typescript-eslint/no-floating-promises": Array [ "error", + Object { + "ignoreIIFE": true, + }, ], "@typescript-eslint/no-for-in-array": Array [ "error", @@ -11561,6 +11567,9 @@ Object { ], "@typescript-eslint/no-floating-promises": Array [ "error", + Object { + "ignoreIIFE": true, + }, ], "@typescript-eslint/no-for-in-array": Array [ "error", diff --git a/__snapshots__/typescript.test.js.snap b/__snapshots__/typescript.test.js.snap index d5f65fb5..b51bfd98 100644 --- a/__snapshots__/typescript.test.js.snap +++ b/__snapshots__/typescript.test.js.snap @@ -228,6 +228,9 @@ Object { ], "@typescript-eslint/no-floating-promises": Array [ "error", + Object { + "ignoreIIFE": true, + }, ], "@typescript-eslint/no-for-in-array": Array [ "error", @@ -2701,6 +2704,9 @@ Object { ], "@typescript-eslint/no-floating-promises": Array [ "error", + Object { + "ignoreIIFE": true, + }, ], "@typescript-eslint/no-for-in-array": Array [ "error", @@ -5174,6 +5180,9 @@ Object { ], "@typescript-eslint/no-floating-promises": Array [ "error", + Object { + "ignoreIIFE": true, + }, ], "@typescript-eslint/no-for-in-array": Array [ "error", diff --git a/typescript.js b/typescript.js index c0571ce3..c7f6d190 100644 --- a/typescript.js +++ b/typescript.js @@ -14,6 +14,7 @@ module.exports = { rules: { "@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-floating-promises": ["error", { ignoreIIFE: true }], "@typescript-eslint/no-use-before-define": "off", "@typescript-eslint/no-explicit-any": "warn", "@typescript-eslint/no-unused-vars": "warn",