refactor: cleanup eslint configuration
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 7 Mar 2024 19:22:06 +0000 (20:22 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 7 Mar 2024 19:22:06 +0000 (20:22 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
85 files changed:
.eslintrc.cjs
benchmarks/internal/bench.mjs
benchmarks/internal/thread-worker.mjs
benchmarks/worker-selection/least.mjs
benchmarks/worker-selection/round-robin.mjs
examples/typescript/http-client-pool/src/main.ts
examples/typescript/http-client-pool/src/pool.ts
examples/typescript/http-client-pool/src/types.ts
examples/typescript/http-client-pool/src/worker.ts
examples/typescript/http-server-pool/express-cluster/rollup.config.ts
examples/typescript/http-server-pool/express-cluster/src/main.ts
examples/typescript/http-server-pool/express-cluster/src/worker.ts
examples/typescript/http-server-pool/express-hybrid/rollup.config.ts
examples/typescript/http-server-pool/express-hybrid/src/express-worker.ts
examples/typescript/http-server-pool/express-hybrid/src/main.ts
examples/typescript/http-server-pool/express-hybrid/src/request-handler-worker.ts
examples/typescript/http-server-pool/express-worker_threads/src/main.ts
examples/typescript/http-server-pool/express-worker_threads/src/pool.ts
examples/typescript/http-server-pool/express-worker_threads/src/worker.ts
examples/typescript/http-server-pool/fastify-cluster/rollup.config.ts
examples/typescript/http-server-pool/fastify-cluster/src/main.ts
examples/typescript/http-server-pool/fastify-cluster/src/worker.ts
examples/typescript/http-server-pool/fastify-hybrid/@types/fastify/index.d.ts
examples/typescript/http-server-pool/fastify-hybrid/rollup.config.ts
examples/typescript/http-server-pool/fastify-hybrid/src/fastify-poolifier.ts
examples/typescript/http-server-pool/fastify-hybrid/src/fastify-worker.ts
examples/typescript/http-server-pool/fastify-hybrid/src/main.ts
examples/typescript/http-server-pool/fastify-hybrid/src/request-handler-worker.ts
examples/typescript/http-server-pool/fastify-worker_threads/@types/fastify/index.d.ts
examples/typescript/http-server-pool/fastify-worker_threads/src/fastify-poolifier.ts
examples/typescript/http-server-pool/fastify-worker_threads/src/main.ts
examples/typescript/http-server-pool/fastify-worker_threads/src/worker.ts
examples/typescript/pool.ts
examples/typescript/smtp-client-pool/src/main.ts
examples/typescript/smtp-client-pool/src/pool.ts
examples/typescript/smtp-client-pool/src/worker.ts
examples/typescript/websocket-server-pool/ws-cluster/rollup.config.ts
examples/typescript/websocket-server-pool/ws-cluster/src/main.ts
examples/typescript/websocket-server-pool/ws-cluster/src/worker.ts
examples/typescript/websocket-server-pool/ws-hybrid/rollup.config.ts
examples/typescript/websocket-server-pool/ws-hybrid/src/main.ts
examples/typescript/websocket-server-pool/ws-hybrid/src/request-handler-worker.ts
examples/typescript/websocket-server-pool/ws-hybrid/src/websocket-server-worker.ts
examples/typescript/websocket-server-pool/ws-worker_threads/src/main.ts
examples/typescript/websocket-server-pool/ws-worker_threads/src/pool.ts
examples/typescript/websocket-server-pool/ws-worker_threads/src/worker.ts
package.json
pnpm-lock.yaml
rollup.config.mjs
src/index.ts
src/pools/abstract-pool.ts
src/pools/cluster/dynamic.ts
src/pools/cluster/fixed.ts
src/pools/pool.ts
src/pools/selection-strategies/abstract-worker-choice-strategy.ts
src/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.ts
src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts
src/pools/selection-strategies/worker-choice-strategy-context.ts
src/pools/thread/fixed.ts
src/pools/utils.ts
src/pools/worker-node.ts
src/pools/worker.ts
src/utility-types.ts
src/utils.ts
src/worker/abstract-worker.ts
src/worker/cluster-worker.ts
src/worker/thread-worker.ts
tests/circular-array.test.mjs
tests/deque.test.mjs
tests/pools/abstract-pool.test.mjs
tests/pools/cluster/dynamic.test.mjs
tests/pools/cluster/fixed.test.mjs
tests/pools/selection-strategies/selection-strategies.test.mjs
tests/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.test.mjs
tests/pools/selection-strategies/worker-choice-strategy-context.test.mjs
tests/pools/thread/dynamic.test.mjs
tests/pools/thread/fixed.test.mjs
tests/pools/utils.test.mjs
tests/pools/worker-node.test.mjs
tests/utils.test.mjs
tests/worker-files/thread/testWorker.mjs
tests/worker/abstract-worker.test.mjs
tests/worker/cluster-worker.test.mjs
tests/worker/thread-worker.test.mjs
typedoc.mjs

index f8251b907d55a33c123a00329d307dde0f1204cd..713011c595e70ee037cdac3af9e0d6bd95ec8a5d 100644 (file)
@@ -8,10 +8,10 @@ module.exports = defineConfig({
     mocha: true
   },
   parserOptions: {
-    ecmaVersion: 2022,
-    sourceType: 'module'
+    sourceType: 'module',
+    ecmaVersion: 2022
   },
-  plugins: ['promise', 'spellcheck'],
+  plugins: ['simple-import-sort', 'promise', 'spellcheck'],
   extends: [
     'eslint:recommended',
     'plugin:import/recommended',
@@ -25,13 +25,8 @@ module.exports = defineConfig({
     }
   },
   rules: {
-    'sort-imports': [
-      'error',
-      {
-        ignoreDeclarationSort: true
-      }
-    ],
-    'import/order': 'error',
+    'simple-import-sort/imports': 'error',
+    'simple-import-sort/exports': 'error',
 
     'spellcheck/spell-checker': [
       'warn',
index 88868af7c43c1c3e4e5cce039f2fac71a6b99946..b59514d225b45adf149f011798156af1a7bcf675 100644 (file)
@@ -1,8 +1,9 @@
 import { exit } from 'node:process'
+
 import {
+  availableParallelism,
   PoolTypes,
-  WorkerTypes,
-  availableParallelism
+  WorkerTypes
 } from '../../lib/index.mjs'
 import { TaskFunctions } from '../benchmarks-types.cjs'
 import { runPoolifierPoolBenchmark } from '../benchmarks-utils.cjs'
index 92508dd887c80e7f6c210d87dec673c0b8952ee3..63d6e2defe91085e852e8786d4dac25b926c2422 100644 (file)
@@ -1,7 +1,8 @@
 import { isMainThread } from 'node:worker_threads'
+
 import { ThreadWorker } from '../../lib/index.mjs'
-import { executeTaskFunction } from '../benchmarks-utils.cjs'
 import { TaskFunctions } from '../benchmarks-types.cjs'
+import { executeTaskFunction } from '../benchmarks-utils.cjs'
 
 const taskFunction = data => {
   data = data || {}
index f67bebf7464f5ff7cadc394d38279bfc76e804bc..d08bec0e109a8a0d17adde1a966edcef5f0e1107 100644 (file)
@@ -1,5 +1,7 @@
 import { randomInt } from 'node:crypto'
+
 import Benchmark from 'benchmark'
+
 import { LIST_FORMATTER } from '../benchmarks-utils.cjs'
 
 function generateRandomTasksMap (
index b13c81118910b66147b6915a731648ed3974603e..f9d125d790f97eb233194179f60b236dec3469c4 100644 (file)
@@ -1,4 +1,5 @@
 import Benchmark from 'benchmark'
+
 import { LIST_FORMATTER } from '../benchmarks-utils.cjs'
 
 function generateWorkersArray (numberOfWorkers) {
index 41028e630fca19b8759790d8bfb5c30b5e773c9a..722de1e6dc200bbc535f1dfce8db4516d6c95d58 100644 (file)
@@ -1,4 +1,5 @@
 import { availableParallelism } from 'poolifier'
+
 import { httpClientPool } from './pool.js'
 import type { WorkerResponse } from './types.js'
 
index 673b71b894f19335f00aabb474f804cac7ffb99f..6988372eb1e4e07683fd129f8a2ea2b9ea0d40e2 100644 (file)
@@ -1,6 +1,8 @@
-import { fileURLToPath } from 'node:url'
 import { dirname, extname, join } from 'node:path'
-import { DynamicThreadPool, availableParallelism } from 'poolifier'
+import { fileURLToPath } from 'node:url'
+
+import { availableParallelism, DynamicThreadPool } from 'poolifier'
+
 import type { WorkerData, WorkerResponse } from './types.js'
 
 const workerFile = join(
index 11fe73e84d1fa4bc31ad5ce3b0cf15cb94b75239..6db45d5f0e7a413cd2e14ed4b2b17f7f326e4ecf 100644 (file)
@@ -1,9 +1,10 @@
 import type { URL } from 'node:url'
+
+import type { AxiosRequestConfig } from 'axios'
 import {
   type RequestInfo as NodeFetchRequestInfo,
   type RequestInit as NodeFetchRequestInit
 } from 'node-fetch'
-import type { AxiosRequestConfig } from 'axios'
 
 export interface WorkerData {
   input: URL | RequestInfo | NodeFetchRequestInfo
index 1e89761f9439cb019e271de8620f1d52b0f1e67d..904279b48ed940b17f1ffbb7c4b1743ade65457e 100644 (file)
@@ -1,9 +1,10 @@
-import { ThreadWorker } from 'poolifier'
+import axios from 'axios'
 import nodeFetch, {
   type RequestInfo as NodeFetchRequestInfo,
   type ResponseInit as NodeFetchRequestInit
 } from 'node-fetch'
-import axios from 'axios'
+import { ThreadWorker } from 'poolifier'
+
 import type { WorkerData, WorkerResponse } from './types.js'
 
 class HttpClientWorker extends ThreadWorker<WorkerData, WorkerResponse> {
index 2322cd9a440659670a52fc6805abaa85ac045229..236d018c1fe62fc8d35426874f4a21e4b68c13f6 100644 (file)
@@ -1,6 +1,6 @@
 import typescript from '@rollup/plugin-typescript'
-import del from 'rollup-plugin-delete'
 import { defineConfig } from 'rollup'
+import del from 'rollup-plugin-delete'
 
 export default defineConfig({
   input: ['./src/main.ts', './src/worker.ts'],
index 2184f970c3a819c2ed67ca02d1370c66e36a6b13..794083cc3d9d7d6e642f1d2a1668a8ebbffde932 100644 (file)
@@ -1,6 +1,8 @@
 import { dirname, extname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
-import { FixedClusterPool, availableParallelism } from 'poolifier'
+
+import { availableParallelism, FixedClusterPool } from 'poolifier'
+
 import type { WorkerData, WorkerResponse } from './types.js'
 
 const workerFile = join(
index d575647375edca90297ee647d0c4c26395e288f1..e04900ab2474afa7833c6bde6c5086030ab3882f 100644 (file)
@@ -1,7 +1,9 @@
 import type { Server } from 'node:http'
 import type { AddressInfo } from 'node:net'
-import { ClusterWorker } from 'poolifier'
+
 import express, { type Express, type Request, type Response } from 'express'
+import { ClusterWorker } from 'poolifier'
+
 import type { WorkerData, WorkerResponse } from './types.js'
 
 class ExpressWorker extends ClusterWorker<WorkerData, WorkerResponse> {
index b4634483c9f98e83c121c700fb51ca7e056de46a..9c29f0049816e6214f09b8d1ea3a112bf52175f8 100644 (file)
@@ -1,6 +1,6 @@
 import typescript from '@rollup/plugin-typescript'
-import del from 'rollup-plugin-delete'
 import { defineConfig } from 'rollup'
+import del from 'rollup-plugin-delete'
 
 export default defineConfig({
   input: [
index 8cc041d4ee20c5f8e1fac45c96914019abcc2d9e..78a18d67f79eda45815b987bb9b3bafb6fe459e0 100644 (file)
@@ -1,11 +1,13 @@
 import type { Server } from 'node:http'
 import type { AddressInfo } from 'node:net'
+
+import express, { type Express, type Request, type Response } from 'express'
 import {
+  availableParallelism,
   ClusterWorker,
-  DynamicThreadPool,
-  availableParallelism
+  DynamicThreadPool
 } from 'poolifier'
-import express, { type Express, type Request, type Response } from 'express'
+
 import {
   type ClusterWorkerData,
   type ClusterWorkerResponse,
index e339f83a276893e360140c77c40f510950e9406c..0f96a313d503b96a518b494fe2de7083798faf1a 100644 (file)
@@ -1,6 +1,8 @@
 import { dirname, extname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
-import { FixedClusterPool, availableParallelism } from 'poolifier'
+
+import { availableParallelism, FixedClusterPool } from 'poolifier'
+
 import type { ClusterWorkerData, ClusterWorkerResponse } from './types.js'
 
 const expressWorkerFile = join(
index ac4fb97aa0ee2e2a1e76e1d6db1521ddbde7f257..d769c762cc24a86999576290199b39dcb436ba5d 100644 (file)
@@ -1,4 +1,5 @@
 import { ThreadWorker } from 'poolifier'
+
 import {
   type DataPayload,
   type ThreadWorkerData,
index 3bef1a8a5300855bb7a80cb08d6fca859a0d3a47..fc0f2d84bb7b19a2b05455abea5915ef0959aa2d 100644 (file)
@@ -1,5 +1,7 @@
 import { exit } from 'node:process'
+
 import express, { type Express, type Request, type Response } from 'express'
+
 import { requestHandlerPool } from './pool.js'
 
 /**
index 6ae002922d47c6da062cbd9442391c33b4f72eca..98ae657d4a764bc39e07650db35add4c92718be5 100644 (file)
@@ -1,6 +1,8 @@
 import { dirname, extname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
-import { DynamicThreadPool, availableParallelism } from 'poolifier'
+
+import { availableParallelism, DynamicThreadPool } from 'poolifier'
+
 import {
   type BodyPayload,
   type WorkerData,
index 223ee36859fe2b0b2d1fd71704627e9928dfeb7f..c7a64055cd66b427ac877002b35329afdaaa0737 100644 (file)
@@ -1,4 +1,5 @@
 import { ThreadWorker } from 'poolifier'
+
 import {
   type BodyPayload,
   type WorkerData,
index 5715e2801444e719ed8265559bb4164dc4183fee..5e0a32d4d5929abcba7148da4c01916f21b70182 100644 (file)
@@ -1,6 +1,6 @@
 import typescript from '@rollup/plugin-typescript'
-import del from 'rollup-plugin-delete'
 import { defineConfig } from 'rollup'
+import del from 'rollup-plugin-delete'
 
 export default defineConfig({
   input: ['./src/main.ts', './src/worker.ts'],
index 6fe49edae8591ee64afb939053d37637f35b4ee2..c165157afdbdb907983822ce941932b06f1ba95e 100644 (file)
@@ -1,6 +1,8 @@
 import { dirname, extname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
-import { FixedClusterPool, availableParallelism } from 'poolifier'
+
+import { availableParallelism, FixedClusterPool } from 'poolifier'
+
 import type { WorkerData, WorkerResponse } from './types.js'
 
 const workerFile = join(
index 5fca89058695c7a45614b15d2eeb10bd690d9491..8f4442ed748d3fd2abc62c108d361aa6f565d2e6 100644 (file)
@@ -1,6 +1,8 @@
 import type { AddressInfo } from 'node:net'
-import { ClusterWorker } from 'poolifier'
+
 import Fastify, { type FastifyInstance } from 'fastify'
+import { ClusterWorker } from 'poolifier'
+
 import type { WorkerData, WorkerResponse } from './types.js'
 
 class FastifyWorker extends ClusterWorker<WorkerData, WorkerResponse> {
index 3ff88aa2b46b3f6048869bc95dd97d6f160c95b6..e1a64b1559ca4e9d8dc91ba424f08d0f08299863 100644 (file)
@@ -1,6 +1,8 @@
 import type { TransferListItem } from 'node:worker_threads'
+
 import type * as fastify from 'fastify'
 import type { DynamicThreadPool } from 'poolifier'
+
 import {
   type ThreadWorkerData,
   type ThreadWorkerResponse
index da5e1fdbfbc3969066516f090ef030d8a76c92ab..6bb949aa6a7bcab8e3e54d8a47a60950996b9a30 100644 (file)
@@ -1,6 +1,6 @@
 import typescript from '@rollup/plugin-typescript'
-import del from 'rollup-plugin-delete'
 import { defineConfig } from 'rollup'
+import del from 'rollup-plugin-delete'
 
 export default defineConfig({
   input: [
index 3c5e31e34dc85c9583b29ba427d8cb66704cb686..79d24dc61fe0a3f47a25d4e5fb5ddeb5880e2a2a 100644 (file)
@@ -1,7 +1,9 @@
 import type { TransferListItem } from 'node:worker_threads'
-import { DynamicThreadPool, availableParallelism } from 'poolifier'
+
 import type { FastifyPluginCallback } from 'fastify'
 import fp from 'fastify-plugin'
+import { availableParallelism, DynamicThreadPool } from 'poolifier'
+
 import {
   type FastifyPoolifierOptions,
   type ThreadWorkerData,
index 0f4f6370b4c5249a2dfc8f2b4169d0245bbdda68..8e4713cfae2df7e3a158c6191a3ec57fc3d8060f 100644 (file)
@@ -1,8 +1,10 @@
 import type { AddressInfo } from 'node:net'
-import { ClusterWorker } from 'poolifier'
+
 import Fastify, { type FastifyInstance } from 'fastify'
-import type { ClusterWorkerData, ClusterWorkerResponse } from './types.js'
+import { ClusterWorker } from 'poolifier'
+
 import { fastifyPoolifier } from './fastify-poolifier.js'
+import type { ClusterWorkerData, ClusterWorkerResponse } from './types.js'
 
 class FastifyWorker extends ClusterWorker<
 ClusterWorkerData,
index 6b9c172792805277e23800cb8bd6571f855670fa..b2174e07bec4cc4b5ff54b07eedd0e1e8452efd9 100644 (file)
@@ -1,6 +1,8 @@
 import { dirname, extname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
-import { FixedClusterPool, availableParallelism } from 'poolifier'
+
+import { availableParallelism, FixedClusterPool } from 'poolifier'
+
 import type { ClusterWorkerData, ClusterWorkerResponse } from './types.js'
 
 const fastifyWorkerFile = join(
index ac4fb97aa0ee2e2a1e76e1d6db1521ddbde7f257..d769c762cc24a86999576290199b39dcb436ba5d 100644 (file)
@@ -1,4 +1,5 @@
 import { ThreadWorker } from 'poolifier'
+
 import {
   type DataPayload,
   type ThreadWorkerData,
index 93fb69eb806a7a112aebe7a72a9fbc2ef1df49f3..73f8b0715963679fe64a722fae3bbecd5042cdac 100644 (file)
@@ -1,6 +1,8 @@
 import type { TransferListItem } from 'node:worker_threads'
+
 import type * as fastify from 'fastify'
 import type { DynamicThreadPool } from 'poolifier'
+
 import type { WorkerData, WorkerResponse } from '../../src/types.ts'
 
 declare module 'fastify' {
index cd1909b7f3d7eab8f83f781971e452b7108e129d..766ef44ec3fdcbb5e1e11304340d8065d47e03c1 100644 (file)
@@ -1,7 +1,9 @@
 import type { TransferListItem } from 'node:worker_threads'
-import { DynamicThreadPool, availableParallelism } from 'poolifier'
+
 import type { FastifyPluginCallback } from 'fastify'
 import fp from 'fastify-plugin'
+import { availableParallelism, DynamicThreadPool } from 'poolifier'
+
 import {
   type FastifyPoolifierOptions,
   type WorkerData,
index 724836de7ef6fb5287e511a59d5cbe71cb360c22..5610bc1d48bbadf0edee7b87b710d9feb5066d48 100644 (file)
@@ -1,7 +1,9 @@
 import { dirname, extname, join } from 'node:path'
-import { fileURLToPath } from 'node:url'
 import { exit } from 'node:process'
+import { fileURLToPath } from 'node:url'
+
 import Fastify from 'fastify'
+
 import { fastifyPoolifier } from './fastify-poolifier.js'
 
 /**
index 223ee36859fe2b0b2d1fd71704627e9928dfeb7f..c7a64055cd66b427ac877002b35329afdaaa0737 100644 (file)
@@ -1,4 +1,5 @@
 import { ThreadWorker } from 'poolifier'
+
 import {
   type BodyPayload,
   type WorkerData,
index 144d55002bd048ea865365cb6696cdb887745230..c55c4e96557dc8fcb400847745b0ac2c5ee014c7 100644 (file)
@@ -1,12 +1,14 @@
 import { dirname, extname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
-import type { MyData, MyResponse } from './worker.js'
+
 import {
+  availableParallelism,
   DynamicThreadPool,
-  FixedThreadPool,
-  availableParallelism
+  FixedThreadPool
 } from 'poolifier'
 
+import type { MyData, MyResponse } from './worker.js'
+
 const workerFile = join(
   dirname(fileURLToPath(import.meta.url)),
   `worker${extname(fileURLToPath(import.meta.url))}`
index 1b463fa0b83ed257c6ec217b1da31de766ed8120..620bdb94e3ba65b193d1b3dfb125ed1d62320820 100644 (file)
@@ -1,4 +1,5 @@
 import type SMTPTransport from 'nodemailer/lib/smtp-transport/index.js'
+
 import { smtpClientPool } from './pool.js'
 
 const tos = ['bar@example.com, baz@example.com']
index 2fc53c980b20b9f26590e3408382f88cd86ada62..315bf4eab77274267d4f7928973b9d8733e5ec28 100644 (file)
@@ -1,7 +1,9 @@
-import { fileURLToPath } from 'node:url'
 import { dirname, extname, join } from 'node:path'
-import { DynamicThreadPool, availableParallelism } from 'poolifier'
+import { fileURLToPath } from 'node:url'
+
 import type SMTPTransport from 'nodemailer/lib/smtp-transport/index.js'
+import { availableParallelism, DynamicThreadPool } from 'poolifier'
+
 import type { WorkerData } from './types.js'
 
 const workerFile = join(
index 01e49b0948a962ed93d29b110b3e0a3fe18b9c3a..622886351e71d9e2d234548fc2009ad3639d6aa4 100644 (file)
@@ -1,6 +1,7 @@
-import { ThreadWorker } from 'poolifier'
 import { createTransport } from 'nodemailer'
 import type SMTPTransport from 'nodemailer/lib/smtp-transport/index.js'
+import { ThreadWorker } from 'poolifier'
+
 import type { WorkerData } from './types.js'
 
 class SmtpClientWorker extends ThreadWorker<
index f251709f5855e325eb222a448fc81715031208e4..a4f7212624a233822cf95fa1f15788faefe8c29e 100644 (file)
@@ -1,6 +1,6 @@
 import typescript from '@rollup/plugin-typescript'
-import del from 'rollup-plugin-delete'
 import { defineConfig } from 'rollup'
+import del from 'rollup-plugin-delete'
 
 export default defineConfig({
   input: ['./src/main.ts', './src/worker.ts'],
index 762b1c0fffc68b24cfc4f7a4b8296649d1f151ec..34e2a58ba8e5fccd20da378cbbd69932bc9f47a1 100644 (file)
@@ -1,6 +1,8 @@
 import { dirname, extname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
-import { FixedClusterPool, availableParallelism } from 'poolifier'
+
+import { availableParallelism, FixedClusterPool } from 'poolifier'
+
 import type { WorkerData, WorkerResponse } from './types.js'
 
 const workerFile = join(
index 18ece026c891efb3106499667027a1a2aba0b73a..9ec81eb5db8b8c8fc5b7b5d4ad94d522629df89c 100644 (file)
@@ -1,5 +1,6 @@
 import { ClusterWorker } from 'poolifier'
 import { type RawData, WebSocketServer } from 'ws'
+
 import {
   type DataPayload,
   type MessagePayload,
index 97efb44f27e6e75f40ccf2ad17be198062a98ea4..e96f480b02d513f9db786199a367be90de7a175c 100644 (file)
@@ -1,6 +1,6 @@
 import typescript from '@rollup/plugin-typescript'
-import del from 'rollup-plugin-delete'
 import { defineConfig } from 'rollup'
+import del from 'rollup-plugin-delete'
 
 export default defineConfig({
   input: [
index b35775b4b8e80b852ed31be2db04c955ae8f8996..9e6638994c9513d487a22b38b7c9ac7faa9b366f 100644 (file)
@@ -1,6 +1,8 @@
 import { dirname, extname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
-import { FixedClusterPool, availableParallelism } from 'poolifier'
+
+import { availableParallelism, FixedClusterPool } from 'poolifier'
+
 import type { ClusterWorkerData, ClusterWorkerResponse } from './types.js'
 
 const webSocketServerWorkerFile = join(
index ac4fb97aa0ee2e2a1e76e1d6db1521ddbde7f257..d769c762cc24a86999576290199b39dcb436ba5d 100644 (file)
@@ -1,4 +1,5 @@
 import { ThreadWorker } from 'poolifier'
+
 import {
   type DataPayload,
   type ThreadWorkerData,
index 4e6529e0975486de51c1f5d814dccdb61dff1687..eabf72ebb30449aaec103e485d8d1105d3bca333 100644 (file)
@@ -1,9 +1,10 @@
 import {
+  availableParallelism,
   ClusterWorker,
-  DynamicThreadPool,
-  availableParallelism
+  DynamicThreadPool
 } from 'poolifier'
 import { type RawData, WebSocketServer } from 'ws'
+
 import {
   type ClusterWorkerData,
   type ClusterWorkerResponse,
index d5b2cc78e8e4feda873602ea9b1074e581d3d8f9..f3aea4e5b60a2cdc15fa2f3a124ed93673b39b53 100644 (file)
@@ -1,6 +1,7 @@
 import { type RawData, WebSocketServer } from 'ws'
-import { type DataPayload, type MessagePayload, MessageType } from './types.js'
+
 import { requestHandlerPool } from './pool.js'
+import { type DataPayload, type MessagePayload, MessageType } from './types.js'
 
 const port = 8080
 const wss = new WebSocketServer({ port }, () => {
index 39cba844901b0376453640bcaee12679e880d19f..45d458d53f8993a8baf8697e8709abd64b679849 100644 (file)
@@ -1,6 +1,8 @@
 import { dirname, extname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
-import { DynamicThreadPool, availableParallelism } from 'poolifier'
+
+import { availableParallelism, DynamicThreadPool } from 'poolifier'
+
 import {
   type DataPayload,
   type WorkerData,
index a3b106c64d341d55d3a94d327c056da227f6bfdf..5aa9e90a54fc191ef2453ab94d9cc15639c5cc63 100644 (file)
@@ -1,4 +1,5 @@
 import { ThreadWorker } from 'poolifier'
+
 import {
   type DataPayload,
   type WorkerData,
index 2d278219cebcf210d787d302d146e50ef5ee2489..50ab2f17c1343ce60da929df57b18578b3b53d62 100644 (file)
     "eslint-plugin-jsdoc": "^48.2.1",
     "eslint-plugin-n": "^16.6.2",
     "eslint-plugin-promise": "^6.1.1",
+    "eslint-plugin-simple-import-sort": "^12.0.0",
     "eslint-plugin-spellcheck": "^0.0.20",
     "eslint-plugin-tsdoc": "^0.2.17",
     "expect": "^29.7.0",
index dd75fcd7b9abe0be569128ed1138480629ea5ac5..49b8778707abfe588b0583ec0b2826d02d17258a 100644 (file)
@@ -74,6 +74,9 @@ devDependencies:
   eslint-plugin-promise:
     specifier: ^6.1.1
     version: 6.1.1(eslint@8.57.0)
+  eslint-plugin-simple-import-sort:
+    specifier: ^12.0.0
+    version: 12.0.0(eslint@8.57.0)
   eslint-plugin-spellcheck:
     specifier: ^0.0.20
     version: 0.0.20(eslint@8.57.0)
@@ -2510,6 +2513,14 @@ packages:
       eslint: 8.57.0
     dev: true
 
+  /eslint-plugin-simple-import-sort@12.0.0(eslint@8.57.0):
+    resolution: {integrity: sha512-8o0dVEdAkYap0Cn5kNeklaKcT1nUsa3LITWEuFk3nJifOoD+5JQGoyDUW2W/iPWwBsNBJpyJS9y4je/BgxLcyQ==}
+    peerDependencies:
+      eslint: '>=5.0.0'
+    dependencies:
+      eslint: 8.57.0
+    dev: true
+
   /eslint-plugin-spellcheck@0.0.20(eslint@8.57.0):
     resolution: {integrity: sha512-GJa6vgzWAYqe0elKADAsiBRrhvqBnKyt7tpFSqlCZJsK2W9+K80oMyHhKolA7vJ13H5RCGs5/KCN+mKUyKoAiA==}
     peerDependencies:
index 28d0e3a98bf2def9fcf6b4102d1dec6299d988b5..9dcf125df6b274fdfd06fc95447e08ff8aba873a 100644 (file)
@@ -1,12 +1,13 @@
 import * as os from 'node:os'
 import { env } from 'node:process'
-import { dts } from 'rollup-plugin-dts'
+
 import terser from '@rollup/plugin-terser'
 import typescript from '@rollup/plugin-typescript'
+import { defineConfig } from 'rollup'
 import analyze from 'rollup-plugin-analyzer'
 import command from 'rollup-plugin-command'
 import del from 'rollup-plugin-delete'
-import { defineConfig } from 'rollup'
+import { dts } from 'rollup-plugin-dts'
 
 const availableParallelism = () => {
   let availableParallelism = 1
index eab1ab2be54524a8bfa0f6917fd1069e5dd5de9f..5b0eb9090e3c8cf583a67ee6c9d392842a23267c 100644 (file)
@@ -1,8 +1,9 @@
+export type { CircularArray } from './circular-array.js'
+export type { Deque, ILinkedListNode } from './deque.js'
 export type { AbstractPool } from './pools/abstract-pool.js'
 export { DynamicClusterPool } from './pools/cluster/dynamic.js'
-export { FixedClusterPool } from './pools/cluster/fixed.js'
 export type { ClusterPoolOptions } from './pools/cluster/fixed.js'
-export { PoolEvents, PoolTypes } from './pools/pool.js'
+export { FixedClusterPool } from './pools/cluster/fixed.js'
 export type {
   IPool,
   PoolEvent,
@@ -11,7 +12,25 @@ export type {
   PoolType,
   TasksQueueOptions
 } from './pools/pool.js'
-export { WorkerTypes } from './pools/worker.js'
+export { PoolEvents, PoolTypes } from './pools/pool.js'
+export type {
+  IWorkerChoiceStrategy,
+  Measurement,
+  MeasurementOptions,
+  MeasurementStatisticsRequirements,
+  StrategyPolicy,
+  TaskStatisticsRequirements,
+  WorkerChoiceStrategy,
+  WorkerChoiceStrategyOptions
+} from './pools/selection-strategies/selection-strategies-types.js'
+export {
+  Measurements,
+  WorkerChoiceStrategies
+} from './pools/selection-strategies/selection-strategies-types.js'
+export type { WorkerChoiceStrategyContext } from './pools/selection-strategies/worker-choice-strategy-context.js'
+export { DynamicThreadPool } from './pools/thread/dynamic.js'
+export type { ThreadPoolOptions } from './pools/thread/fixed.js'
+export { FixedThreadPool } from './pools/thread/fixed.js'
 export type {
   ErrorHandler,
   EventHandler,
@@ -30,33 +49,19 @@ export type {
   WorkerType,
   WorkerUsage
 } from './pools/worker.js'
-export {
-  Measurements,
-  WorkerChoiceStrategies
-} from './pools/selection-strategies/selection-strategies-types.js'
+export { WorkerTypes } from './pools/worker.js'
 export type {
-  IWorkerChoiceStrategy,
-  Measurement,
-  MeasurementOptions,
-  MeasurementStatisticsRequirements,
-  StrategyPolicy,
-  TaskStatisticsRequirements,
-  WorkerChoiceStrategy,
-  WorkerChoiceStrategyOptions
-} from './pools/selection-strategies/selection-strategies-types.js'
-export type { WorkerChoiceStrategyContext } from './pools/selection-strategies/worker-choice-strategy-context.js'
-export { DynamicThreadPool } from './pools/thread/dynamic.js'
-export { FixedThreadPool } from './pools/thread/fixed.js'
-export type { ThreadPoolOptions } from './pools/thread/fixed.js'
+  MessageValue,
+  PromiseResponseWrapper,
+  Task,
+  TaskPerformance,
+  WorkerError,
+  WorkerStatistics,
+  Writable
+} from './utility-types.js'
+export { availableParallelism } from './utils.js'
 export type { AbstractWorker } from './worker/abstract-worker.js'
 export { ClusterWorker } from './worker/cluster-worker.js'
-export { ThreadWorker } from './worker/thread-worker.js'
-export { KillBehaviors } from './worker/worker-options.js'
-export type {
-  KillBehavior,
-  KillHandler,
-  WorkerOptions
-} from './worker/worker-options.js'
 export type {
   TaskAsyncFunction,
   TaskFunction,
@@ -64,15 +69,10 @@ export type {
   TaskFunctions,
   TaskSyncFunction
 } from './worker/task-functions.js'
+export { ThreadWorker } from './worker/thread-worker.js'
 export type {
-  MessageValue,
-  PromiseResponseWrapper,
-  Task,
-  TaskPerformance,
-  WorkerError,
-  WorkerStatistics,
-  Writable
-} from './utility-types.js'
-export type { CircularArray } from './circular-array.js'
-export type { Deque, ILinkedListNode } from './deque.js'
-export { availableParallelism } from './utils.js'
+  KillBehavior,
+  KillHandler,
+  WorkerOptions
+} from './worker/worker-options.js'
+export { KillBehaviors } from './worker/worker-options.js'
index 6c73f43a590933db50c3cab78a806eab526b2217..c5ad9cb3608ac8e2095c23c023c949e0f48ae7eb 100644 (file)
@@ -1,17 +1,18 @@
+import { AsyncResource } from 'node:async_hooks'
 import { randomUUID } from 'node:crypto'
+import { EventEmitterAsyncResource } from 'node:events'
 import { performance } from 'node:perf_hooks'
 import type { TransferListItem } from 'node:worker_threads'
-import { EventEmitterAsyncResource } from 'node:events'
-import { AsyncResource } from 'node:async_hooks'
+
 import type {
   MessageValue,
   PromiseResponseWrapper,
   Task
 } from '../utility-types.js'
 import {
+  average,
   DEFAULT_TASK_NAME,
   EMPTY_FUNCTION,
-  average,
   exponentialDelay,
   isKillBehavior,
   isPlainObject,
@@ -21,8 +22,8 @@ import {
   round,
   sleep
 } from '../utils.js'
-import { KillBehaviors } from '../worker/worker-options.js'
 import type { TaskFunction } from '../worker/task-functions.js'
+import { KillBehaviors } from '../worker/worker-options.js'
 import {
   type IPool,
   PoolEvents,
@@ -32,13 +33,6 @@ import {
   PoolTypes,
   type TasksQueueOptions
 } from './pool.js'
-import type {
-  IWorker,
-  IWorkerNode,
-  WorkerInfo,
-  WorkerNodeEventDetail,
-  WorkerType
-} from './worker.js'
 import {
   Measurements,
   WorkerChoiceStrategies,
@@ -46,8 +40,6 @@ import {
   type WorkerChoiceStrategyOptions
 } from './selection-strategies/selection-strategies-types.js'
 import { WorkerChoiceStrategyContext } from './selection-strategies/worker-choice-strategy-context.js'
-import { version } from './version.js'
-import { WorkerNode } from './worker-node.js'
 import {
   checkFilePath,
   checkValidTasksQueueOptions,
@@ -59,6 +51,15 @@ import {
   updateWaitTimeWorkerUsage,
   waitWorkerNodeEvents
 } from './utils.js'
+import { version } from './version.js'
+import type {
+  IWorker,
+  IWorkerNode,
+  WorkerInfo,
+  WorkerNodeEventDetail,
+  WorkerType
+} from './worker.js'
+import { WorkerNode } from './worker-node.js'
 
 /**
  * Base class that implements some shared logic for all poolifier pools.
index e8e51947246602194951bb4366c68c9cf9d63ad4..51d1cbeece56d374df9228cbee9dbdfed86f1989 100644 (file)
@@ -1,5 +1,5 @@
-import { checkDynamicPoolSize } from '../utils.js'
 import { PoolEvents, type PoolType, PoolTypes } from '../pool.js'
+import { checkDynamicPoolSize } from '../utils.js'
 import { type ClusterPoolOptions, FixedClusterPool } from './fixed.js'
 
 /**
index 1fea176c4f3884c1ce4778f891d059d9f48bbbde..4a8cb4f1eeeafeb59adf1e30c5d678328cb19b70 100644 (file)
@@ -1,4 +1,5 @@
 import cluster, { type Worker } from 'node:cluster'
+
 import type { MessageValue } from '../../utility-types.js'
 import { AbstractPool } from '../abstract-pool.js'
 import { type PoolOptions, type PoolType, PoolTypes } from '../pool.js'
index 73ca3aa105e477add5fd11d3d5cd19911c41f115..f6f3de36fe13ae6efced690a8637c431c4405a1d 100644 (file)
@@ -1,7 +1,12 @@
-import type { TransferListItem, WorkerOptions } from 'node:worker_threads'
-import type { EventEmitterAsyncResource } from 'node:events'
 import type { ClusterSettings } from 'node:cluster'
+import type { EventEmitterAsyncResource } from 'node:events'
+import type { TransferListItem, WorkerOptions } from 'node:worker_threads'
+
 import type { TaskFunction } from '../worker/task-functions.js'
+import type {
+  WorkerChoiceStrategy,
+  WorkerChoiceStrategyOptions
+} from './selection-strategies/selection-strategies-types.js'
 import type {
   ErrorHandler,
   ExitHandler,
@@ -11,10 +16,6 @@ import type {
   OnlineHandler,
   WorkerType
 } from './worker.js'
-import type {
-  WorkerChoiceStrategy,
-  WorkerChoiceStrategyOptions
-} from './selection-strategies/selection-strategies-types.js'
 
 /**
  * Enumeration of pool types.
index ff1d4b0847e3bd53be4c06bd3d252523f3ff545e..3618944c2043a07b1e8e709aa877d831b2bfc76b 100644 (file)
@@ -1,7 +1,7 @@
 import type { IPool } from '../pool.js'
 import {
-  DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
-  buildWorkerChoiceStrategyOptions
+  buildWorkerChoiceStrategyOptions,
+  DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS
 } from '../utils.js'
 import type { IWorker } from '../worker.js'
 import type {
index 6bbcc5f5b965e1fa3c0d05b018437b4f2e796708..b1abe98772d88ce295b17aa6be653a332dd11b04 100644 (file)
@@ -1,6 +1,6 @@
-import type { IWorker } from '../worker.js'
 import type { IPool } from '../pool.js'
 import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../utils.js'
+import type { IWorker } from '../worker.js'
 import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy.js'
 import type {
   IWorkerChoiceStrategy,
index dfe4d62315a0144f1d1506c2e4481b6723ffad69..f04847782f540e9edea4603b47afe4c70aa4e299 100644 (file)
@@ -1,6 +1,6 @@
-import type { IWorker } from '../worker.js'
 import type { IPool } from '../pool.js'
 import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../utils.js'
+import type { IWorker } from '../worker.js'
 import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy.js'
 import type {
   IWorkerChoiceStrategy,
index fc940a2fbb0f7d85ec450cc35beb60cab75cd141..f9ddb3a1c54dd5798c94a30fb3ae58437932fe42 100644 (file)
@@ -1,11 +1,11 @@
 import type { IPool } from '../pool.js'
-import type { IWorker } from '../worker.js'
 import { getWorkerChoiceStrategyRetries } from '../utils.js'
+import type { IWorker } from '../worker.js'
 import { FairShareWorkerChoiceStrategy } from './fair-share-worker-choice-strategy.js'
 import { InterleavedWeightedRoundRobinWorkerChoiceStrategy } from './interleaved-weighted-round-robin-worker-choice-strategy.js'
 import { LeastBusyWorkerChoiceStrategy } from './least-busy-worker-choice-strategy.js'
-import { LeastUsedWorkerChoiceStrategy } from './least-used-worker-choice-strategy.js'
 import { LeastEluWorkerChoiceStrategy } from './least-elu-worker-choice-strategy.js'
+import { LeastUsedWorkerChoiceStrategy } from './least-used-worker-choice-strategy.js'
 import { RoundRobinWorkerChoiceStrategy } from './round-robin-worker-choice-strategy.js'
 import type {
   IWorkerChoiceStrategy,
index 38dee9f02605f21847bdd3bd0d5303f2824b4dcb..78912c2b03d11537bebce5cc0576d058157321af 100644 (file)
@@ -1,8 +1,9 @@
 import {
+  isMainThread,
   type TransferListItem,
-  type Worker,
-  isMainThread
+  type Worker
 } from 'node:worker_threads'
+
 import type { MessageValue } from '../../utility-types.js'
 import { AbstractPool } from '../abstract-pool.js'
 import { type PoolOptions, type PoolType, PoolTypes } from '../pool.js'
index ff2709826076459a8ef4ee417221b333b3ca70e3..2c021534baddd48b06f3c9b0a9aa7a7fbfa2d0cd 100644 (file)
@@ -1,22 +1,24 @@
-import { existsSync } from 'node:fs'
 import cluster, { Worker as ClusterWorker } from 'node:cluster'
+import { randomInt } from 'node:crypto'
+import { existsSync } from 'node:fs'
+import { cpus } from 'node:os'
+import { env } from 'node:process'
 import {
   SHARE_ENV,
   Worker as ThreadWorker,
   type WorkerOptions
 } from 'node:worker_threads'
-import { env } from 'node:process'
-import { randomInt } from 'node:crypto'
-import { cpus } from 'node:os'
-import { average, isPlainObject, max, median, min } from '../utils.js'
+
 import type { MessageValue, Task } from '../utility-types.js'
+import { average, isPlainObject, max, median, min } from '../utils.js'
+import type { IPool, TasksQueueOptions } from './pool.js'
 import {
   type MeasurementStatisticsRequirements,
   WorkerChoiceStrategies,
   type WorkerChoiceStrategy,
   type WorkerChoiceStrategyOptions
 } from './selection-strategies/selection-strategies-types.js'
-import type { IPool, TasksQueueOptions } from './pool.js'
+import type { WorkerChoiceStrategyContext } from './selection-strategies/worker-choice-strategy-context.js'
 import {
   type IWorker,
   type IWorkerNode,
@@ -26,7 +28,6 @@ import {
   WorkerTypes,
   type WorkerUsage
 } from './worker.js'
-import type { WorkerChoiceStrategyContext } from './selection-strategies/worker-choice-strategy-context.js'
 
 /**
  * Default measurement statistics requirements.
index 523036a5eac6f57db2966131652b29da6423fea1..1a4df6cd4afd479607a267e0d5ada4744a312e9e 100644 (file)
@@ -1,9 +1,16 @@
-import { MessageChannel } from 'node:worker_threads'
 import { EventEmitter } from 'node:events'
+import { MessageChannel } from 'node:worker_threads'
+
 import { CircularArray } from '../circular-array.js'
+import { Deque } from '../deque.js'
 import type { Task } from '../utility-types.js'
 import { DEFAULT_TASK_NAME } from '../utils.js'
-import { Deque } from '../deque.js'
+import {
+  checkWorkerNodeArguments,
+  createWorker,
+  getWorkerId,
+  getWorkerType
+} from './utils.js'
 import {
   type EventHandler,
   type IWorker,
@@ -15,12 +22,6 @@ import {
   WorkerTypes,
   type WorkerUsage
 } from './worker.js'
-import {
-  checkWorkerNodeArguments,
-  createWorker,
-  getWorkerId,
-  getWorkerType
-} from './utils.js'
 
 /**
  * Worker node.
index d40754835ab040d7fd8f947238bb9b857c6d58a6..ee54c6acc3f17216361f3c20b55b61f74376f260 100644 (file)
@@ -1,5 +1,6 @@
-import type { MessageChannel, WorkerOptions } from 'node:worker_threads'
 import type { EventEmitter } from 'node:events'
+import type { MessageChannel, WorkerOptions } from 'node:worker_threads'
+
 import type { CircularArray } from '../circular-array.js'
 import type { Task } from '../utility-types.js'
 
index e407309a3d0e221a929a89a5d25cc84466a1e51e..c7663606cf86afe67f84d6f25d831d567b5bab3f 100644 (file)
@@ -1,6 +1,7 @@
+import type { AsyncResource } from 'node:async_hooks'
 import type { EventLoopUtilization } from 'node:perf_hooks'
 import type { MessagePort, TransferListItem } from 'node:worker_threads'
-import type { AsyncResource } from 'node:async_hooks'
+
 import type { KillBehavior } from './worker/worker-options.js'
 
 /**
index a33758ce64c1ad72890b8d6e8b40b96336316c65..f77d84a97e6694d2c22cbdc0dd0a5bb97ab69f89 100644 (file)
@@ -1,5 +1,6 @@
-import * as os from 'node:os'
 import { getRandomValues } from 'node:crypto'
+import * as os from 'node:os'
+
 import type { KillBehavior } from './worker/worker-options.js'
 
 /**
index e754602ae2b17417b8dba572274989e08f612b3b..6c7fd812097dea235462c124904a3b3e69812869 100644 (file)
@@ -1,6 +1,7 @@
 import type { Worker } from 'node:cluster'
-import type { MessagePort } from 'node:worker_threads'
 import { performance } from 'node:perf_hooks'
+import type { MessagePort } from 'node:worker_threads'
+
 import type {
   MessageValue,
   Task,
@@ -13,7 +14,6 @@ import {
   isAsyncFunction,
   isPlainObject
 } from '../utils.js'
-import { KillBehaviors, type WorkerOptions } from './worker-options.js'
 import type {
   TaskAsyncFunction,
   TaskFunction,
@@ -26,6 +26,7 @@ import {
   checkValidTaskFunctionEntry,
   checkValidWorkerOptions
 } from './utils.js'
+import { KillBehaviors, type WorkerOptions } from './worker-options.js'
 
 const DEFAULT_MAX_INACTIVE_TIME = 60000
 const DEFAULT_WORKER_OPTIONS: WorkerOptions = {
index eedf13bd9265cb30b6d7cd689c42e2c517367acd..325b7a410b6cb7686ebee51f1d37b06043622fad 100644 (file)
@@ -1,8 +1,9 @@
 import cluster, { type Worker } from 'node:cluster'
+
 import type { MessageValue } from '../utility-types.js'
 import { AbstractWorker } from './abstract-worker.js'
-import type { WorkerOptions } from './worker-options.js'
 import type { TaskFunction, TaskFunctions } from './task-functions.js'
+import type { WorkerOptions } from './worker-options.js'
 
 /**
  * A cluster worker used by a poolifier `ClusterPool`.
index 638de2ba2f9c8f090360c528cd1169cfcd52e823..7115d71568a6fc0664ba6f74b17085b35bc50655 100644 (file)
@@ -1,13 +1,14 @@
 import {
-  type MessagePort,
   isMainThread,
+  type MessagePort,
   parentPort,
   threadId
 } from 'node:worker_threads'
+
 import type { MessageValue } from '../utility-types.js'
 import { AbstractWorker } from './abstract-worker.js'
-import type { WorkerOptions } from './worker-options.js'
 import type { TaskFunction, TaskFunctions } from './task-functions.js'
+import type { WorkerOptions } from './worker-options.js'
 
 /**
  * A thread worker used by a poolifier `ThreadPool`.
index ed06904578f67e48230271e34bc8c15482579e70..a6f2f69370d3144db429cf00390aea117602f3f7 100644 (file)
@@ -1,4 +1,5 @@
 import { expect } from 'expect'
+
 import {
   CircularArray,
   DEFAULT_CIRCULAR_ARRAY_SIZE
index 91ae5987955234da56ee253ca10228bb2b66c489..f9a58c85327a5e269aacb81f91b23462e16a7b8a 100644 (file)
@@ -1,4 +1,5 @@
 import { expect } from 'expect'
+
 import { Deque } from '../lib/deque.cjs'
 
 describe('Deque test suite', () => {
index 4b32e253a3aed5c203bfff7476d49a02a6b4488c..89cc8995033c12c55f64e4cf8f1c7b1d59d66f42 100644 (file)
@@ -1,10 +1,14 @@
+import { createHook, executionAsyncId } from 'node:async_hooks'
 import { EventEmitterAsyncResource } from 'node:events'
-import { dirname, join } from 'node:path'
 import { readFileSync } from 'node:fs'
+import { dirname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
-import { createHook, executionAsyncId } from 'node:async_hooks'
+
 import { expect } from 'expect'
 import { restore, stub } from 'sinon'
+
+import { CircularArray } from '../../lib/circular-array.cjs'
+import { Deque } from '../../lib/deque.cjs'
 import {
   DynamicClusterPool,
   DynamicThreadPool,
@@ -15,11 +19,9 @@ import {
   WorkerChoiceStrategies,
   WorkerTypes
 } from '../../lib/index.cjs'
-import { CircularArray } from '../../lib/circular-array.cjs'
-import { Deque } from '../../lib/deque.cjs'
+import { WorkerNode } from '../../lib/pools/worker-node.cjs'
 import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs'
 import { waitPoolEvents } from '../test-utils.cjs'
-import { WorkerNode } from '../../lib/pools/worker-node.cjs'
 
 describe('Abstract pool test suite', () => {
   const version = JSON.parse(
index 540223bf2840ab384e11d4b077a5f84cd27a8144..8e6c125bf24a2bbd3d231968c1cb10756f12ae1e 100644 (file)
@@ -1,4 +1,5 @@
 import { expect } from 'expect'
+
 import {
   DynamicClusterPool,
   PoolEvents,
index ed5882c4c70c3002936be718f4071802e0ff39ad..cf00239514cd4864c297872dec4c42a2d5dea321 100644 (file)
@@ -1,8 +1,9 @@
 import { expect } from 'expect'
+
 import { FixedClusterPool, PoolEvents } from '../../../lib/index.cjs'
+import { DEFAULT_TASK_NAME } from '../../../lib/utils.cjs'
 import { TaskFunctions } from '../../test-types.cjs'
 import { waitPoolEvents, waitWorkerEvents } from '../../test-utils.cjs'
-import { DEFAULT_TASK_NAME } from '../../../lib/utils.cjs'
 
 describe('Fixed cluster pool test suite', () => {
   const numberOfWorkers = 8
index bca3c82b1647e22146b6094321d7c9ac60485403..5241168cd880e101d2ed793831583398a209488d 100644 (file)
@@ -1,4 +1,6 @@
 import { expect } from 'expect'
+
+import { CircularArray } from '../../../lib/circular-array.cjs'
 import {
   DynamicClusterPool,
   DynamicThreadPool,
@@ -6,7 +8,6 @@ import {
   FixedThreadPool,
   WorkerChoiceStrategies
 } from '../../../lib/index.cjs'
-import { CircularArray } from '../../../lib/circular-array.cjs'
 
 describe('Selection strategies test suite', () => {
   const min = 0
index 5beffafac1b2d1ba5bdc9bcc845475abd4754698..80c5ec7c65b7f808e230870060bd6270da111100 100644 (file)
@@ -1,5 +1,7 @@
 import { randomInt } from 'node:crypto'
+
 import { expect } from 'expect'
+
 import { FixedThreadPool } from '../../../lib/index.cjs'
 import { InterleavedWeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.cjs'
 import { WeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.cjs'
index eb854b58badd66a4a16b1fcd9c49b445d06f8c93..c591235cd4d7f159da324815098293bd2b43e962 100644 (file)
@@ -1,18 +1,19 @@
 import { expect } from 'expect'
 import { createStubInstance, restore, stub } from 'sinon'
+
 import {
   DynamicThreadPool,
   FixedThreadPool,
   WorkerChoiceStrategies
 } from '../../../lib/index.cjs'
-import { WorkerChoiceStrategyContext } from '../../../lib/pools/selection-strategies/worker-choice-strategy-context.cjs'
-import { RoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/round-robin-worker-choice-strategy.cjs'
-import { LeastUsedWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-used-worker-choice-strategy.cjs'
+import { FairShareWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/fair-share-worker-choice-strategy.cjs'
+import { InterleavedWeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.cjs'
 import { LeastBusyWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-busy-worker-choice-strategy.cjs'
 import { LeastEluWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-elu-worker-choice-strategy.cjs'
-import { FairShareWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/fair-share-worker-choice-strategy.cjs'
+import { LeastUsedWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-used-worker-choice-strategy.cjs'
+import { RoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/round-robin-worker-choice-strategy.cjs'
 import { WeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.cjs'
-import { InterleavedWeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.cjs'
+import { WorkerChoiceStrategyContext } from '../../../lib/pools/selection-strategies/worker-choice-strategy-context.cjs'
 
 describe('Worker choice strategy context test suite', () => {
   const min = 1
index 77c5aaeb5afd3893c8c7eb265a7d65ed4d3cdda6..fbce8ae0030455ed70f7edcdba134c360bf68dd6 100644 (file)
@@ -1,4 +1,5 @@
 import { expect } from 'expect'
+
 import {
   DynamicThreadPool,
   PoolEvents,
index 44e7d80ba7c7f4049ec2305ab6b039fb38039124..94f7921caccb07d0474952a85c77e440d9d3fa0f 100644 (file)
@@ -1,8 +1,9 @@
 import { expect } from 'expect'
+
 import { FixedThreadPool, PoolEvents } from '../../../lib/index.cjs'
+import { DEFAULT_TASK_NAME } from '../../../lib/utils.cjs'
 import { TaskFunctions } from '../../test-types.cjs'
 import { waitPoolEvents, waitWorkerEvents } from '../../test-utils.cjs'
-import { DEFAULT_TASK_NAME } from '../../../lib/utils.cjs'
 
 describe('Fixed thread pool test suite', () => {
   const numberOfThreads = 6
index 6869bda681315aab9b088bad60677df4e8bcc510..c6cc06d31487f2b492850203fb64ceda79d2ae87 100644 (file)
@@ -1,25 +1,27 @@
-import { Worker as ThreadWorker } from 'node:worker_threads'
 import cluster, { Worker as ClusterWorker } from 'node:cluster'
+import { Worker as ThreadWorker } from 'node:worker_threads'
+
 import { expect } from 'expect'
+
 import {
   CircularArray,
   DEFAULT_CIRCULAR_ARRAY_SIZE
 } from '../../lib/circular-array.cjs'
 import {
-  DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
+  FixedClusterPool,
+  FixedThreadPool,
+  WorkerTypes
+} from '../../lib/index.cjs'
+import {
   buildWorkerChoiceStrategyOptions,
   createWorker,
+  DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
   getDefaultTasksQueueOptions,
   getWorkerChoiceStrategyRetries,
   getWorkerId,
   getWorkerType,
   updateMeasurementStatistics
 } from '../../lib/pools/utils.cjs'
-import {
-  FixedClusterPool,
-  FixedThreadPool,
-  WorkerTypes
-} from '../../lib/index.cjs'
 
 describe('Pool utils test suite', () => {
   it('Verify DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS values', () => {
index 549db4b6aa5ae82ac6d87ab3007c376f2e854853..5633530f35d6fd0d06c1cae72af18405daabb997 100644 (file)
@@ -1,10 +1,12 @@
-import { MessageChannel, Worker as ThreadWorker } from 'node:worker_threads'
 import { Worker as ClusterWorker } from 'node:cluster'
+import { MessageChannel, Worker as ThreadWorker } from 'node:worker_threads'
+
 import { expect } from 'expect'
-import { WorkerNode } from '../../lib/pools/worker-node.cjs'
-import { WorkerTypes } from '../../lib/index.cjs'
+
 import { CircularArray } from '../../lib/circular-array.cjs'
 import { Deque } from '../../lib/deque.cjs'
+import { WorkerTypes } from '../../lib/index.cjs'
+import { WorkerNode } from '../../lib/pools/worker-node.cjs'
 import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs'
 
 describe('Worker node test suite', () => {
index cd8deb8cd8e588ad7b3dc51901576270357ea901..bf6d3f08a6480be8e1470f242321300e184e66a8 100644 (file)
@@ -1,11 +1,14 @@
-import os from 'node:os'
 import { randomInt } from 'node:crypto'
+import os from 'node:os'
+
 import { expect } from 'expect'
+
+import { KillBehaviors } from '../lib/index.cjs'
 import {
-  DEFAULT_TASK_NAME,
-  EMPTY_FUNCTION,
   availableParallelism,
   average,
+  DEFAULT_TASK_NAME,
+  EMPTY_FUNCTION,
   exponentialDelay,
   isAsyncFunction,
   isKillBehavior,
@@ -18,7 +21,6 @@ import {
   secureRandom,
   sleep
 } from '../lib/utils.cjs'
-import { KillBehaviors } from '../lib/index.cjs'
 
 describe('Utils test suite', () => {
   it('Verify DEFAULT_TASK_NAME value', () => {
index 8a74ae3a150111858ccdaf33b2e80f824b36fdf4..f4840e53b2aebb30c7b852d5cb349dcd4f615671 100644 (file)
@@ -1,6 +1,6 @@
 import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
-import { executeTaskFunction } from '../../test-utils.cjs'
 import { TaskFunctions } from '../../test-types.cjs'
+import { executeTaskFunction } from '../../test-utils.cjs'
 
 /**
  *
index 3e5f55187f16b3e46ba2ce9bf1292cd6bcf88eb2..781f7790a1bfcbd3b9bc63657484b1fc7f667fce 100644 (file)
@@ -1,5 +1,6 @@
 import { expect } from 'expect'
 import { restore, stub } from 'sinon'
+
 import { ClusterWorker, KillBehaviors, ThreadWorker } from '../../lib/index.cjs'
 import { DEFAULT_TASK_NAME, EMPTY_FUNCTION } from '../../lib/utils.cjs'
 
index 33ddf374099ceeaea63acddd095531ae266d6667..3392d96cd1502ccdd90fd1f72a21381570d4976e 100644 (file)
@@ -1,5 +1,6 @@
 import { expect } from 'expect'
 import { restore, stub } from 'sinon'
+
 import { ClusterWorker } from '../../lib/index.cjs'
 import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs'
 
index 77bb6c08937dd2937bb069e702be43d526865585..e4a408d5246b600e08bed68c3979afb0e625e021 100644 (file)
@@ -1,5 +1,6 @@
 import { expect } from 'expect'
 import { restore, stub } from 'sinon'
+
 import { ThreadWorker } from '../../lib/index.cjs'
 import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs'
 
index b9f9cc9911f02ba4db340b427d32da9b244239d4..86f160da4960b68f9ec2c39a5b053ae14354372a 100644 (file)
@@ -1,7 +1,7 @@
+import { execSync } from 'node:child_process'
 import { copyFileSync, mkdirSync, readdirSync, rmSync } from 'node:fs'
 import { dirname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
-import { execSync } from 'node:child_process'
 
 try {
   mkdirSync(join(dirname(fileURLToPath(import.meta.url)), 'tmp'), {