Fix all lint errors

This commit is contained in:
Gregory Schier
2024-09-16 08:36:02 -07:00
parent 974ecd511d
commit 2951023ee8
19 changed files with 43 additions and 34 deletions

View File

@@ -19,7 +19,8 @@ export function isJSON(text: string): boolean {
try {
JSON.parse(text);
return true;
} catch (_) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
return false;
}
}

View File

@@ -8,7 +8,8 @@ export function tryFormatJson(text: string, pretty = true): string {
try {
if (pretty) return JSON.stringify(JSON.parse(text), null, INDENT);
else return JSON.stringify(JSON.parse(text));
} catch (_) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
return text;
}
}
@@ -18,7 +19,8 @@ export function tryFormatXml(text: string): string {
try {
return xmlFormat(text, { throwOnFailure: true, strictMode: false, indentation: INDENT });
} catch (_) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
return text;
}
}

View File

@@ -49,6 +49,7 @@ export function extractKeyValue<T>(kv: KeyValue | null): T | undefined {
try {
return JSON.parse(kv.value) as T;
} catch (err) {
console.log('Failed to parse kv value', kv.value, err);
return undefined;
}
}

View File

@@ -9,7 +9,8 @@ export async function getResponseBodyText(response: HttpResponse): Promise<strin
try {
return new TextDecoder(charset ?? 'utf-8', { fatal: true }).decode(bytes);
} catch (_) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
// Failed to decode as text, so return null
return null;
}