chore: lint fix

ran pnpm lint fix and fixed warnings
This commit is contained in:
Dustin Loring 2025-01-18 08:12:01 -05:00 committed by GitHub
commit adf0cbc502
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 24 additions and 37 deletions

View File

@ -1,10 +1,10 @@
import type { Message } from 'ai'; import type { Message } from 'ai';
import ignore from 'ignore'; import ignore from 'ignore';
import { useState } from 'react';
import { GitCloneDialog } from '~/components/git/GitCloneDialog';
import WithTooltip from '~/components/ui/Tooltip'; import WithTooltip from '~/components/ui/Tooltip';
import { IGNORE_PATTERNS } from '~/constants/ignorePatterns'; import { IGNORE_PATTERNS } from '~/constants/ignorePatterns';
import { useGit } from '~/lib/hooks/useGit'; import { useGit } from '~/lib/hooks/useGit';
import { useState } from 'react';
import { GitCloneDialog } from '~/components/git/GitCloneDialog';
const ig = ignore().add(IGNORE_PATTERNS); const ig = ignore().add(IGNORE_PATTERNS);
const generateId = () => Math.random().toString(36).substring(2, 15); const generateId = () => Math.random().toString(36).substring(2, 15);
@ -74,11 +74,7 @@ ${textDecoder.decode(content)}
</button> </button>
</WithTooltip> </WithTooltip>
<GitCloneDialog <GitCloneDialog isOpen={showDialog} onClose={() => setShowDialog(false)} onClone={handleClone} />
isOpen={showDialog}
onClose={() => setShowDialog(false)}
onClone={handleClone}
/>
</> </>
); );
} }

View File

