Skip to content

Commit 578ae83

Browse files
committed
refactor: Migrate linting and formatting to Biome and apply general code style improvements.
1 parent abc0253 commit 578ae83

File tree

12 files changed

+85
-68
lines changed

12 files changed

+85
-68
lines changed

apps/mobile/@types/components.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// import { nativeComponents } from '@creatorem/ai-react-native/native-components';
2-
import { appNativeComponents } from '../components/ai-chat/components-provider';
2+
import { appNativeComponents } from "../components/ai-chat/components-provider";
33

44
// export type RuntimeComponents = typeof nativeComponents & typeof appNativeComponents;
5-
export type RuntimeComponents = typeof appNativeComponents;
5+
export type RuntimeComponents = typeof appNativeComponents;

apps/mobile/@types/uniwind.d.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import 'uniwind';
2-
import { ThemeVariable } from '~/components/context/theme-provider';
1+
import "uniwind";
2+
import { ThemeVariable } from "~/components/context/theme-provider";
33

4-
5-
declare module 'uniwind' {
6-
export const useCSSVariable: (varName: ThemeVariable) => string
4+
declare module "uniwind" {
5+
export const useCSSVariable: (varName: ThemeVariable) => string;
76
}
8-
9-
export {}

apps/mobile/app.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
2929
// for native tabs
3030
softwareKeyboardLayoutMode: "pan",
3131
adaptiveIcon: {
32-
foregroundImage: './assets/pwa-logo/apple-icon-180.png',
32+
foregroundImage: "./assets/pwa-logo/apple-icon-180.png",
3333
backgroundColor: "#ffffff",
3434
},
3535
package: "com.creatorem.ai.chat.demo",

apps/mobile/app/(drawer)/_layout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { useCSSVariable } from "uniwind";
1313
import { fetch as expoFetch } from "expo/fetch";
1414
import { appNativeComponents } from "~/components/ai-chat/components-provider";
1515

16-
1716
export const drawerRef = React.createRef();
1817

1918
export default function RootLayout() {

apps/mobile/babel.config.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
module.exports = {
2-
presets: ["babel-preset-expo"],
3-
plugins: [
4-
// Worklets plugin must be listed last.
5-
"react-native-worklets/plugin",
6-
],
7-
};
1+
module.exports = {
2+
presets: ["babel-preset-expo"],
3+
plugins: [
4+
// Worklets plugin must be listed last.
5+
"react-native-worklets/plugin",
6+
],
7+
};

apps/mobile/components/ai-chat/attachment.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ const AttachmentUI: FC<{ noRemoveButton?: boolean }> = ({ noRemoveButton }) => {
7474

7575
export const UserMessageAttachments: FC = () => {
7676
return (
77-
<MessagePrimitive.Attachments
78-
className="col-span-full col-start-1 row-start-1 mb-2 flex h-32 w-full flex-row justify-end gap-2"
79-
components={{ Attachment: AttachmentUI }}
80-
componentProps={{ noRemoveButton: true }}
81-
/>
77+
<MessagePrimitive.Attachments
78+
className="col-span-full col-start-1 row-start-1 mb-2 flex h-32 w-full flex-row justify-end gap-2"
79+
components={{ Attachment: AttachmentUI }}
80+
componentProps={{ noRemoveButton: true }}
81+
/>
8282
);
8383
};
8484

apps/mobile/components/ai-chat/markdown-text.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ const defaultComponents = {
9191
</Text>
9292
),
9393
h5: ({ children }) => (
94-
<Text className={cn("mt-4 mb-2 font-semibold text-lg first:mt-0 last:mb-0")}>
94+
<Text
95+
className={cn("mt-4 mb-2 font-semibold text-lg first:mt-0 last:mb-0")}
96+
>
9597
{children}
9698
</Text>
9799
),
@@ -109,23 +111,21 @@ const defaultComponents = {
109111
{children}
110112
</Link>
111113
),
112-
strong: ({ children }) => (
113-
<Text className={cn("font-bold")}>{children}</Text>
114-
),
114+
strong: ({ children }) => <Text className={cn("font-bold")}>{children}</Text>,
115115
blockquote: ({ children }) => (
116116
<Text className={cn("border-l-2 pl-6 italic")}>{children}</Text>
117117
),
118118
ul: ({ children }) => (
119-
<View className={cn("my-5 flex gap-4 flex-col")}>{children}</View>
119+
<View className={cn("my-5 flex flex-col gap-4")}>{children}</View>
120120
),
121121
li: ({ children }) => (
122122
<View className="flex flex-row items-start gap-4">
123-
<View className="bg-foreground mt-2.5 h-2 w-2 rounded-full" />
123+
<View className="mt-2.5 h-2 w-2 rounded-full bg-foreground" />
124124
<Text className="leading-7">{children}</Text>
125125
</View>
126126
),
127127
ol: ({ children }) => (
128-
<Text className={cn("my-5 flex gap-4 flex-col")}>{children}</Text>
128+
<Text className={cn("my-5 flex flex-col gap-4")}>{children}</Text>
129129
),
130130
hr: () => <View className={cn("my-5 border-b")} />,
131131
table: ({ children }) => (
@@ -168,7 +168,10 @@ const defaultComponents = {
168168
return (
169169
<View className="translate-y-[15px]">
170170
<Text
171-
className={cn(!isCodeBlock && "rounded-lg border px-1 border-input leading-6 bg-muted font-semibold")}
171+
className={cn(
172+
!isCodeBlock &&
173+
"rounded-lg border border-input bg-muted px-1 font-semibold leading-6",
174+
)}
172175
>
173176
{children}
174177
</Text>

apps/mobile/components/ai-chat/thread-list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const ThreadListNew: FC = () => {
3333
return (
3434
<ThreadListPrimitive.New
3535
variant="ghost"
36-
className="mb-4 h-12 bg-muted justify-start gap-2 rounded-xl px-3 text-sm hover:bg-background data-active:bg-muted"
36+
className="mb-4 h-12 justify-start gap-2 rounded-xl bg-muted px-3 text-sm hover:bg-background data-active:bg-muted"
3737
onPress={() => {
3838
setDrawerOpen(false);
3939
}}

apps/mobile/components/ai-chat/thread.tsx

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -127,25 +127,25 @@ const SUGGESTIONS: {
127127
prompt: string;
128128
icon: IconName;
129129
}[] = [
130-
{
131-
title: "Short prompt",
132-
label: "like 100 words",
133-
prompt: "Summarize the second world war in 100 words",
134-
icon: "Bell",
135-
},
136-
{
137-
title: "What's the weather",
138-
label: "in San Francisco?",
139-
prompt: "What's the weather in San Francisco?",
140-
icon: "Bell",
141-
},
142-
{
143-
title: "Explain React hooks",
144-
label: "like useState and useEffect",
145-
prompt: "Explain React hooks like useState and useEffect",
146-
icon: "Code",
147-
},
148-
];
130+
{
131+
title: "Short prompt",
132+
label: "like 100 words",
133+
prompt: "Summarize the second world war in 100 words",
134+
icon: "Bell",
135+
},
136+
{
137+
title: "What's the weather",
138+
label: "in San Francisco?",
139+
prompt: "What's the weather in San Francisco?",
140+
icon: "Bell",
141+
},
142+
{
143+
title: "Explain React hooks",
144+
label: "like useState and useEffect",
145+
prompt: "Explain React hooks like useState and useEffect",
146+
icon: "Code",
147+
},
148+
];
149149

150150
const ThreadSuggestions: FC = () => {
151151
return (
@@ -300,9 +300,9 @@ const ModelSelector: React.FC = () => {
300300
};
301301

302302
const ToolsSelector: React.FC = () => {
303-
return (
303+
return (
304304
<>
305-
<ComposerPrimitive.SelectTools
305+
<ComposerPrimitive.SelectTools
306306
header={
307307
<>
308308
<Divider />
@@ -313,21 +313,36 @@ const ToolsSelector: React.FC = () => {
313313
<Pressable className="flex-1 active:opacity-50" onPress={toggle}>
314314
<View className="flex-1 p-2">
315315
<View className="mb-1 flex flex-row gap-2 text-lg">
316-
<Text className={cn("font-bold", isEnabled ? "text-cyan-500" : "")}>{toolName.replace(/-/g, ' ').replace(/\b\w/g, c => c.toUpperCase())}</Text>
316+
<Text
317+
className={cn("font-bold", isEnabled ? "text-cyan-500" : "")}
318+
>
319+
{toolName
320+
.replace(/-/g, " ")
321+
.replace(/\b\w/g, (c) => c.toUpperCase())}
322+
</Text>
317323
<Icon name="Brain" size={20} />
318324
</View>
319-
<Text className={cn("text-muted-foreground text-sm", isEnabled ? "text-cyan-500" : "")}>
325+
<Text
326+
className={cn(
327+
"text-muted-foreground text-sm",
328+
isEnabled ? "text-cyan-500" : "",
329+
)}
330+
>
320331
Groundbreaking advancements in reasoning
321332
</Text>
322333
</View>
323334
{isEnabled && (
324-
<Icon name="Check" size={20} color={isEnabled ? "#00b8db" : undefined} />
335+
<Icon
336+
name="Check"
337+
size={20}
338+
color={isEnabled ? "#00b8db" : undefined}
339+
/>
325340
)}
326-
327341
</Pressable>
328-
)} />
342+
)}
343+
/>
329344
</>
330-
);
345+
);
331346
};
332347

333348
const ComposerAction: FC = () => {

apps/mobile/components/tools/weather-tool-ui.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ export const WeatherToolRegistration: FC = () => {
125125
useToolUI({
126126
toolName: "weather",
127127
display: {
128-
icon: 'CloudSun' as IconName,
129-
title: 'Weather',
130-
description: 'Get the weather forecast for a location',
128+
icon: "CloudSun" as IconName,
129+
title: "Weather",
130+
description: "Get the weather forecast for a location",
131131
},
132132
render: WeatherToolCard,
133133
});

0 commit comments

Comments
 (0)