From: Jérôme Benoit Date: Fri, 14 Jun 2024 20:03:46 +0000 (+0200) Subject: refactor: silence jsdoc linting warnings X-Git-Tag: v4.0.15~16 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ed20267eeb81ac0fb4a3abb5d1bde586080c2671;p=poolifier.git refactor: silence jsdoc linting warnings Signed-off-by: Jérôme Benoit --- diff --git a/benchmarks/worker-selection/least.mjs b/benchmarks/worker-selection/least.mjs index 5c9ff1ba..189a5e6c 100644 --- a/benchmarks/worker-selection/least.mjs +++ b/benchmarks/worker-selection/least.mjs @@ -6,6 +6,7 @@ import { bench, group, run } from 'tatami-ng' * * @param numberOfWorkers * @param maxNumberOfTasksPerWorker + * @returns */ function generateRandomTasksMap ( numberOfWorkers, @@ -24,6 +25,7 @@ const tasksMap = generateRandomTasksMap(60, 20) /** * * @param tasksMap + * @returns */ function loopSelect (tasksMap) { let minKey @@ -42,6 +44,7 @@ function loopSelect (tasksMap) { /** * * @param tasksMap + * @returns */ function arraySortSelect (tasksMap) { const tasksArray = Array.from(tasksMap) @@ -86,6 +89,7 @@ function swap (array, index1, index2) { * @param rightIndex * @param pivotIndex * @param compare + * @returns */ function partition ( array, @@ -115,6 +119,7 @@ function partition ( * @param rightIndex * @param compare * @param pivotIndexSelect + * @returns */ function selectLoop ( array, @@ -146,6 +151,7 @@ function selectLoop ( * @param rightIndex * @param compare * @param pivotIndexSelect + * @returns */ function selectRecursion ( array, @@ -170,6 +176,7 @@ function selectRecursion ( /** * * @param tasksMap + * @returns */ function quickSelectLoop (tasksMap) { const tasksArray = Array.from(tasksMap) @@ -182,6 +189,7 @@ function quickSelectLoop (tasksMap) { /** * * @param tasksMap + * @returns */ function quickSelectLoopRandomPivot (tasksMap) { const tasksArray = Array.from(tasksMap) @@ -201,6 +209,7 @@ function quickSelectLoopRandomPivot (tasksMap) { /** * * @param tasksMap + * @returns */ function quickSelectRecursion (tasksMap) { const tasksArray = Array.from(tasksMap) @@ -213,6 +222,7 @@ function quickSelectRecursion (tasksMap) { /** * * @param tasksMap + * @returns */ function quickSelectRecursionRandomPivot (tasksMap) { const tasksArray = Array.from(tasksMap) diff --git a/benchmarks/worker-selection/round-robin.mjs b/benchmarks/worker-selection/round-robin.mjs index d39fd699..64ea78da 100644 --- a/benchmarks/worker-selection/round-robin.mjs +++ b/benchmarks/worker-selection/round-robin.mjs @@ -3,6 +3,7 @@ import { bench, group, run } from 'tatami-ng' /** * * @param numberOfWorkers + * @returns */ function generateWorkersArray (numberOfWorkers) { return [...Array(numberOfWorkers).keys()] @@ -13,7 +14,7 @@ const workers = generateWorkersArray(60) let nextWorkerIndex /** - * + * @returns */ function roundRobinTernaryOffByOne () { nextWorkerIndex = @@ -22,7 +23,7 @@ function roundRobinTernaryOffByOne () { } /** - * + * @returns */ function roundRobinTernaryWithNegation () { nextWorkerIndex = @@ -33,7 +34,7 @@ function roundRobinTernaryWithNegation () { } /** - * + * @returns */ function roundRobinTernaryWithPreChoosing () { const chosenWorker = workers[nextWorkerIndex] @@ -43,7 +44,7 @@ function roundRobinTernaryWithPreChoosing () { } /** - * + * @returns */ function roundRobinIncrementModulo () { const chosenWorker = workers[nextWorkerIndex] diff --git a/eslint.config.js b/eslint.config.js index 67eb035e..6288f9b9 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -17,6 +17,11 @@ export default defineFlatConfig([ js.configs.recommended, ...nodePlugin.configs['flat/mixed-esm-and-cjs'], jsdoc.configs['flat/recommended-typescript'], + { + rules: { + 'jsdoc/check-tag-names': ['warn', { typed: true, definedTags: ['defaultValue', 'experimental', 'typeParam'] }], + }, + }, ...tseslint.config( ...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked diff --git a/examples/javascript/multiFunctionWorker.cjs b/examples/javascript/multiFunctionWorker.cjs index d49962d6..c0392eef 100644 --- a/examples/javascript/multiFunctionWorker.cjs +++ b/examples/javascript/multiFunctionWorker.cjs @@ -4,6 +4,7 @@ const { ThreadWorker } = require('poolifier') /** * * @param data + * @returns */ function fn0 (data) { console.info('Executing fn0') @@ -13,6 +14,7 @@ function fn0 (data) { /** * * @param data + * @returns */ function fn1 (data) { console.info('Executing fn1') diff --git a/examples/javascript/yourWorker.cjs b/examples/javascript/yourWorker.cjs index fce399bd..7eb163d7 100644 --- a/examples/javascript/yourWorker.cjs +++ b/examples/javascript/yourWorker.cjs @@ -2,7 +2,7 @@ const { ThreadWorker } = require('poolifier') /** - * + * @returns */ function yourFunction () { for (let i = 0; i <= 1000; i++) { diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 3b79565e..51a0dd94 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -589,6 +589,7 @@ export abstract class AbstractPool< /** * The pool readiness boolean status. + * @returns The pool readiness status. */ private get ready (): boolean { if (this.empty) { @@ -607,6 +608,7 @@ export abstract class AbstractPool< /** * The pool emptiness boolean status. + * @returns The pool emptiness status. */ protected get empty (): boolean { return this.minimumNumberOfWorkers === 0 && this.workerNodes.length === 0 @@ -820,8 +822,7 @@ export abstract class AbstractPool< /** * Whether the pool is full or not. - * - * The pool filling boolean status. + * @returns The pool filling boolean status. */ protected get full (): boolean { return ( diff --git a/src/priority-queue.ts b/src/priority-queue.ts index 93e7b76d..18478afe 100644 --- a/src/priority-queue.ts +++ b/src/priority-queue.ts @@ -56,6 +56,7 @@ export class PriorityQueue { /** * The priority queue size. + * @returns The priority queue size. */ public get size (): number { let node: PriorityQueueNode | undefined = this.tail @@ -84,6 +85,7 @@ export class PriorityQueue { /** * The number of filled prioritized buckets. + * @returns The number of filled prioritized buckets. */ public get buckets (): number { return Math.trunc(this.size / this.bucketSize) diff --git a/tests/worker-files/cluster/asyncErrorWorker.cjs b/tests/worker-files/cluster/asyncErrorWorker.cjs index 06797611..cc63d155 100644 --- a/tests/worker-files/cluster/asyncErrorWorker.cjs +++ b/tests/worker-files/cluster/asyncErrorWorker.cjs @@ -5,6 +5,7 @@ const { sleepTaskFunction } = require('../../test-utils.cjs') /** * * @param data + * @returns */ async function error (data) { return sleepTaskFunction( diff --git a/tests/worker-files/cluster/longRunningWorkerHardBehavior.cjs b/tests/worker-files/cluster/longRunningWorkerHardBehavior.cjs index 2dfaaafb..b81619a3 100644 --- a/tests/worker-files/cluster/longRunningWorkerHardBehavior.cjs +++ b/tests/worker-files/cluster/longRunningWorkerHardBehavior.cjs @@ -5,6 +5,7 @@ const { sleepTaskFunction } = require('../../test-utils.cjs') /** * * @param data + * @returns */ async function sleep (data) { return sleepTaskFunction(data, 50000) diff --git a/tests/worker-files/cluster/longRunningWorkerSoftBehavior.cjs b/tests/worker-files/cluster/longRunningWorkerSoftBehavior.cjs index 4a5bf10f..408b938f 100644 --- a/tests/worker-files/cluster/longRunningWorkerSoftBehavior.cjs +++ b/tests/worker-files/cluster/longRunningWorkerSoftBehavior.cjs @@ -5,6 +5,7 @@ const { sleepTaskFunction } = require('../../test-utils.cjs') /** * * @param data + * @returns */ async function sleep (data) { return sleepTaskFunction(data, 50000) diff --git a/tests/worker-files/cluster/testWorker.cjs b/tests/worker-files/cluster/testWorker.cjs index 418afd7c..38459844 100644 --- a/tests/worker-files/cluster/testWorker.cjs +++ b/tests/worker-files/cluster/testWorker.cjs @@ -6,6 +6,7 @@ const { TaskFunctions } = require('../../test-types.cjs') /** * * @param data + * @returns */ function test (data) { data = data || {}