Biome tweaks

This commit is contained in:
Gregory Schier
2025-11-23 08:45:15 -08:00
parent ec3e2e16a9
commit d7043e75d6
2 changed files with 2 additions and 36 deletions

View File

@@ -1,7 +1,7 @@
// biome-ignore-all lint/suspicious/noExplicitAny: too flexible for strict types
import type { PartialImportResources } from '@yaakapp/api';
import { convertId, convertTemplateSyntax, isJSObject } from './common';
// biome-ignore lint/suspicious/noExplicitAny: none
export function convertInsomniaV4(parsed: any) {
if (!Array.isArray(parsed.resources)) return null;
@@ -16,7 +16,6 @@ export function convertInsomniaV4(parsed: any) {
// Import workspaces
const workspacesToImport = parsed.resources.filter(
// biome-ignore lint/suspicious/noExplicitAny: none
(r: any) => isJSObject(r) && r._type === 'workspace',
);
for (const w of workspacesToImport) {
@@ -29,16 +28,13 @@ export function convertInsomniaV4(parsed: any) {
description: w.description || undefined,
});
const environmentsToImport = parsed.resources.filter(
// biome-ignore lint/suspicious/noExplicitAny: none
(r: any) => isJSObject(r) && r._type === 'environment',
);
resources.environments.push(
// biome-ignore lint/suspicious/noExplicitAny: none
...environmentsToImport.map((r: any) => importEnvironment(r, w._id)),
);
const nextFolder = (parentId: string) => {
// biome-ignore lint/suspicious/noExplicitAny: none
const children = parsed.resources.filter((r: any) => r.parentId === parentId);
for (const child of children) {
if (!isJSObject(child)) continue;
@@ -67,7 +63,6 @@ export function convertInsomniaV4(parsed: any) {
return { resources: convertTemplateSyntax(resources) };
}
// biome-ignore lint/suspicious/noExplicitAny: none
function importHttpRequest(r: any, workspaceId: string): PartialImportResources['httpRequests'][0] {
let bodyType: string | null = null;
let body = {};
@@ -77,7 +72,6 @@ function importHttpRequest(r: any, workspaceId: string): PartialImportResources[
} else if (r.body?.mimeType === 'application/x-www-form-urlencoded') {
bodyType = 'application/x-www-form-urlencoded';
body = {
// biome-ignore lint/suspicious/noExplicitAny: none
form: (r.body.params ?? []).map((p: any) => ({
enabled: !p.disabled,
name: p.name ?? '',
@@ -87,7 +81,6 @@ function importHttpRequest(r: any, workspaceId: string): PartialImportResources[
} else if (r.body?.mimeType === 'multipart/form-data') {
bodyType = 'multipart/form-data';
body = {
// biome-ignore lint/suspicious/noExplicitAny: none
form: (r.body.params ?? []).map((p: any) => ({
enabled: !p.disabled,
name: p.name ?? '',
@@ -129,7 +122,6 @@ function importHttpRequest(r: any, workspaceId: string): PartialImportResources[
name: r.name,
description: r.description || undefined,
url: r.url,
// biome-ignore lint/suspicious/noExplicitAny: none
urlParameters: (r.parameters ?? []).map((p: any) => ({
enabled: !p.disabled,
name: p.name ?? '',
@@ -141,20 +133,16 @@ function importHttpRequest(r: any, workspaceId: string): PartialImportResources[
authenticationType,
method: r.method,
headers: (r.headers ?? [])
// biome-ignore lint/suspicious/noExplicitAny: none
.map((h: any) => ({
enabled: !h.disabled,
name: h.name ?? '',
value: h.value ?? '',
}))
// biome-ignore lint/suspicious/noExplicitAny: none
.filter(({ name, value }: any) => name !== '' || value !== ''),
};
}
// biome-ignore lint/suspicious/noExplicitAny: none
function importGrpcRequest(r: any, workspaceId: string): PartialImportResources['grpcRequests'][0] {
// biome-ignore lint/suspicious/noExplicitAny: none
const parts = r.protoMethodName.split('/').filter((p: any) => p !== '');
const service = parts[0] ?? null;
const method = parts[1] ?? null;
@@ -174,18 +162,15 @@ function importGrpcRequest(r: any, workspaceId: string): PartialImportResources[
method,
message: r.body?.text ?? '',
metadata: (r.metadata ?? [])
// biome-ignore lint/suspicious/noExplicitAny: none
.map((h: any) => ({
enabled: !h.disabled,
name: h.name ?? '',
value: h.value ?? '',
}))
// biome-ignore lint/suspicious/noExplicitAny: none
.filter(({ name, value }: any) => name !== '' || value !== ''),
};
}
// biome-ignore lint/suspicious/noExplicitAny: none
function importFolder(f: any, workspaceId: string): PartialImportResources['folders'][0] {
return {
id: convertId(f._id),
@@ -200,7 +185,6 @@ function importFolder(f: any, workspaceId: string): PartialImportResources['fold
}
function importEnvironment(
// biome-ignore lint/suspicious/noExplicitAny: none
e: any,
workspaceId: string,
isParentOg?: boolean,

View File

@@ -1,7 +1,7 @@
// biome-ignore-all lint/suspicious/noExplicitAny: too flexible for strict types
import type { PartialImportResources } from '@yaakapp/api';
import { convertId, convertTemplateSyntax, isJSObject } from './common';
// biome-ignore lint/suspicious/noExplicitAny: none
export function convertInsomniaV5(parsed: any) {
// Assert parsed is object
if (parsed == null || typeof parsed !== 'object') {
@@ -22,7 +22,6 @@ export function convertInsomniaV5(parsed: any) {
};
// Import workspaces
// biome-ignore lint/suspicious/noExplicitAny: none
const meta = ('meta' in parsed ? parsed.meta : {}) as Record<string, any>;
resources.workspaces.push({
id: convertId(meta.id ?? 'collection'),
@@ -38,12 +37,10 @@ export function convertInsomniaV5(parsed: any) {
// Import environments
resources.environments.push(
importEnvironment(parsed.environments, meta.id, true),
// biome-ignore lint/suspicious/noExplicitAny: none
...(parsed.environments.subEnvironments ?? []).map((r: any) => importEnvironment(r, meta.id)),
);
// Import folders
// biome-ignore lint/suspicious/noExplicitAny: none
const nextFolder = (children: any[], parentId: string) => {
for (const child of children ?? []) {
if (!isJSObject(child)) continue;
@@ -76,7 +73,6 @@ export function convertInsomniaV5(parsed: any) {
}
function importHttpRequest(
// biome-ignore lint/suspicious/noExplicitAny: none
r: any,
workspaceId: string,
parentId: string,
@@ -94,7 +90,6 @@ function importHttpRequest(
} else if (r.body?.mimeType === 'application/x-www-form-urlencoded') {
bodyType = 'application/x-www-form-urlencoded';
body = {
// biome-ignore lint/suspicious/noExplicitAny: none
form: (r.body.params ?? []).map((p: any) => ({
enabled: !p.disabled,
name: p.name ?? '',
@@ -104,7 +99,6 @@ function importHttpRequest(
} else if (r.body?.mimeType === 'multipart/form-data') {
bodyType = 'multipart/form-data';
body = {
// biome-ignore lint/suspicious/noExplicitAny: none
form: (r.body.params ?? []).map((p: any) => ({
enabled: !p.disabled,
name: p.name ?? '',
@@ -131,7 +125,6 @@ function importHttpRequest(
name: r.name,
description: r.meta?.description || undefined,
url: r.url,
// biome-ignore lint/suspicious/noExplicitAny: none
urlParameters: (r.parameters ?? []).map((p: any) => ({
enabled: !p.disabled,
name: p.name ?? '',
@@ -146,7 +139,6 @@ function importHttpRequest(
}
function importGrpcRequest(
// biome-ignore lint/suspicious/noExplicitAny: none
r: any,
workspaceId: string,
parentId: string,
@@ -156,7 +148,6 @@ function importGrpcRequest(
const updated = r.meta?.modified ?? r.updated;
const sortKey = r.meta?.sortKey ?? r.sortKey;
// biome-ignore lint/suspicious/noExplicitAny: none
const parts = r.protoMethodName.split('/').filter((p: any) => p !== '');
const service = parts[0] ?? null;
const method = parts[1] ?? null;
@@ -176,19 +167,16 @@ function importGrpcRequest(
method,
message: r.body?.text ?? '',
metadata: (r.metadata ?? [])
// biome-ignore lint/suspicious/noExplicitAny: none
.map((h: any) => ({
enabled: !h.disabled,
name: h.name ?? '',
value: h.value ?? '',
}))
// biome-ignore lint/suspicious/noExplicitAny: none
.filter(({ name, value }: any) => name !== '' || value !== ''),
};
}
function importWebsocketRequest(
// biome-ignore lint/suspicious/noExplicitAny: none
r: any,
workspaceId: string,
parentId: string,
@@ -215,21 +203,17 @@ function importWebsocketRequest(
};
}
// biome-ignore lint/suspicious/noExplicitAny: none
function importHeaders(obj: any) {
const headers = (obj.headers ?? [])
// biome-ignore lint/suspicious/noExplicitAny: none
.map((h: any) => ({
enabled: !h.disabled,
name: h.name ?? '',
value: h.value ?? '',
}))
// biome-ignore lint/suspicious/noExplicitAny: none
.filter(({ name, value }: any) => name !== '' || value !== '');
return { headers } as const;
}
// biome-ignore lint/suspicious/noExplicitAny: none
function importAuthentication(obj: any) {
let authenticationType: string | null = null;
let authentication = {};
@@ -250,7 +234,6 @@ function importAuthentication(obj: any) {
}
function importFolder(
// biome-ignore lint/suspicious/noExplicitAny: none
f: any,
workspaceId: string,
parentId: string,
@@ -302,7 +285,6 @@ function importFolder(
}
function importEnvironment(
// biome-ignore lint/suspicious/noExplicitAny: none
e: any,
workspaceId: string,
isParent?: boolean,