From cff53d725901e82dc926cfec84fb5f68d28b3ebe Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Mon, 9 Dec 2024 12:19:11 -0500 Subject: [PATCH] fix: top-level await in binary --- bin/eslint-doc-generator.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bin/eslint-doc-generator.ts b/bin/eslint-doc-generator.ts index 647d22b4..da4b3261 100644 --- a/bin/eslint-doc-generator.ts +++ b/bin/eslint-doc-generator.ts @@ -7,12 +7,11 @@ import { run } from '../lib/cli.js'; import { generate } from '../lib/generator.js'; -// eslint-disable-next-line unicorn/prefer-top-level-await -- TODO: use top-level await once updating TypeScript target to ES2022 (when dropping Node 14 support). -run(process.argv, (path, options) => generate(path, options)).catch( - (error: unknown) => { - if (error instanceof Error) { - console.error(error.message); - } - process.exitCode = 1; - }, -); +try { + await run(process.argv, (path, options) => generate(path, options)); +} catch (error: unknown) { + if (error instanceof Error) { + console.error(error.message); + } + process.exitCode = 1; +}