Switch to BiomeJS (#306)

This commit is contained in:
Gregory Schier
2025-11-23 08:38:13 -08:00
committed by GitHub
parent 2bac610efe
commit ec3e2e16a9
332 changed files with 3007 additions and 4097 deletions

View File

@@ -1,5 +1,4 @@
import { convertFileSrc } from '@tauri-apps/api/core';
import React from 'react';
interface Props {
bodyPath: string;
@@ -8,6 +7,6 @@ interface Props {
export function AudioViewer({ bodyPath }: Props) {
const src = convertFileSrc(bodyPath);
// eslint-disable-next-line jsx-a11y/media-has-caption
return <audio className="w-full" controls src={src}></audio>;
// biome-ignore lint/a11y/useMediaCaption: none
return <audio className="w-full" controls src={src} />;
}

View File

@@ -1,8 +1,8 @@
import type { HttpResponse } from '@yaakapp-internal/models';
import classNames from 'classnames';
import Papa from 'papaparse';
import { useMemo } from 'react';
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
import type { HttpResponse } from '@yaakapp-internal/models';
interface Props {
response: HttpResponse;
@@ -24,8 +24,10 @@ export function CsvViewer({ response, className }: Props) {
<table className={classNames(className, 'text-sm')}>
<tbody>
{parsed.data.map((row, i) => (
// biome-ignore lint/suspicious/noArrayIndexKey: none
<tr key={i} className={classNames('border-l border-t', i > 0 && 'border-b')}>
{row.map((col, j) => (
// biome-ignore lint/suspicious/noArrayIndexKey: none
<td key={j} className="border-r px-1.5">
{col}
</td>

View File

@@ -1,7 +1,7 @@
import type { HttpResponse } from '@yaakapp-internal/models';
import type { ServerSentEvent } from '@yaakapp-internal/sse';
import classNames from 'classnames';
import React, { Fragment, useMemo, useState } from 'react';
import { Fragment, useMemo, useState } from 'react';
import { useFormatText } from '../../hooks/useFormatText';
import { useResponseBodyEventSource } from '../../hooks/useResponseBodyEventSource';
import { isJSON } from '../../lib/contentType';
@@ -144,6 +144,7 @@ function EventRow({
}) {
return (
<button
type="button"
onClick={onClick}
className={classNames(
className,

View File

@@ -23,18 +23,18 @@ export function HTMLOrTextViewer({ response, pretty, textViewerClassName }: Prop
if (language === 'html' && pretty) {
return <WebPageViewer response={response} />;
} else if (rawTextBody.data == null) {
return <EmptyStateText>Empty response</EmptyStateText>;
} else {
return (
<TextViewer
language={language}
text={rawTextBody.data}
pretty={pretty}
className={textViewerClassName}
response={response}
requestId={response.requestId}
/>
);
}
if (rawTextBody.data == null) {
return <EmptyStateText>Empty response</EmptyStateText>;
}
return (
<TextViewer
language={language}
text={rawTextBody.data}
pretty={pretty}
className={textViewerClassName}
response={response}
requestId={response.requestId}
/>
);
}

View File

@@ -1,5 +1,4 @@
import { convertFileSrc } from '@tauri-apps/api/core';
import React from 'react';
interface Props {
bodyPath: string;

View File

@@ -1,6 +1,6 @@
import type { HttpResponse } from '@yaakapp-internal/models';
import classNames from 'classnames';
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
import type { HttpResponse } from '@yaakapp-internal/models';
import { JsonAttributeTree } from '../core/JsonAttributeTree';
interface Props {
@@ -16,8 +16,7 @@ export function JsonViewer({ response, className }: Props) {
let parsed = {};
try {
parsed = JSON.parse(rawBody.data);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
} catch {
// Nothing yet
}

View File

@@ -3,7 +3,7 @@ import 'react-pdf/dist/Page/AnnotationLayer.css';
import { convertFileSrc } from '@tauri-apps/api/core';
import './PdfViewer.css';
import type { PDFDocumentProxy } from 'pdfjs-dist';
import React, { useRef, useState } from 'react';
import { useRef, useState } from 'react';
import { Document, Page } from 'react-pdf';
import { useContainerSize } from '../../hooks/useContainerQuery';

View File

@@ -1,5 +1,5 @@
import type { HttpResponse } from '@yaakapp-internal/models';
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
interface Props {

View File

@@ -7,8 +7,8 @@ import { useDebouncedValue } from '../../hooks/useDebouncedValue';
import { useFormatText } from '../../hooks/useFormatText';
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
import type { EditorProps } from '../core/Editor/Editor';
import { Editor } from '../core/Editor/LazyEditor';
import { hyperlink } from '../core/Editor/hyperlink/extension';
import { Editor } from '../core/Editor/LazyEditor';
import { IconButton } from '../core/IconButton';
import { Input } from '../core/Input';
@@ -107,7 +107,7 @@ export function TextViewer({ language, text, response, requestId, pretty, classN
return null;
}
let body;
let body: string;
if (isSearching && filterText?.length > 0) {
if (filteredResponse.error) {
body = '';
@@ -133,7 +133,7 @@ export function TextViewer({ language, text, response, requestId, pretty, classN
actions={actions}
extraExtensions={extraExtensions}
// State key for storing fold state
stateKey={'response.body.' + response.id}
stateKey={`response.body.${response.id}`}
/>
);
}
@@ -141,7 +141,7 @@ export function TextViewer({ language, text, response, requestId, pretty, classN
/** Convert \uXXXX to actual Unicode characters */
function decodeUnicodeLiterals(text: string): string {
return text.replace(/\\u([0-9a-fA-F]{4})/g, (_, hex) => {
const charCode = parseInt(hex, 16);
const charCode = Number.parseInt(hex, 16);
return String.fromCharCode(charCode);
});
}

View File

@@ -1,5 +1,4 @@
import { convertFileSrc } from '@tauri-apps/api/core';
import React from 'react';
interface Props {
bodyPath: string;
@@ -8,6 +7,6 @@ interface Props {
export function VideoViewer({ bodyPath }: Props) {
const src = convertFileSrc(bodyPath);
// eslint-disable-next-line jsx-a11y/media-has-caption
return <video className="w-full" controls src={src}></video>;
// biome-ignore lint/a11y/useMediaCaption: none
return <video className="w-full" controls src={src} />;
}

View File

@@ -1,6 +1,6 @@
import type { HttpResponse } from '@yaakapp-internal/models';
import { useMemo } from 'react';
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
import type { HttpResponse } from '@yaakapp-internal/models';
interface Props {
response: HttpResponse;