Skip to content

Commit 530c7a2

Browse files
authored
reapply prettier globally (js/tsx) (#214)
1 parent 4eacf3a commit 530c7a2

File tree

11 files changed

+73
-51
lines changed

11 files changed

+73
-51
lines changed

apps/obsidian/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ export type Settings = {
2727
nodesFolderPath: string;
2828
};
2929

30-
export const VIEW_TYPE_DISCOURSE_CONTEXT = "discourse-context-view";
30+
export const VIEW_TYPE_DISCOURSE_CONTEXT = "discourse-context-view";

apps/obsidian/src/utils/createNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,4 @@ export const createDiscourseNode = async ({
138138
}
139139

140140
return newFile;
141-
};
141+
};

apps/roam/src/components/DiscourseNodeSearchMenu.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,5 +552,4 @@ export const NodeSearchMenuTriggerSetting = ({
552552
);
553553
};
554554

555-
556555
export default NodeSearchMenu;

apps/website/app/(home)/blog/[slug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const generateStaticParams = async () => {
7979
);
8080

8181
const publishedFiles = results
82-
.filter((result) => result.status === 'fulfilled')
82+
.filter((result) => result.status === "fulfilled")
8383
.map((result) => result.value);
8484

8585
return publishedFiles

apps/website/app/api/supabase/agent-identifier/route.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,27 @@ import { TablesInsert, Constants } from "@repo/database/types.gen.ts";
1313
type AgentIdentifierDataInput = TablesInsert<"AgentIdentifier">;
1414
const { AgentIdentifierType } = Constants.public.Enums;
1515

16-
const agentIdentifierValidator: ItemValidator<AgentIdentifierDataInput> = (agent_identifier: any) => {
16+
const agentIdentifierValidator: ItemValidator<AgentIdentifierDataInput> = (
17+
agent_identifier: any,
18+
) => {
1719
if (!agent_identifier || typeof agent_identifier !== "object")
1820
return "Invalid request body: expected a JSON object.";
19-
const {
20-
identifier_type,
21-
account_id,
22-
value,
23-
trusted,
24-
} = agent_identifier;
21+
const { identifier_type, account_id, value, trusted } = agent_identifier;
2522

2623
if (!AgentIdentifierType.includes(identifier_type))
2724
return "Invalid identifier_type";
2825
if (!value || typeof value !== "string" || value.trim() === "")
2926
return "Missing or invalid value";
3027
if (!account_id || Number.isNaN(Number.parseInt(account_id, 10)))
3128
return "Missing or invalid account_id";
32-
if (trusted !== undefined && !["true", "false", true, false].includes(trusted))
29+
if (
30+
trusted !== undefined &&
31+
!["true", "false", true, false].includes(trusted)
32+
)
3333
return "if included, trusted should be a boolean";
3434

35-
const keys = [ 'identifier_type', 'account_id', 'value', 'trusted' ];
36-
if (!Object.keys(agent_identifier).every((key)=>keys.includes(key)))
35+
const keys = ["identifier_type", "account_id", "value", "trusted"];
36+
if (!Object.keys(agent_identifier).every((key) => keys.includes(key)))
3737
return "Invalid agent_identifier object: extra keys";
3838
return null;
3939
};

apps/website/app/api/supabase/platform-account/route.ts

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,65 @@ const { AgentType, Platform } = Constants.public.Enums;
1414

1515
type PlatformAccountDataInput = TablesInsert<"PlatformAccount">;
1616

17-
const accountValidator: ItemValidator<PlatformAccountDataInput> = (account: any) => {
17+
const accountValidator: ItemValidator<PlatformAccountDataInput> = (
18+
account: any,
19+
) => {
1820
if (!account || typeof account !== "object")
1921
return "Invalid request body: expected a JSON object.";
20-
const { name, platform, account_local_id, write_permission, active, agent_type, metadata, dg_account } = account;
22+
const {
23+
name,
24+
platform,
25+
account_local_id,
26+
write_permission,
27+
active,
28+
agent_type,
29+
metadata,
30+
dg_account,
31+
} = account;
2132

2233
if (!name || typeof name !== "string" || name.trim() === "")
2334
return "Missing or invalid name";
2435
// This is not dry, to be rewritten with Drizzle/Zed.
25-
if (!Platform.includes(platform))
26-
return "Missing or invalid platform";
36+
if (!Platform.includes(platform)) return "Missing or invalid platform";
2737
if (agent_type !== undefined && !AgentType.includes(agent_type))
2838
return "Invalid agent_type";
29-
if (write_permission !== undefined && typeof write_permission != 'boolean')
39+
if (write_permission !== undefined && typeof write_permission != "boolean")
3040
return "write_permission must be boolean";
31-
if (active !== undefined && typeof active != 'boolean')
41+
if (active !== undefined && typeof active != "boolean")
3242
return "active must be boolean";
3343
if (metadata !== undefined) {
34-
if (typeof metadata != 'string')
35-
return "metadata should be a JSON string";
36-
else try {
37-
JSON.parse(metadata)
38-
} catch (error) {
39-
return "metadata should be a JSON string";
40-
}
44+
if (typeof metadata != "string") return "metadata should be a JSON string";
45+
else
46+
try {
47+
JSON.parse(metadata);
48+
} catch (error) {
49+
return "metadata should be a JSON string";
50+
}
4151
}
42-
if (!account_local_id || typeof account_local_id != "string" || account_local_id.trim() === "")
52+
if (
53+
!account_local_id ||
54+
typeof account_local_id != "string" ||
55+
account_local_id.trim() === ""
56+
)
4357
return "Missing or invalid account_local_id";
4458
if (dg_account != undefined) {
4559
if (typeof dg_account != "string")
4660
return "dg_account should be a UUID string";
47-
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
48-
if (!uuidRegex.test(dg_account))
49-
return "dg_account must be a valid UUID";
61+
const uuidRegex =
62+
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
63+
if (!uuidRegex.test(dg_account)) return "dg_account must be a valid UUID";
5064
}
51-
const keys = [ 'name', 'platform', 'account_local_id', 'write_permission', 'active', 'agent_type', 'metadata', 'dg_account' ];
52-
if (!Object.keys(account).every((key)=>keys.includes(key)))
65+
const keys = [
66+
"name",
67+
"platform",
68+
"account_local_id",
69+
"write_permission",
70+
"active",
71+
"agent_type",
72+
"metadata",
73+
"dg_account",
74+
];
75+
if (!Object.keys(account).every((key) => keys.includes(key)))
5376
return "Invalid account object: extra keys";
5477
return null;
5578
};

apps/website/app/api/supabase/space/route.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ const spaceValidator: ItemValidator<SpaceDataInput> = (space) => {
2323
return "Missing or invalid name.";
2424
if (!url || typeof url !== "string" || url.trim() === "")
2525
return "Missing or invalid URL.";
26-
if (
27-
platform === undefined ||
28-
!["Roam", "Obsidian"].includes(platform)
29-
)
26+
if (platform === undefined || !["Roam", "Obsidian"].includes(platform))
3027
return "Missing or invalid platform.";
3128
return null;
3229
};

apps/website/app/utils/getFileMetadata.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export const getFileMetadata = async ({
2222
console.error(`Error parsing metadata for ${filename}:`, error);
2323
throw new Error(
2424
`Invalid frontmatter in ${filename}: ${
25-
error instanceof Error ? error.message : 'Unknown error'
26-
}`
25+
error instanceof Error ? error.message : "Unknown error"
26+
}`,
2727
);
2828
}
2929
};

apps/website/app/utils/getHtmlFromMarkdown.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function remarkHeadingId() {
2525

2626
export async function getHtmlFromMarkdown(markdown: string): Promise<string> {
2727
if (!markdown) {
28-
throw new Error('Markdown content is required');
28+
throw new Error("Markdown content is required");
2929
}
3030

3131
try {
@@ -37,7 +37,7 @@ export async function getHtmlFromMarkdown(markdown: string): Promise<string> {
3737
.process(markdown);
3838
return htmlString.toString();
3939
} catch (error) {
40-
console.error('Error processing markdown:', error);
41-
throw new Error('Failed to process markdown content');
40+
console.error("Error processing markdown:", error);
41+
throw new Error("Failed to process markdown content");
4242
}
4343
}

packages/database/scripts/build.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
import { execSync } from "node:child_process";
2-
import { writeFileSync } from "fs"
2+
import { writeFileSync } from "fs";
33
import { join, dirname } from "path";
44
import { fileURLToPath } from "url";
55

66
const __dirname = dirname(fileURLToPath(import.meta.url));
7-
const projectRoot = join(__dirname, '..');
7+
const projectRoot = join(__dirname, "..");
88

9-
if (process.env.HOME !== '/vercel') {
9+
if (process.env.HOME !== "/vercel") {
1010
try {
11-
execSync('supabase start');
12-
execSync('supabase migrations up --include-all');
13-
const stdout = execSync('supabase gen types typescript --local --schema public', { encoding: 'utf8' });
14-
writeFileSync(join(projectRoot, 'types.gen.ts'), stdout);
11+
execSync("supabase start");
12+
execSync("supabase migrations up --include-all");
13+
const stdout = execSync(
14+
"supabase gen types typescript --local --schema public",
15+
{ encoding: "utf8" },
16+
);
17+
writeFileSync(join(projectRoot, "types.gen.ts"), stdout);
1518
} catch (err) {
1619
console.error(err);
1720
throw err;

0 commit comments

Comments
 (0)