Skip to content

Commit 0ae58c1

Browse files
comfy-pr-botsnomiaoclaude
authored
fix: resolve remaining tsgo and oxlint errors in main (#170)
- Fix no-explicit-any errors in scripts/migrate-urls-to-comfy-org.ts (3 occurrences) - Fix no-explicit-any in src/normalizeGithubUrl.ts generic constraint - Fix WebAPICallResult cast in lib/slack/msg-post.ts for tsgo compatibility Co-authored-by: snomiao <snomiao@gmail.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 44eaebd commit 0ae58c1

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

lib/slack/msg-post.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ export async function smartPost(
6464
}
6565

6666
// Too long — save to a .md file then upload
67-
const savePath = filePath || join(tmpdir(), `${title.replace(/[^a-z0-9-]/gi, "-")}-${Date.now()}.md`);
67+
const savePath =
68+
filePath || join(tmpdir(), `${title.replace(/[^a-z0-9-]/gi, "-")}-${Date.now()}.md`);
6869

6970
mkdirSync(join(savePath, ".."), { recursive: true });
7071
writeFileSync(savePath, text, "utf-8");
@@ -75,7 +76,9 @@ export async function smartPost(
7576
threadTs,
7677
});
7778

78-
const file = (uploadResult as Record<string, unknown>).file as Record<string, unknown> | undefined;
79+
const file = (uploadResult as unknown as Record<string, unknown>).file as
80+
| Record<string, unknown>
81+
| undefined;
7982

8083
return {
8184
method: "file",

scripts/migrate-urls-to-comfy-org.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async function migrateCollection(
5555
console.log(` 📝 Processing field: ${field}`);
5656

5757
// Find all documents with comfyanonymous URLs in this field
58-
const query: any = {};
58+
const query: Record<string, unknown> = {};
5959
query[field] = { $regex: /github\.com\/comfyanonymous\//i };
6060

6161
const documents = await collection.find(query).toArray();
@@ -96,14 +96,12 @@ async function migrateCollection(
9696
try {
9797
// Check if a document with the normalized URL already exists
9898
if (uniqueField === field) {
99-
const query: any = {};
99+
const query: Record<string, unknown> = {};
100100
query[field] = newUrl;
101101
const existing = await collection.findOne(query);
102102

103103
if (existing && existing._id.toString() !== doc._id.toString()) {
104-
console.log(
105-
` ⚠️ Skipping ${oldUrl}: Document with normalized URL already exists`,
106-
);
104+
console.log(` ⚠️ Skipping ${oldUrl}: Document with normalized URL already exists`);
107105
// Keep the document with the normalized URL, mark old one for review
108106
await collection.updateOne(
109107
{ _id: doc._id },
@@ -115,7 +113,7 @@ async function migrateCollection(
115113
}
116114

117115
// Update the document
118-
const updateDoc: any = {};
116+
const updateDoc: Record<string, unknown> = {};
119117
updateDoc[field] = newUrl;
120118

121119
await collection.updateOne({ _id: doc._id }, { $set: updateDoc });

src/normalizeGithubUrl.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function normalizeGithubUrl(url: string): string {
2020
// Only ComfyUI was migrated from comfyanonymous to Comfy-Org
2121
return url.replace(
2222
/github\.com\/comfyanonymous\/ComfyUI([/?#]|$)/gi,
23-
'github.com/Comfy-Org/ComfyUI$1'
23+
"github.com/Comfy-Org/ComfyUI$1",
2424
);
2525
}
2626

@@ -48,14 +48,14 @@ export function normalizeGithubUrls(urls: string[]): string[] {
4848
* )
4949
* // => { sourceIssueUrl: "https://github.com/Comfy-Org/ComfyUI/issues/123" }
5050
*/
51-
export function normalizeGithubUrlsInObject<T extends Record<string, any>>(
51+
export function normalizeGithubUrlsInObject<T extends Record<string, unknown>>(
5252
obj: T,
53-
urlFields: (keyof T)[]
53+
urlFields: (keyof T)[],
5454
): T {
5555
const result = { ...obj };
5656

5757
for (const field of urlFields) {
58-
if (typeof result[field] === 'string') {
58+
if (typeof result[field] === "string") {
5959
result[field] = normalizeGithubUrl(result[field] as string) as T[keyof T];
6060
}
6161
}

0 commit comments

Comments
 (0)