From f3636726b3bf4ec12f6694090bbb04c8dcc56037 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 7 Oct 2022 12:10:35 +0200 Subject: [PATCH] Fix eslint configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .eslintrc.js | 11 +++++++---- src/pools/abstract-pool.ts | 4 ++-- src/pools/selection-strategies.ts | 1 + src/worker/abstract-worker.ts | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 93a3c1bd..b37ad59f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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: { diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index f3a8c1c6..5efecb58 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -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 diff --git a/src/pools/selection-strategies.ts b/src/pools/selection-strategies.ts index 20e02f31..f1c20bef 100644 --- a/src/pools/selection-strategies.ts +++ b/src/pools/selection-strategies.ts @@ -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` ) } diff --git a/src/worker/abstract-worker.ts b/src/worker/abstract-worker.ts index fbb8f839..8f86fb48 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -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(() => { -- 2.34.1