refactor: use eslint plugin to sort imports
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 1 May 2023 12:41:45 +0000 (14:41 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 1 May 2023 12:41:45 +0000 (14:41 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
.eslintrc.js
benchmarks/benchmarks-utils.js
examples/yourWorker.js
package.json
pnpm-lock.yaml
src/pools/abstract-pool.ts
src/pools/selection-strategies/abstract-worker-choice-strategy.ts
src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts
src/pools/thread/fixed.ts
tests/worker-files/cluster/testWorker.js
tests/worker-files/thread/testWorker.js

index c4f0c6d26777bb3cf6710aac51448dce92372577..6ff6e4c175f2406b08b3931af08c16c777d98123 100644 (file)
@@ -19,12 +19,12 @@ module.exports = defineConfig({
   ],
   rules: {
     'sort-imports': [
-      'warn',
+      'error',
       {
-        ignoreMemberSort: true,
         ignoreDeclarationSort: true
       }
     ],
+    'import/order': 'error',
 
     'spellcheck/spell-checker': [
       'warn',
index aac4b78583923252c0c8972273d7c8aced7f9842..743936dabdbef3b1963fb63ce092b28881226d9b 100644 (file)
@@ -1,16 +1,16 @@
 const crypto = require('crypto')
 const fs = require('fs')
-const {
-  PoolTypes,
-  WorkerFunctions,
-  WorkerTypes
-} = require('./benchmarks-types')
 const {
   DynamicClusterPool,
   DynamicThreadPool,
   FixedClusterPool,
   FixedThreadPool
 } = require('../lib')
+const {
+  PoolTypes,
+  WorkerFunctions,
+  WorkerTypes
+} = require('./benchmarks-types')
 
 async function runTest (pool, { taskExecutions, workerData }) {
   return new Promise((resolve, reject) => {
index 5bd1ad6569c212b560d3eb829352f8974417b4a3..7de9485ceb1a228075011e615fb802d7660185b4 100644 (file)
@@ -1,6 +1,6 @@
 'use strict'
-const { ThreadWorker } = require('poolifier')
 const { isMainThread } = require('worker_threads')
+const { ThreadWorker } = require('poolifier')
 
 const debug = false
 
index 0ec8aa6fc6c89f4ca1b76a44efbac6827fcf5966..ea732c9ad814794b75e400ade6e89e83dde4a29b 100644 (file)
     "mocha": "^10.2.0",
     "mochawesome": "^7.1.3",
     "prettier": "^2.8.8",
-    "prettier-plugin-organize-imports": "^3.2.2",
     "release-it": "^15.10.2",
     "rollup": "^3.21.2",
     "rollup-plugin-analyzer": "^4.0.0",
index 3f005e641b28ed18530c1a04e82ae6ca004a9e67..ff49f4dd3645fb9b79d55bbe76aff82e94ceb04a 100644 (file)
@@ -88,9 +88,6 @@ devDependencies:
   prettier:
     specifier: ^2.8.8
     version: 2.8.8
-  prettier-plugin-organize-imports:
-    specifier: ^3.2.2
-    version: 3.2.2(prettier@2.8.8)(typescript@5.0.4)
   release-it:
     specifier: ^15.10.2
     version: 15.10.2
@@ -4758,23 +4755,6 @@ packages:
     engines: {node: '>= 0.8.0'}
     dev: true
 
-  /prettier-plugin-organize-imports@3.2.2(prettier@2.8.8)(typescript@5.0.4):
-    resolution: {integrity: sha512-e97lE6odGSiHonHJMTYC0q0iLXQyw0u5z/PJpvP/3vRy6/Zi9kLBwFAbEGjDzIowpjQv8b+J04PDamoUSQbzGA==}
-    peerDependencies:
-      '@volar/vue-language-plugin-pug': ^1.0.4
-      '@volar/vue-typescript': ^1.0.4
-      prettier: '>=2.0'
-      typescript: '>=2.9'
-    peerDependenciesMeta:
-      '@volar/vue-language-plugin-pug':
-        optional: true
-      '@volar/vue-typescript':
-        optional: true
-    dependencies:
-      prettier: 2.8.8
-      typescript: 5.0.4
-    dev: true
-
   /prettier@2.8.8:
     resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==}
     engines: {node: '>=10.13.0'}
index e0feb5edf9925e7bf893ea1916d6f1a84d53565b..2ee3a0ccb968100e23a5deecfe2eb4e049171875 100644 (file)
@@ -6,13 +6,14 @@ import {
   median
 } from '../utils'
 import { KillBehaviors, isKillBehavior } from '../worker/worker-options'
+import { CircularArray } from '../circular-array'
 import {
+  type IPool,
   PoolEmitter,
   PoolEvents,
-  type IPool,
   type PoolOptions,
-  type TasksQueueOptions,
-  PoolType
+  PoolType,
+  type TasksQueueOptions
 } from './pool'
 import type { IWorker, Task, TasksUsage, WorkerNode } from './worker'
 import {
@@ -21,7 +22,6 @@ import {
   type WorkerChoiceStrategyOptions
 } from './selection-strategies/selection-strategies-types'
 import { WorkerChoiceStrategyContext } from './selection-strategies/worker-choice-strategy-context'
-import { CircularArray } from '../circular-array'
 
 /**
  * Base class that implements some shared logic for all poolifier pools.
index e29c1e38987a49aab6d19e5eba0670cb4b2131c5..3dda355ef29a043ad3c9c4d34241cebac6e1f28f 100644 (file)
@@ -1,5 +1,5 @@
 import { DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS } from '../../utils'
-import { PoolType, type IPool } from '../pool'
+import { type IPool, PoolType } from '../pool'
 import type { IWorker } from '../worker'
 import type {
   IWorkerChoiceStrategy,
index c5c204373e67e7135b590eb8b3faa709f156f26d..53b2d64d923412e73ae11f9b8cbc23f892acdf4a 100644 (file)
@@ -1,13 +1,13 @@
 import { cpus } from 'node:os'
 import type { IWorker } from '../worker'
+import type { IPool } from '../pool'
+import { DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS } from '../../utils'
 import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
 import type {
   IWorkerChoiceStrategy,
   RequiredStatistics,
   WorkerChoiceStrategyOptions
 } from './selection-strategies-types'
-import type { IPool } from '../pool'
-import { DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS } from '../../utils'
 
 /**
  * Virtual task runtime.
index 7753d1d60cb21910a5f871338889023ef4de12c1..570c9c8b7f3ed718aaf2309b41e8b8486477d423 100644 (file)
@@ -1,8 +1,8 @@
 import {
-  isMainThread,
   MessageChannel,
   SHARE_ENV,
-  Worker
+  Worker,
+  isMainThread
 } from 'node:worker_threads'
 import type { Draft, MessageValue } from '../../utility-types'
 import { AbstractPool } from '../abstract-pool'
index ee82c654705b26eb830faa3c407cd6092b4731e9..3f50d102a8364a1dad1ed6d67317f13435dd5942 100644 (file)
@@ -1,6 +1,6 @@
 'use strict'
-const { ClusterWorker, KillBehaviors } = require('../../../lib')
 const { isMaster } = require('cluster')
+const { ClusterWorker, KillBehaviors } = require('../../../lib')
 const TestUtils = require('../../test-utils')
 const { WorkerFunctions } = require('../../test-types')
 
index 2b86fde282c6ed28106656164d7af1275b479b00..177ef08bbe648a207cf74076ce6078dfac20c28a 100644 (file)
@@ -1,6 +1,6 @@
 'use strict'
-const { ThreadWorker, KillBehaviors } = require('../../../lib')
 const { isMainThread } = require('worker_threads')
+const { ThreadWorker, KillBehaviors } = require('../../../lib')
 const TestUtils = require('../../test-utils')
 const { WorkerFunctions } = require('../../test-types')