From 7e18667f3dc049460922ccc071110b196bd0569c Mon Sep 17 00:00:00 2001 From: Cody Kaup Date: Wed, 11 Sep 2024 17:11:44 -0500 Subject: [PATCH] Allow descriptive error names in unicorn/catch-error-name --- eslint.config.mjs | 3 +-- .../ui/messages/errors/invalidConfigurationFile.stories.ts | 4 ++-- .../messages/errors/unparseableConfigurationFile.stories.ts | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 341d2bbbf..b1c2bc7d0 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -129,8 +129,7 @@ export default [ 'unicorn/catch-error-name': [ 'error', { - name: 'err', - ignore: ['^err.*$'], + ignore: ['err'], }, ], 'unicorn/switch-case-braces': 'off', diff --git a/node-src/ui/messages/errors/invalidConfigurationFile.stories.ts b/node-src/ui/messages/errors/invalidConfigurationFile.stories.ts index 7d8f6a835..4e6cdf222 100644 --- a/node-src/ui/messages/errors/invalidConfigurationFile.stories.ts +++ b/node-src/ui/messages/errors/invalidConfigurationFile.stories.ts @@ -12,8 +12,8 @@ try { a: z.string(), b: z.number(), }).parse({ a: 1, b: '1' }); -} catch (aErr) { - err = aErr; +} catch (error) { + err = error; } export const InvalidConfigurationFile = () => invalidConfigurationFile('./my.config.json', err); diff --git a/node-src/ui/messages/errors/unparseableConfigurationFile.stories.ts b/node-src/ui/messages/errors/unparseableConfigurationFile.stories.ts index 4f41b0181..84b37af0c 100644 --- a/node-src/ui/messages/errors/unparseableConfigurationFile.stories.ts +++ b/node-src/ui/messages/errors/unparseableConfigurationFile.stories.ts @@ -7,8 +7,8 @@ export default { let err; try { JSON.parse('foo'); -} catch (aErr) { - err = aErr; +} catch (error) { + err = error; } export const UnparseableConfigurationFile = () =>