From e630220becfee0619497b8cdbd165b9729e0b25d Mon Sep 17 00:00:00 2001 From: Federico Date: Thu, 24 Sep 2020 04:30:59 -0500 Subject: [PATCH] Avoid using `Array#reduce` (#127) --- source/index.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/index.ts b/source/index.ts index 8e29abb..8b394f4 100644 --- a/source/index.ts +++ b/source/index.ts @@ -426,10 +426,9 @@ class Conf = Record> implements I return; } - // eslint-disable-next-line unicorn/no-reduce - const errors = this.#validator.errors.reduce((error, {dataPath, message = ''}) => - error + ` \`${dataPath.slice(1)}\` ${message};`, ''); - throw new Error('Config schema violation:' + errors.slice(0, -1)); + const errors = this.#validator.errors + .map(({dataPath, message = ''}) => `\`${dataPath.slice(1)}\` ${message}`); + throw new Error('Config schema violation: ' + errors.join('; ')); } private _ensureDirectory(): void {