refactor: Make no-extra-parens rule stricter

This commit is contained in:
Joachim Van Herwegen
2024-03-12 14:44:09 +01:00
parent c4df54dd88
commit 28af181eee
5 changed files with 13 additions and 5 deletions

View File

@@ -12,5 +12,5 @@ export interface ResourceIdentifier {
* Determines whether the object is a {@link ResourceIdentifier}.
*/
export function isResourceIdentifier(object: unknown): object is ResourceIdentifier {
return Boolean(object) && (typeof (object as ResourceIdentifier).path === 'string');
return Boolean(object) && typeof (object as ResourceIdentifier).path === 'string';
}

View File

@@ -160,7 +160,7 @@ export class StaticAssetHandler extends HttpHandler {
{
// eslint-disable-next-line ts/naming-convention
'cache-control': `max-age=${this.expires}`,
expires: new Date(Date.now() + (this.expires * 1000)).toUTCString(),
expires: new Date(Date.now() + this.expires * 1000).toUTCString(),
};
}
}

View File

@@ -184,7 +184,12 @@ async function findNextSorted<T>(
export async function* sortedAsyncMerge<T>(iterators: AsyncIterator<T>[], comparator?: (left: T, right: T) => number):
AsyncIterable<T> {
if (!comparator) {
comparator = (left, right): number => left < right ? -1 : (left > right ? 1 : 0);
comparator = (left, right): number => {
if (left < right) {
return -1;
}
return left > right ? 1 : 0;
};
}
// Initialize the array to the first result of every iterator