From c24e6d5a18ff664a08ecd1a6fae068f0e3127eeb Mon Sep 17 00:00:00 2001 From: Joachim Van Herwegen Date: Tue, 12 Mar 2024 14:51:55 +0100 Subject: [PATCH] refactor: Enable consistent-this rule --- eslint/general.js | 1 + src/storage/quota/QuotaStrategy.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/eslint/general.js b/eslint/general.js index fe640d4a2..bf05ce45c 100644 --- a/eslint/general.js +++ b/eslint/general.js @@ -4,6 +4,7 @@ module.exports = { 'arrow-body-style': [ 'error', 'as-needed', { requireReturnForObjectLiteral: false }], 'capitalized-comments': [ 'error', 'always', { ignoreConsecutiveComments: true }], + 'consistent-this': 'error', curly: [ 'error', 'all' ], 'default-case': 'error', eqeqeq: [ 'error', 'always' ], diff --git a/src/storage/quota/QuotaStrategy.ts b/src/storage/quota/QuotaStrategy.ts index a09c95a6a..8c5d3568e 100644 --- a/src/storage/quota/QuotaStrategy.ts +++ b/src/storage/quota/QuotaStrategy.ts @@ -83,13 +83,13 @@ export abstract class QuotaStrategy { */ public async createQuotaGuard(identifier: ResourceIdentifier): Promise> { let total = 0; - const strategy = this; + const that = this; const { reporter } = this; return guardStream(new PassThrough({ async transform(this, chunk: any, enc: string, done: () => void): Promise { total += await reporter.calculateChunkSize(chunk); - const availableSpace = await strategy.getAvailableSpace(identifier); + const availableSpace = await that.getAvailableSpace(identifier); if (availableSpace.amount < total) { this.destroy(new PayloadHttpError( `Quota exceeded by ${total - availableSpace.amount} ${availableSpace.unit} during write`,