chore: enforce brackets for if clause and for/while loops
This commit is contained in:
@@ -246,12 +246,16 @@ export class AppliedFontsManager {
|
||||
);
|
||||
|
||||
for (const result of results) {
|
||||
if (result.ok) continue;
|
||||
if (result.ok) {
|
||||
continue;
|
||||
}
|
||||
const { key, config, reason } = result;
|
||||
const isAbort = reason instanceof FontFetchError
|
||||
&& reason.cause instanceof Error
|
||||
&& reason.cause.name === 'AbortError';
|
||||
if (isAbort) continue;
|
||||
if (isAbort) {
|
||||
continue;
|
||||
}
|
||||
if (reason instanceof FontFetchError) {
|
||||
console.error(`Font fetch failed: ${config.name}`, reason);
|
||||
}
|
||||
@@ -293,7 +297,9 @@ export class AppliedFontsManager {
|
||||
|
||||
// Remove FontFace from document to free memory
|
||||
const font = this.#loadedFonts.get(key);
|
||||
if (font) document.fonts.delete(font);
|
||||
if (font) {
|
||||
document.fonts.delete(font);
|
||||
}
|
||||
|
||||
// Evict from cache and cleanup URL mapping
|
||||
const url = this.#urlByKey.get(key);
|
||||
|
||||
@@ -15,7 +15,9 @@ import type { UnifiedFont } from '../../model/types';
|
||||
* Standalone function to avoid 'this' issues during construction.
|
||||
*/
|
||||
async function fetchAndSeed(ids: string[]): Promise<UnifiedFont[]> {
|
||||
if (ids.length === 0) return [];
|
||||
if (ids.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
let response: UnifiedFont[];
|
||||
try {
|
||||
|
||||
@@ -166,7 +166,9 @@ export class FontStore {
|
||||
const data = this.#qc.getQueryData<InfiniteData<ProxyFontsResponse, PageParam>>(
|
||||
this.buildQueryKey(this.#params),
|
||||
);
|
||||
if (!data) return undefined;
|
||||
if (!data) {
|
||||
return undefined;
|
||||
}
|
||||
return data.pages.flatMap(p => p.fonts);
|
||||
}
|
||||
|
||||
@@ -336,9 +338,15 @@ export class FontStore {
|
||||
throw new FontNetworkError(cause);
|
||||
}
|
||||
|
||||
if (!response) throw new FontResponseError('response', response);
|
||||
if (!response.fonts) throw new FontResponseError('response.fonts', response.fonts);
|
||||
if (!Array.isArray(response.fonts)) throw new FontResponseError('response.fonts', response.fonts);
|
||||
if (!response) {
|
||||
throw new FontResponseError('response', response);
|
||||
}
|
||||
if (!response.fonts) {
|
||||
throw new FontResponseError('response.fonts', response.fonts);
|
||||
}
|
||||
if (!Array.isArray(response.fonts)) {
|
||||
throw new FontResponseError('response.fonts', response.fonts);
|
||||
}
|
||||
|
||||
return {
|
||||
fonts: response.fonts,
|
||||
|
||||
Reference in New Issue
Block a user