Skip to content

Commit f4e4634

Browse files
committed
chore: format & lint
1 parent b055a17 commit f4e4634

69 files changed

Lines changed: 1783 additions & 2012 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

webapp/_webapp/eslint.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import reactRefresh from "eslint-plugin-react-refresh";
55
import tseslint from "typescript-eslint";
66

77
export default tseslint.config(
8-
{ ignores: ["dist", "src/pkg/gen"] },
8+
{ ignores: ["dist", "src/pkg/gen", "**/*.test.{ts,tsx}"] },
99
{
1010
extends: [js.configs.recommended, ...tseslint.configs.recommended],
1111
files: ["**/*.{ts,tsx}"],
@@ -20,7 +20,7 @@ export default tseslint.config(
2020
rules: {
2121
...reactHooks.configs.recommended.rules,
2222
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
23-
"no-console": "error",
23+
"no-console": ["error", { allow: ["warn", "error"] }],
2424
"@typescript-eslint/no-unused-vars": [
2525
"error",
2626
{

webapp/_webapp/src/adapters/context.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,3 @@ export function useAdapter(): DocumentAdapter {
3737
export function useAdapterOptional(): DocumentAdapter | null {
3838
return useContext(AdapterContext);
3939
}
40-

webapp/_webapp/src/adapters/document-adapter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,3 @@ export function getOverleafAdapter(): OverleafAdapter {
138138
}
139139
return overleafAdapterInstance;
140140
}
141-

webapp/_webapp/src/adapters/index.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@
88
*/
99

1010
// Types
11-
export type {
12-
DocumentAdapter,
13-
SelectionInfo,
14-
AdapterProps,
15-
StorageAdapter,
16-
} from "./types";
11+
export type { DocumentAdapter, SelectionInfo, AdapterProps, StorageAdapter } from "./types";
1712

1813
// Context and hooks
1914
export { AdapterProvider, useAdapter, useAdapterOptional } from "./context";
@@ -22,8 +17,4 @@ export { AdapterProvider, useAdapter, useAdapterOptional } from "./context";
2217
export { OverleafAdapter, getOverleafAdapter } from "./document-adapter";
2318

2419
// Storage Adapter Implementations
25-
export {
26-
LocalStorageAdapter,
27-
MemoryStorageAdapter,
28-
createStorageAdapter,
29-
} from "./storage-adapter";
20+
export { LocalStorageAdapter, MemoryStorageAdapter, createStorageAdapter } from "./storage-adapter";

webapp/_webapp/src/background.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ const registerContentScriptsIfPermitted = async () => {
8989
}
9090
await registerContentScripts(origins);
9191
} catch (error) {
92-
// eslint-disable-next-line no-console
9392
console.error("[PaperDebugger] Unable to register content scripts", error);
9493
}
9594
};

webapp/_webapp/src/components/loading-indicator.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,14 @@ export const LoadingIndicator = ({ text = "Thinking", estimatedSeconds = 0, erro
6767
// 1x = standard duration. 2x = half duration.
6868
const getSpeedMultiplier = (currentPhase: Phase) => {
6969
switch (currentPhase) {
70-
case "green": return 1; // Takes full duration
71-
case "orange": return 2; // Takes half duration (50%)
72-
case "red": return 2; // Takes half duration (50%)
73-
default: return 1;
70+
case "green":
71+
return 1; // Takes full duration
72+
case "orange":
73+
return 2; // Takes half duration (50%)
74+
case "red":
75+
return 2; // Takes half duration (50%)
76+
default:
77+
return 1;
7478
}
7579
};
7680

@@ -88,7 +92,7 @@ export const LoadingIndicator = ({ text = "Thinking", estimatedSeconds = 0, erro
8892

8993
// Calculate progress with natural fluctuation
9094
const speedMultiplier = getSpeedMultiplier(phase);
91-
// the math
95+
// the math
9296
const baseIncrement = (deltaTime / (estimatedSeconds * 1000)) * 100 * speedMultiplier;
9397
const fluctuation = baseIncrement * (Math.random() - 0.5);
9498
const increment = Math.max(0, baseIncrement + fluctuation);

webapp/_webapp/src/components/markdown.tsx

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,52 +13,42 @@ interface MarkdownComponentProps {
1313
}
1414

1515
const MarkdownComponent = memo(({ children, animated }: MarkdownComponentProps) => {
16-
return <Streamdown
17-
className="space-y-1 leading-[1.50]"
18-
shikiTheme={["github-light", "ayu-dark"]}
19-
components={{
20-
h1: ({ children }) => (
21-
<h1 className="text-lg font-bold mt-2 !text-default-800 dark:!text-default-800">
22-
{children}
23-
</h1>
24-
),
16+
return (
17+
<Streamdown
18+
className="space-y-1 leading-[1.50]"
19+
shikiTheme={["github-light", "ayu-dark"]}
20+
components={{
21+
h1: ({ children }) => (
22+
<h1 className="text-lg font-bold mt-2 !text-default-800 dark:!text-default-800">{children}</h1>
23+
),
2524

26-
h2: ({ children }) => (
27-
<h2 className="text-base font-bold mt-2 mb-1 !text-default-800 dark:!text-default-800">
28-
{children}
29-
</h2>
30-
),
25+
h2: ({ children }) => (
26+
<h2 className="text-base font-bold mt-2 mb-1 !text-default-800 dark:!text-default-800">{children}</h2>
27+
),
3128

32-
h3: ({ children }) => (
33-
<h3 className="text-sm font-bold mt-2 !text-default-800 dark:!text-default-800">
34-
{children}
35-
</h3>
36-
),
37-
38-
h4: ({ children }) => (
39-
<h4 className="text-xs font-bold mt-2 !text-default-800 dark:!text-default-800">
40-
{children}
41-
</h4>
42-
),
29+
h3: ({ children }) => (
30+
<h3 className="text-sm font-bold mt-2 !text-default-800 dark:!text-default-800">{children}</h3>
31+
),
4332

44-
h5: ({ children }) => (
45-
<h5 className="text-xs font-bold mt-2 !text-default-800 dark:!text-default-800">
46-
{children}
47-
</h5>
48-
),
49-
50-
h6: ({ children }) => (
51-
<h6 className="text-xs font-bold mt-2 !text-default-800 dark:!text-default-800">
52-
{children}
53-
</h6>
54-
),
55-
}}
56-
plugins={{ code, mermaid, math, cjk }}
57-
isAnimating={animated}
58-
linkSafety={{ enabled: false }}
33+
h4: ({ children }) => (
34+
<h4 className="text-xs font-bold mt-2 !text-default-800 dark:!text-default-800">{children}</h4>
35+
),
36+
37+
h5: ({ children }) => (
38+
<h5 className="text-xs font-bold mt-2 !text-default-800 dark:!text-default-800">{children}</h5>
39+
),
40+
41+
h6: ({ children }) => (
42+
<h6 className="text-xs font-bold mt-2 !text-default-800 dark:!text-default-800">{children}</h6>
43+
),
44+
}}
45+
plugins={{ code, mermaid, math, cjk }}
46+
isAnimating={animated}
47+
linkSafety={{ enabled: false }}
5948
>
60-
{children}
61-
</Streamdown>
49+
{children}
50+
</Streamdown>
51+
);
6252

6353
// return <Markdown options={markdownOptions}>{children}</Markdown>;
6454
});

webapp/_webapp/src/components/message-entry-container/assistant.tsx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ const parseMessage = (message: string): ParsedMessage => {
1818
const regex = /<PaperDebugger>([\s\S]*?)<\/PaperDebugger>/g;
1919
const paperDebuggerContents: string[] = [];
2020
let regularContent = message;
21-
21+
2222
// Extract all PaperDebugger blocks
2323
regularContent = message.replace(regex, (_, content) => {
2424
const processedContent = content.replace(/\n/g, "§NEWLINE§");
2525
paperDebuggerContents.push(processedContent);
2626
return ""; // Remove the tag from regular content
2727
});
28-
28+
2929
return {
3030
regularContent: regularContent.trim(),
3131
paperDebuggerContent: paperDebuggerContents,
@@ -86,7 +86,10 @@ export const AssistantMessageContainer = ({
8686
}
8787
}, [user?.id, projectId, message, messageId]);
8888

89-
const showMessage = (parsedMessage.regularContent?.length ?? 0) > 0 || parsedMessage.paperDebuggerContent.length > 0 || (reasoning?.length ?? 0) > 0;
89+
const showMessage =
90+
(parsedMessage.regularContent?.length ?? 0) > 0 ||
91+
parsedMessage.paperDebuggerContent.length > 0 ||
92+
(reasoning?.length ?? 0) > 0;
9093
const staleComponent = stale && <div className="message-box-stale-description">This message is stale.</div>;
9194
const writingIndicator =
9295
stale || !showMessage ? null : (
@@ -103,15 +106,14 @@ export const AssistantMessageContainer = ({
103106
);
104107

105108
const reasoningComponent = reasoning && (
106-
<GeneralToolCard
107-
functionName="reasoning"
108-
message={reasoning}
109-
animated={animated}
110-
isCollapsed={isReasoningCollapsed}
111-
onToggleCollapse={() => setIsReasoningCollapsed(!isReasoningCollapsed)}
112-
isLoading={preparing}
113-
/>
114-
109+
<GeneralToolCard
110+
functionName="reasoning"
111+
message={reasoning}
112+
animated={animated}
113+
isCollapsed={isReasoningCollapsed}
114+
onToggleCollapse={() => setIsReasoningCollapsed(!isReasoningCollapsed)}
115+
isLoading={preparing}
116+
/>
115117
);
116118
return (
117119
showMessage && (
@@ -128,7 +130,7 @@ export const AssistantMessageContainer = ({
128130
{parsedMessage.regularContent}
129131
</MarkdownComponent>
130132
)}
131-
133+
132134
{/* PaperDebugger blocks */}
133135
{parsedMessage.paperDebuggerContent.map((content, index) => (
134136
<TextPatches key={index} attachment={prevAttachment}>
@@ -142,17 +144,17 @@ export const AssistantMessageContainer = ({
142144
{/* Stale message */}
143145
{staleComponent}
144146

145-
{ ((parsedMessage.regularContent?.length || 0) > 0 || parsedMessage.paperDebuggerContent.length > 0) &&
146-
<div className="actions rnd-cancel noselect">
147-
<Tooltip content="Copy" placement="bottom" size="sm" delay={1000}>
148-
<span onClick={handleCopy} tabIndex={0} role="button" aria-label="Copy message">
149-
<Icon icon={copySuccess ? "tabler:copy-check" : "tabler:copy"} className="icon" />
150-
</span>
151-
</Tooltip>
152-
</div>}
147+
{((parsedMessage.regularContent?.length || 0) > 0 || parsedMessage.paperDebuggerContent.length > 0) && (
148+
<div className="actions rnd-cancel noselect">
149+
<Tooltip content="Copy" placement="bottom" size="sm" delay={1000}>
150+
<span onClick={handleCopy} tabIndex={0} role="button" aria-label="Copy message">
151+
<Icon icon={copySuccess ? "tabler:copy-check" : "tabler:copy"} className="icon" />
152+
</span>
153+
</Tooltip>
154+
</div>
155+
)}
153156
</div>
154157
</div>
155158
)
156159
);
157160
};
158-

webapp/_webapp/src/components/message-entry-container/attachment-popover.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import { STYLES } from "../message-card";
55
export const AttachmentPopover = ({ attachment }: { attachment: string }) => (
66
<Popover placement="bottom" showArrow={true} className="!mt-1">
77
<PopoverTrigger className="bg-gray-200 dark:!bg-default-200 !rounded-xl !flex !w-fit mt-1 noselect">
8-
<span className="!text-xs !text-gray-400 dark:text-default-500 border !border-gray-300 dark:!border-default-300 !rounded-lg !px-1">attachment</span>
8+
<span className="!text-xs !text-gray-400 dark:text-default-500 border !border-gray-300 dark:!border-default-300 !rounded-lg !px-1">
9+
attachment
10+
</span>
911
</PopoverTrigger>
1012
<PopoverContent className={STYLES.attachment.content}>
1113
<div className="!px-1 !py-2" style={{ overflowWrap: "anywhere" }}>

webapp/_webapp/src/components/message-entry-container/tools/error.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ type ErrorToolCardProps = {
77
};
88

99
export const ErrorToolCard = ({ functionName, errorMessage, animated }: ErrorToolCardProps) => {
10-
return <GeneralToolCard
11-
functionName={"Error in " + functionName}
12-
message={errorMessage}
13-
animated={animated}
14-
isLoading={animated}
15-
/>;
10+
return (
11+
<GeneralToolCard
12+
functionName={"Error in " + functionName}
13+
message={errorMessage}
14+
animated={animated}
15+
isLoading={animated}
16+
/>
17+
);
1618
};

0 commit comments

Comments
 (0)