@ -1,7 +1,6 @@
import { useState } from 'react'; import { useState } from 'react';
import { Dialog, DialogButton, DialogDescription, DialogRoot, DialogTitle } from '~/components/ui/Dialog';
import { useGit } from '~/lib/hooks/useGit';
import { toast } from 'react-toastify'; import { toast } from 'react-toastify';
import { Dialog, DialogButton, DialogDescription, DialogRoot, DialogTitle } from '~/components/ui/Dialog';
interface GitCloneDialogProps { interface GitCloneDialogProps {
isOpen: boolean; isOpen: boolean;
@ -19,15 +18,15 @@ export function GitCloneDialog({ isOpen, onClose, onClone }: GitCloneDialogProps
e.preventDefault(); e.preventDefault();
setIsLoading(true); setIsLoading(true);
try { try {
// If it's a private repo, construct the URL with the token // if it's a private repo, construct the URL with the token
const cloneUrl = isPrivate const cloneUrl = isPrivate ? repoUrl.replace('https://', `https://${token}@`) : repoUrl;
? repoUrl.replace('https://', `https://${token}@`)
: repoUrl;
if (onClone) { if (onClone) {
await onClone(cloneUrl); await onClone(cloneUrl);
} }
toast.success('Repository cloned successfully!'); toast.success('Repository cloned successfully!');
onClose(); onClose();
} catch (error) { } catch (error) {
@ -45,21 +44,11 @@ export function GitCloneDialog({ isOpen, onClose, onClone }: GitCloneDialogProps
<form onSubmit={handleSubmit} className="space-y-4"> <form onSubmit={handleSubmit} className="space-y-4">
<div className="flex items-center gap-4 mb-4"> <div className="flex items-center gap-4 mb-4">
<label className="flex items-center gap-2"> <label className="flex items-center gap-2">
<input <input type="radio" checked={!isPrivate} onChange={() => setIsPrivate(false)} className="form-radio" />
type="radio"
checked={!isPrivate}
onChange={() => setIsPrivate(false)}
className="form-radio"
/>
<span>Public Repository</span> <span>Public Repository</span>
</label> </label>
<label className="flex items-center gap-2"> <label className="flex items-center gap-2">
<input <input type="radio" checked={isPrivate} onChange={() => setIsPrivate(true)} className="form-radio" />
type="radio"
checked={isPrivate}
onChange={() => setIsPrivate(true)}
className="form-radio"
/>
<span>Private Repository</span> <span>Private Repository</span>
</label> </label>
</div> </div>
@ -107,4 +96,4 @@ export function GitCloneDialog({ isOpen, onClose, onClone }: GitCloneDialogProps
</Dialog> </Dialog>
</DialogRoot> </DialogRoot>
); );
} }

View File

@ -1,5 +1,5 @@
import React from 'react';
import type { ReactElement } from 'react'; import type { ReactElement } from 'react';
import React from 'react';
import { memo } from 'react'; import { memo } from 'react';
import { classNames } from '~/utils/classNames'; import { classNames } from '~/utils/classNames';

View File

@ -1,5 +1,5 @@
import React from 'react';
import type { ReactElement } from 'react'; import type { ReactElement } from 'react';
import React from 'react';
import { memo } from 'react'; import { memo } from 'react';
import { classNames } from '~/utils/classNames'; import { classNames } from '~/utils/classNames';

View File

@ -1,10 +1,10 @@
import React from 'react';
import { motion } from 'framer-motion'; import { motion } from 'framer-motion';
import React from 'react';
import { memo } from 'react'; import { memo } from 'react';
import type { ReactElement } from 'react';
import { classNames } from '~/utils/classNames'; import { classNames } from '~/utils/classNames';
import { cubicEasingFn } from '~/utils/easings'; import { cubicEasingFn } from '~/utils/easings';
import { genericMemo } from '~/utils/react'; import { genericMemo } from '~/utils/react';
import type { ReactElement } from 'react';
interface SliderOption<T> { interface SliderOption<T> {
value: T; value: T;

View File

@ -2,10 +2,10 @@ import * as nodePath from 'node:path';
import { WebContainer } from '@webcontainer/api'; import { WebContainer } from '@webcontainer/api';
import { map, type MapStore } from 'nanostores'; import { map, type MapStore } from 'nanostores';
import type { ActionCallbackData } from './message-parser'; import type { ActionCallbackData } from './message-parser';
import { workbenchStore } from '~/lib/stores/workbench';
import type { BoltAction } from '~/types/actions'; import type { BoltAction } from '~/types/actions';
import { createScopedLogger } from '~/utils/logger'; import { createScopedLogger } from '~/utils/logger';
import { unreachable } from '~/utils/unreachable'; import { unreachable } from '~/utils/unreachable';
import { workbenchStore } from '~/lib/stores/workbench';
const logger = createScopedLogger('ActionRunner'); const logger = createScopedLogger('ActionRunner');
@ -129,7 +129,7 @@ export class ActionRunner {
const webcontainer = await this.#webcontainer; const webcontainer = await this.#webcontainer;
// Write the command to the Bolt terminal // write the command to the Bolt terminal
workbenchStore.writeToBoltTerminal(`\x1b[1;34m$ ${action.content}\x1b[0m\n`); workbenchStore.writeToBoltTerminal(`\x1b[1;34m$ ${action.content}\x1b[0m\n`);
const process = await webcontainer.spawn('jsh', ['-c', action.content], { const process = await webcontainer.spawn('jsh', ['-c', action.content], {
@ -153,7 +153,9 @@ export class ActionRunner {
const exitCode = await process.exit; const exitCode = await process.exit;
logger.debug(`Process terminated with code ${exitCode}`); logger.debug(`Process terminated with code ${exitCode}`);
workbenchStore.writeToBoltTerminal(`\x1b[1;${exitCode === 0 ? '32' : '31'}mProcess exited with code ${exitCode}\x1b[0m\n\n`); workbenchStore.writeToBoltTerminal(
`\x1b[1;${exitCode === 0 ? '32' : '31'}mProcess exited with code ${exitCode}\x1b[0m\n\n`,
);
} }
async #runFileAction(action: ActionState) { async #runFileAction(action: ActionState) {
@ -168,7 +170,7 @@ export class ActionRunner {
// remove trailing slashes // remove trailing slashes
folder = folder.replace(/\/+$/g, ''); folder = folder.replace(/\/+$/g, '');
// Write file creation to Bolt terminal // write file creation to Bolt terminal
workbenchStore.writeToBoltTerminal(`\x1b[1;34mCreating file: ${action.filePath}\x1b[0m\n`); workbenchStore.writeToBoltTerminal(`\x1b[1;34mCreating file: ${action.filePath}\x1b[0m\n`);
if (folder !== '.') { if (folder !== '.') {

View File

@ -42,4 +42,4 @@ export class BoltTerminalStore {
this.#terminal.terminal.write(data); this.#terminal.terminal.write(data);
} }
} }
} }

View File

@ -1,9 +1,9 @@
import { atom, map, type MapStore, type ReadableAtom, type WritableAtom } from 'nanostores'; import { atom, map, type MapStore, type ReadableAtom, type WritableAtom } from 'nanostores';
import { BoltTerminalStore } from './bolt-terminal';
import { EditorStore } from './editor'; import { EditorStore } from './editor';
import { FilesStore, type FileMap } from './files'; import { FilesStore, type FileMap } from './files';
import { PreviewsStore } from './previews'; import { PreviewsStore } from './previews';
import { TerminalStore } from './terminal'; import { TerminalStore } from './terminal';
import { BoltTerminalStore } from './bolt-terminal';
import type { EditorDocument, ScrollPosition } from '~/components/editor/codemirror/CodeMirrorEditor'; import type { EditorDocument, ScrollPosition } from '~/components/editor/codemirror/CodeMirrorEditor';
import { ActionRunner } from '~/lib/runtime/action-runner'; import { ActionRunner } from '~/lib/runtime/action-runner';
import type { ActionCallbackData, ArtifactCallbackData } from '~/lib/runtime/message-parser'; import type { ActionCallbackData, ArtifactCallbackData } from '~/lib/runtime/message-parser';

View File

@ -1,4 +1,4 @@
import type { ComponentProps, ComponentType, JSXElementConstructor } from 'react'; import type { ComponentProps, ComponentType } from 'react';
import { memo } from 'react'; import { memo } from 'react';
export const genericMemo: <T extends ComponentType<any>>( export const genericMemo: <T extends ComponentType<any>>(