Fix eslint configuration
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 7 Oct 2022 10:10:35 +0000 (12:10 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 7 Oct 2022 10:10:35 +0000 (12:10 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
.eslintrc.js
src/pools/abstract-pool.ts
src/pools/selection-strategies.ts
src/worker/abstract-worker.ts

index 93a3c1bdc09c590ba0ff0986dedafab0e8d4e0e8..b37ad59fb91769bb590ec5829dade6800872973b 100644 (file)
@@ -7,10 +7,6 @@ module.exports = defineConfig({
     node: true,
     mocha: true
   },
-  parserOptions: {
-    ecmaVersion: 2020,
-    sourceType: 'module'
-  },
   plugins: ['promise', 'prettierx', 'jsdoc', 'spellcheck'],
   extends: [
     'standard',
@@ -55,9 +51,16 @@ module.exports = defineConfig({
     {
       files: ['**/*.ts'],
       parser: '@typescript-eslint/parser',
+      parserOptions: {
+        ecmaVersion: 2020,
+        sourceType: 'module',
+        project: './tsconfig.json'
+      },
       plugins: ['@typescript-eslint'],
       extends: [
+        'plugin:@typescript-eslint/eslint-recommended',
         'plugin:@typescript-eslint/recommended',
+        'plugin:@typescript-eslint/recommended-requiring-type-checking',
         'plugin:import/typescript'
       ],
       rules: {
index f3a8c1c6c9a7bb0a730b6b3b10dcd9a766b64e5e..5efecb58209d3b07e3f1d6cc25cfec0e71fc3281 100644 (file)
@@ -189,14 +189,14 @@ export abstract class AbstractPool<
       this,
       () => {
         const workerCreated = this.createAndSetupWorker()
-        this.registerWorkerMessageListener(workerCreated, async message => {
+        this.registerWorkerMessageListener(workerCreated, message => {
           const tasksInProgress = this.tasks.get(workerCreated)
           if (
             isKillBehavior(KillBehaviors.HARD, message.kill) ||
             tasksInProgress === 0
           ) {
             // Kill received from the worker, means that no new tasks are submitted to that worker for a while ( > maxInactiveTime)
-            await this.destroyWorker(workerCreated)
+            this.destroyWorker(workerCreated) as void
           }
         })
         return workerCreated
index 20e02f31b490530b42771150676ebcd08baeddd8..f1c20befd6b709784f08f5fe339709d2bf3b1e3d 100644 (file)
@@ -252,6 +252,7 @@ class SelectionStrategiesUtils {
         return new LessRecentlyUsedWorkerChoiceStrategy(pool)
       default:
         throw new Error(
+          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
           `Worker choice strategy '${workerChoiceStrategy}' not found`
         )
     }
index fbb8f8390eff2207253195eb3817c68dc879e2b7..8f86fb485cd26f30efcc51a1546eb1752579ba24 100644 (file)
@@ -191,7 +191,7 @@ export abstract class AbstractWorker<
         return null
       })
       .catch(e => {
-        const err = this.handleError(e)
+        const err = this.handleError(e as Error)
         this.sendToMainWorker({ error: err, id: value.id })
       })
       .finally(() => {