From e946e6a651b39d49a884acd9f6468bb18e985bf2 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sat, 14 Oct 2023 11:07:03 +0200 Subject: [PATCH] infra(unicorn): catch-error-name (#2471) --- .eslintrc.js | 1 - scripts/generateLocales.ts | 8 ++++---- src/modules/helpers/index.ts | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index aa20f3cee2b..5f83641a77c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -48,7 +48,6 @@ module.exports = defineConfig({ // TODO @Shinigami92 2023-09-23: The following rules currently conflict with our code. // Each rule should be checked whether it should be enabled/configured and the problems fixed, or stay disabled permanently. 'unicorn/better-regex': 'off', - 'unicorn/catch-error-name': 'off', 'unicorn/consistent-function-scoping': 'off', 'unicorn/escape-case': 'off', 'unicorn/filename-case': 'off', diff --git a/scripts/generateLocales.ts b/scripts/generateLocales.ts index 70e40157cba..86704a7c03d 100644 --- a/scripts/generateLocales.ts +++ b/scripts/generateLocales.ts @@ -296,11 +296,11 @@ async function main(): Promise { } localeTitle = title; - } catch (e) { + } catch (error) { console.error( `Failed to load ${pathMetadata}. Please make sure the file exists and exports a MetadataDefinition.` ); - console.error(e); + console.error(error); } const localizedFaker = `faker${locale.replace(/^([a-z]+)/, (part) => @@ -367,8 +367,8 @@ async function main(): Promise { writeFileSync(pathDocsGuideLocalization, localizationContent); } -main().catch((e) => { +main().catch((error) => { // Workaround until top level await is available - console.error(e); + console.error(error); process.exit(1); }); diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts index 7548c15b578..f4ceaaf4abe 100644 --- a/src/modules/helpers/index.ts +++ b/src/modules/helpers/index.ts @@ -1467,7 +1467,7 @@ export class HelpersModule extends SimpleHelpersModule { // If anyone actually needs to optimize this specific code path, please open a support issue on github try { params = JSON.parse(`[${parameters}]`); - } catch (err) { + } catch { // since JSON.parse threw an error, assume parameters was actually a string params = [parameters]; }