From: Jérôme Benoit Date: Fri, 28 Jun 2024 10:27:21 +0000 (+0200) Subject: refactor: code reformatting X-Git-Tag: v4.0.16~27 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=fe6df2852c1f0964cdffb0698461c9d66b1cf7ed;p=poolifier.git refactor: code reformatting Signed-off-by: Jérôme Benoit --- diff --git a/eslint.config.js b/eslint.config.js index 6288f9b9..a7368892 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -19,7 +19,13 @@ export default defineFlatConfig([ jsdoc.configs['flat/recommended-typescript'], { rules: { - 'jsdoc/check-tag-names': ['warn', { typed: true, definedTags: ['defaultValue', 'experimental', 'typeParam'] }], + 'jsdoc/check-tag-names': [ + 'warn', + { + typed: true, + definedTags: ['defaultValue', 'experimental', 'typeParam'], + }, + ], }, }, ...tseslint.config( diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 76dca07a..603409f0 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -1125,14 +1125,14 @@ export abstract class AbstractPool< return new Set([ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion this.opts.workerChoiceStrategy!, - ...(this.listTaskFunctionsProperties() + ...this.listTaskFunctionsProperties() .map( (taskFunctionProperties: TaskFunctionProperties) => taskFunctionProperties.strategy ) .filter( (strategy: WorkerChoiceStrategy | undefined) => strategy != null - )), + ), ]) } diff --git a/tests/pools/abstract-pool.test.mjs b/tests/pools/abstract-pool.test.mjs index ecb1c567..7661bf67 100644 --- a/tests/pools/abstract-pool.test.mjs +++ b/tests/pools/abstract-pool.test.mjs @@ -1714,32 +1714,31 @@ describe('Abstract pool test suite', () => { numberOfWorkers, './tests/worker-files/thread/testMultipleTaskFunctionsWorker.mjs' ) - expect(() => pool.mapExecute()).toThrow(new TypeError('data argument must be a defined iterable')) - expect(() => pool.mapExecute(0)).toThrow(new TypeError('data argument must be an iterable')) + expect(() => pool.mapExecute()).toThrow( + new TypeError('data argument must be a defined iterable') + ) + expect(() => pool.mapExecute(0)).toThrow( + new TypeError('data argument must be an iterable') + ) let results = await pool.mapExecute([{}, {}, {}, {}]) - expect(results).toStrictEqual([ - { ok: 1 }, - { ok: 1 }, - { ok: 1 }, - { ok: 1 }, - ]) + expect(results).toStrictEqual([{ ok: 1 }, { ok: 1 }, { ok: 1 }, { ok: 1 }]) expect(pool.info.executingTasks).toBe(0) expect(pool.info.executedTasks).toBe(4) - results = await pool.mapExecute([{ n: 10 }, { n: 20 }, { n: 30 }, { n: 40 }], 'factorial') + results = await pool.mapExecute( + [{ n: 10 }, { n: 20 }, { n: 30 }, { n: 40 }], + 'factorial' + ) expect(results).toStrictEqual([ - 3628800, - 2432902008176640000, - 2.6525285981219103e+32, - 8.159152832478977e+47, + 3628800, 2432902008176640000, 2.6525285981219103e32, 8.159152832478977e47, ]) expect(pool.info.executingTasks).toBe(0) expect(pool.info.executedTasks).toBe(8) - results = await pool.mapExecute(new Set([{ n: 10 }, { n: 20 }, { n: 30 }, { n: 40 }]), 'factorial') + results = await pool.mapExecute( + new Set([{ n: 10 }, { n: 20 }, { n: 30 }, { n: 40 }]), + 'factorial' + ) expect(results).toStrictEqual([ - 3628800, - 2432902008176640000, - 2.6525285981219103e+32, - 8.159152832478977e+47, + 3628800, 2432902008176640000, 2.6525285981219103e32, 8.159152832478977e47, ]) expect(pool.info.executingTasks).toBe(0) expect(pool.info.executedTasks).toBe(12)