Run prettier on everything (#104)

This commit is contained in:
Will Chen
2025-05-06 23:02:28 -07:00
committed by GitHub
parent 744ea68ac8
commit 0d56651220
168 changed files with 1980 additions and 1907 deletions

View File

@@ -1,4 +1,3 @@
import { XCircle, AlertTriangle } from "lucide-react"; // Assuming lucide-react is used
interface ChatErrorProps {

View File

@@ -176,7 +176,7 @@ export function ChatInput({ chatId }: { chatId?: number }) {
if (!chatId || !messageId || isApproving || isRejecting || isStreaming)
return;
console.log(
`Approving proposal for chatId: ${chatId}, messageId: ${messageId}`
`Approving proposal for chatId: ${chatId}, messageId: ${messageId}`,
);
setIsApproving(true);
posthog.capture("chat:approve");
@@ -213,7 +213,7 @@ export function ChatInput({ chatId }: { chatId?: number }) {
if (!chatId || !messageId || isApproving || isRejecting || isStreaming)
return;
console.log(
`Rejecting proposal for chatId: ${chatId}, messageId: ${messageId}`
`Rejecting proposal for chatId: ${chatId}, messageId: ${messageId}`,
);
setIsRejecting(true);
posthog.capture("chat:reject");
@@ -771,7 +771,7 @@ function ChatInputActions({
className="flex items-center space-x-2"
onClick={() => {
IpcClient.getInstance().openExternalUrl(
`https://www.npmjs.com/package/${pkg}`
`https://www.npmjs.com/package/${pkg}`,
);
}}
>
@@ -884,7 +884,7 @@ function ProposalSummary({
parts.push(
`${sqlQueries.length} SQL ${
sqlQueries.length === 1 ? "query" : "queries"
}`
}`,
);
}
@@ -892,7 +892,7 @@ function ProposalSummary({
parts.push(
`${serverFunctions.length} Server ${
serverFunctions.length === 1 ? "Function" : "Functions"
}`
}`,
);
}
@@ -900,13 +900,13 @@ function ProposalSummary({
parts.push(
`${packagesAdded.length} ${
packagesAdded.length === 1 ? "package" : "packages"
}`
}`,
);
}
if (filesChanged.length) {
parts.push(
`${filesChanged.length} ${filesChanged.length === 1 ? "file" : "files"}`
`${filesChanged.length} ${filesChanged.length === 1 ? "file" : "files"}`,
);
}

View File

@@ -29,7 +29,7 @@ export const CodeHighlight = memo(
isDarkMode ? githubDark : github,
{
delay: 150,
}
},
);
// Update the cache whenever we get a new highlighted code
@@ -64,5 +64,5 @@ export const CodeHighlight = memo(
},
(prevProps, nextProps) => {
return prevProps.children === nextProps.children;
}
},
);

View File

@@ -56,7 +56,7 @@ export const DyadAddDependency: React.FC<DyadAddDependencyProps> = ({
key={p}
onClick={() => {
IpcClient.getInstance().openExternalUrl(
`https://www.npmjs.com/package/${p}`
`https://www.npmjs.com/package/${p}`,
);
}}
>

View File

@@ -34,8 +34,8 @@ export const DyadExecuteSql: React.FC<DyadExecuteSqlProps> = ({
inProgress
? "border-amber-500"
: aborted
? "border-red-500"
: "border-border"
? "border-red-500"
: "border-border"
}`}
onClick={() => setIsContentVisible(!isContentVisible)}
>

View File

@@ -177,7 +177,7 @@ function parseCustomTags(content: string): ContentPiece[] {
const tagPattern = new RegExp(
`<(${customTagNames.join("|")})\\s*([^>]*)>(.*?)<\\/\\1>`,
"gs"
"gs",
);
const contentPieces: ContentPiece[] = [];
@@ -253,7 +253,7 @@ function getState({
*/
function renderCustomTag(
tagInfo: CustomTagInfo,
{ isStreaming }: { isStreaming: boolean }
{ isStreaming }: { isStreaming: boolean },
): React.ReactNode {
const { tag, attributes, content, inProgress } = tagInfo;

View File

@@ -42,8 +42,8 @@ export const DyadWrite: React.FC<DyadWriteProps> = ({
inProgress
? "border-amber-500"
: aborted
? "border-red-500"
: "border-border"
? "border-red-500"
: "border-border"
}`}
onClick={() => setIsContentVisible(!isContentVisible)}
>

View File

@@ -71,27 +71,27 @@ export const MessagesList = forwardRef<HTMLDivElement, MessagesListProps>(
previousAssistantMessage?.commitHash
) {
console.debug(
"Reverting to previous assistant version"
"Reverting to previous assistant version",
);
await revertVersion({
versionId: previousAssistantMessage.commitHash,
});
const chat = await IpcClient.getInstance().getChat(
selectedChatId
);
const chat =
await IpcClient.getInstance().getChat(
selectedChatId,
);
setMessages(chat.messages);
}
} else {
const chat = await IpcClient.getInstance().getChat(
selectedChatId
);
const chat =
await IpcClient.getInstance().getChat(selectedChatId);
if (chat.initialCommitHash) {
await revertVersion({
versionId: chat.initialCommitHash,
});
const result =
await IpcClient.getInstance().deleteMessages(
selectedChatId
selectedChatId,
);
if (result.success) {
setMessages([]);
@@ -100,7 +100,7 @@ export const MessagesList = forwardRef<HTMLDivElement, MessagesListProps>(
}
} else {
showWarning(
"No initial commit hash found for chat. Need to manually undo code changes"
"No initial commit hash found for chat. Need to manually undo code changes",
);
}
}
@@ -148,27 +148,26 @@ export const MessagesList = forwardRef<HTMLDivElement, MessagesListProps>(
previousAssistantMessage?.commitHash
) {
console.debug(
"Reverting to previous assistant version"
"Reverting to previous assistant version",
);
await revertVersion({
versionId: previousAssistantMessage.commitHash,
});
shouldRedo = false;
} else {
const chat = await IpcClient.getInstance().getChat(
selectedChatId
);
const chat =
await IpcClient.getInstance().getChat(selectedChatId);
if (chat.initialCommitHash) {
console.debug(
"Reverting to initial commit hash",
chat.initialCommitHash
chat.initialCommitHash,
);
await revertVersion({
versionId: chat.initialCommitHash,
});
} else {
showWarning(
"No initial commit hash found for chat. Need to manually undo code changes"
"No initial commit hash found for chat. Need to manually undo code changes",
);
}
}
@@ -212,5 +211,5 @@ export const MessagesList = forwardRef<HTMLDivElement, MessagesListProps>(
<div ref={messagesEndRef} />
</div>
);
}
},
);

View File

@@ -18,7 +18,7 @@ export function VersionPane({ isVisible, onClose }: VersionPaneProps) {
const { versions, loading, refreshVersions, revertVersion } =
useVersions(appId);
const [selectedVersionId, setSelectedVersionId] = useAtom(
selectedVersionIdAtom
selectedVersionIdAtom,
);
useEffect(() => {
// Refresh versions in case the user updated versions outside of the app
@@ -86,20 +86,20 @@ export function VersionPane({ isVisible, onClose }: VersionPaneProps) {
{version.message && (
<p className="mt-1 text-sm">
{version.message.startsWith(
"Reverted all changes back to version "
"Reverted all changes back to version ",
)
? version.message.replace(
/Reverted all changes back to version ([a-f0-9]+)/,
(_, hash) => {
const targetIndex = versions.findIndex(
(v) => v.oid === hash
(v) => v.oid === hash,
);
return targetIndex !== -1
? `Reverted all changes back to version ${
versions.length - targetIndex
}`
: version.message;
}
},
)
: version.message}
</p>
@@ -115,7 +115,7 @@ export function VersionPane({ isVisible, onClose }: VersionPaneProps) {
}}
className={cn(
"invisible mt-1 flex items-center gap-1 px-2 py-0.5 text-sm font-medium bg-(--primary) text-(--primary-foreground) hover:bg-background-lightest rounded-md transition-colors",
selectedVersionId === version.oid && "visible"
selectedVersionId === version.oid && "visible",
)}
aria-label="Undo to latest version"
>