From: Jérôme Benoit Date: Fri, 7 Oct 2022 10:10:35 +0000 (+0200) Subject: Fix eslint configuration X-Git-Tag: v2.2.1~21 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f3636726b3bf4ec12f6694090bbb04c8dcc56037;p=poolifier.git Fix eslint configuration Signed-off-by: Jérôme Benoit --- 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(() => {