mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-29 05:41:46 +02:00
Fix lint errors
This commit is contained in:
@@ -590,11 +590,11 @@ export const plugin: PluginDefinition = {
|
||||
credentialsInBody,
|
||||
});
|
||||
} else {
|
||||
throw new Error(`Invalid grant type ${grantType}`);
|
||||
throw new Error(`Invalid grant type ${String(grantType)}`);
|
||||
}
|
||||
|
||||
const headerName = stringArg(values, 'headerName') || 'Authorization';
|
||||
const headerValue = `${headerPrefix} ${token.response[tokenName]}`.trim();
|
||||
const headerValue = `${headerPrefix} ${token.response[tokenName] ?? ''}`.trim();
|
||||
return { setHeaders: [{ name: headerName, value: headerValue }] };
|
||||
},
|
||||
},
|
||||
|
||||
@@ -11,7 +11,7 @@ export const plugin: PluginDefinition = {
|
||||
const filtered = JSONPath({ path: args.filter, json: parsed });
|
||||
return { content: JSON.stringify(filtered, null, 2) };
|
||||
} catch (err) {
|
||||
return { content: '', error: `Invalid filter: ${err}` };
|
||||
return { content: '', error: `Invalid filter: ${err instanceof Error ? err.message : String(err)}` };
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -18,7 +18,7 @@ export const plugin: PluginDefinition = {
|
||||
// Not sure what cases this happens in (?)
|
||||
return { content: String(result) };
|
||||
} catch (err) {
|
||||
return { content: '', error: `Invalid filter: ${err}` };
|
||||
return { content: '', error: `Invalid filter: ${err instanceof Error ? err.message : String(err)}` };
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -203,7 +203,7 @@ function importEnvironment(
|
||||
variables: Object.entries(e.data).map(([name, value]) => ({
|
||||
enabled: true,
|
||||
name,
|
||||
value: `${value}`,
|
||||
value: String(value),
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ function importFolder(
|
||||
variables: Object.entries(f.environment ?? {}).map(([name, value]) => ({
|
||||
enabled: true,
|
||||
name,
|
||||
value: `${value}`,
|
||||
value: String(value),
|
||||
})),
|
||||
};
|
||||
}
|
||||
@@ -308,7 +308,7 @@ function importEnvironment(
|
||||
variables: Object.entries(e.data ?? {}).map(([name, value]) => ({
|
||||
enabled: true,
|
||||
name,
|
||||
value: `${value}`,
|
||||
value: String(value),
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ function parseJSONToRecord<T>(jsonStr: string): Record<string, T> | null {
|
||||
}
|
||||
}
|
||||
|
||||
function toRecord<T>(value: Record<string, T> | unknown): Record<string, T> {
|
||||
function toRecord<T>(value: unknown): Record<string, T> {
|
||||
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
||||
return value as Record<string, T>;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ export function convertPostman(contents: string): ImportPluginResponse | undefin
|
||||
return { resources };
|
||||
}
|
||||
|
||||
function convertUrl(rawUrl: string | unknown): Pick<HttpRequest, 'url' | 'urlParameters'> {
|
||||
function convertUrl(rawUrl: unknown): Pick<HttpRequest, 'url' | 'urlParameters'> {
|
||||
if (typeof rawUrl === 'string') {
|
||||
return { url: rawUrl, urlParameters: [] };
|
||||
}
|
||||
@@ -173,7 +173,7 @@ function convertUrl(rawUrl: string | unknown): Pick<HttpRequest, 'url' | 'urlPar
|
||||
}
|
||||
|
||||
if ('host' in url) {
|
||||
v += `${Array.isArray(url.host) ? url.host.join('.') : url.host}`;
|
||||
v += `${Array.isArray(url.host) ? url.host.join('.') : String(url.host)}`;
|
||||
}
|
||||
|
||||
if ('port' in url && typeof url.port === 'string') {
|
||||
@@ -490,7 +490,7 @@ function parseJSONToRecord<T>(jsonStr: string): Record<string, T> | null {
|
||||
}
|
||||
}
|
||||
|
||||
function toRecord<T>(value: Record<string, T> | unknown): Record<string, T> {
|
||||
function toRecord<T>(value: unknown): Record<string, T> {
|
||||
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
||||
return value as Record<string, T>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user