Require curly brackets in if statements when they're multi-line (#18387)

* Enable Curly rule

* Fix curly misuse
This commit is contained in:
Rijk van Zanten
2023-05-02 16:02:43 -04:00
committed by GitHub
parent 4e5d5093b3
commit 44b4863788
26 changed files with 109 additions and 42 deletions

View File

@@ -357,8 +357,9 @@ export function applyFilter(
if (key === '_or' || key === '_and') {
// If the _or array contains an empty object (full permissions), we should short-circuit and ignore all other
// permission checks, as {} already matches full permissions.
if (key === '_or' && value.some((subFilter: Record<string, any>) => Object.keys(subFilter).length === 0))
if (key === '_or' && value.some((subFilter: Record<string, any>) => Object.keys(subFilter).length === 0)) {
continue;
}
value.forEach((subFilter: Record<string, any>) => {
addJoins(dbQuery, subFilter, collection);

View File

@@ -3,7 +3,7 @@ import type { File, Transformation, TransformationParams } from '../types/index.
export function resolvePreset(input: TransformationParams, file: File): Transformation[] {
const transforms = input.transforms ? [...input.transforms] : [];
if (input.format || input.quality)
if (input.format || input.quality) {
transforms.push([
'toFormat',
input.format || (file.type!.split('/')[1] as any),
@@ -11,8 +11,9 @@ export function resolvePreset(input: TransformationParams, file: File): Transfor
quality: input.quality ? Number(input.quality) : undefined,
},
]);
}
if (input.width || input.height)
if (input.width || input.height) {
transforms.push([
'resize',
{
@@ -22,6 +23,7 @@ export function resolvePreset(input: TransformationParams, file: File): Transfor
withoutEnlargement: input.withoutEnlargement ? Boolean(input.withoutEnlargement) : undefined,
},
]);
}
return transforms;
}