mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Enable consistent-this rule
This commit is contained in:
parent
5c1553bdda
commit
c24e6d5a18
@ -4,6 +4,7 @@ module.exports = {
|
|||||||
|
|
||||||
'arrow-body-style': [ 'error', 'as-needed', { requireReturnForObjectLiteral: false }],
|
'arrow-body-style': [ 'error', 'as-needed', { requireReturnForObjectLiteral: false }],
|
||||||
'capitalized-comments': [ 'error', 'always', { ignoreConsecutiveComments: true }],
|
'capitalized-comments': [ 'error', 'always', { ignoreConsecutiveComments: true }],
|
||||||
|
'consistent-this': 'error',
|
||||||
curly: [ 'error', 'all' ],
|
curly: [ 'error', 'all' ],
|
||||||
'default-case': 'error',
|
'default-case': 'error',
|
||||||
eqeqeq: [ 'error', 'always' ],
|
eqeqeq: [ 'error', 'always' ],
|
||||||
|
@ -83,13 +83,13 @@ export abstract class QuotaStrategy {
|
|||||||
*/
|
*/
|
||||||
public async createQuotaGuard(identifier: ResourceIdentifier): Promise<Guarded<PassThrough>> {
|
public async createQuotaGuard(identifier: ResourceIdentifier): Promise<Guarded<PassThrough>> {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
const strategy = this;
|
const that = this;
|
||||||
const { reporter } = this;
|
const { reporter } = this;
|
||||||
|
|
||||||
return guardStream(new PassThrough({
|
return guardStream(new PassThrough({
|
||||||
async transform(this, chunk: any, enc: string, done: () => void): Promise<void> {
|
async transform(this, chunk: any, enc: string, done: () => void): Promise<void> {
|
||||||
total += await reporter.calculateChunkSize(chunk);
|
total += await reporter.calculateChunkSize(chunk);
|
||||||
const availableSpace = await strategy.getAvailableSpace(identifier);
|
const availableSpace = await that.getAvailableSpace(identifier);
|
||||||
if (availableSpace.amount < total) {
|
if (availableSpace.amount < total) {
|
||||||
this.destroy(new PayloadHttpError(
|
this.destroy(new PayloadHttpError(
|
||||||
`Quota exceeded by ${total - availableSpace.amount} ${availableSpace.unit} during write`,
|
`Quota exceeded by ${total - availableSpace.amount} ${availableSpace.unit} during write`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user