Skip to content

Commit f416db5

Browse files
comfy-pr-botsnomiaoclaude
authored
fix(lint): resolve oxlint warnings and errors (#173)
* fix(lint): remove unused imports - Remove unused type imports from @slack/bolt - Remove unused imports: jsonSchema, parseJsonEventStream, stepCountIs, tap, type - Remove unused imports: getConsoleLocation, SHA256, execa, execaCommand - Remove unused imports: Slack, exec, fromWritable, pageFlow, existsSync, getSlackChannel - Remove unused imports: fs, DIE, watch, generateText, sleep - Clean up unused gh, upsertSlackMessage, map, maxLength, slackBot imports Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(lint): prefix unused variables and parameters with underscore - Prefix unused catch parameters with _error/_e - Prefix unused destructured variables: _number, _repo, _hash, _branch, etc. - Prefix unused function parameters: _limit, _pattern, _state, _type, etc. - Prefix unused loop variables: _i, _a, _k - Remove redundant double negation operators Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(lint): convert side-effect expressions to if statements - Convert `x && doSomething()` to `if (x) doSomething()` - Convert `x || DIE()` assertions to `if (!x) DIE()` - Convert comma operator expressions to separate statements - Fix no-unused-expressions warnings across codebase Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(lint): misc lint fixes - Wrap top-level await in async IIFE in src/preload.ts - Add placeholder export to empty src/cli.test.ts - Remove empty object binding pattern in router.ts - Fix erasing operation (0 * 60 * 1000 -> 0) in slackCached.ts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: code formatting and cleanup - Apply consistent code formatting across codebase - Minor refactoring for readability - Update dependencies in bun.lock Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: snomiao <snomiao@gmail.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0ae58c1 commit f416db5

88 files changed

Lines changed: 423 additions & 320 deletions

File tree

Some content is hidden

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

.bot/AGENT.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,14 @@ For those private repos you have to use gh-cli to fetch the content:
8181
For every deliverable you produce, follow this exact sequence:
8282

8383
**Step 1 — Save to workspace:**
84+
8485
```bash
8586
# Always name files: deliverable-<name>.md
8687
# Examples: deliverable-research-report.md, deliverable-analysis.md, deliverable-summary.md
8788
```
8889

8990
**Step 2 — Post to Slack immediately after saving:**
91+
9092
```bash
9193
# Smart-post: auto-detects short vs long content
9294
# Short (≤ 2900 chars) → posts inline as a message
@@ -100,6 +102,7 @@ prbot slack post \
100102
```
101103

102104
**Rules:**
105+
103106
- **ALWAYS** do both steps together — save then post, never save without posting
104107
- Post to the **same thread** where the user asked (`--thread=${QUICK_RESPOND_MSG_TS}`)
105108
- Use `--channel=${EVENT_CHANNEL}` (already set in your environment)
@@ -112,6 +115,7 @@ prbot slack post \
112115
When a tool or prbot CLI command fails, follow this process:
113116

114117
1. **Record** the full error to `./TOOLS_ERRORS.md`:
118+
115119
```
116120
## [timestamp] Error: <tool/command name>
117121
**Command:** `<exact command that failed>`
@@ -126,6 +130,7 @@ When a tool or prbot CLI command fails, follow this process:
126130
- For other CLI errors → read `bot/cli.ts`
127131

128132
3. **Fix** the tool by spawning a prbot sub-agent with a detailed prompt that includes the exact error, root cause analysis, and the fix needed:
133+
129134
```bash
130135
prbot pr --repo=Comfy-Org/Comfy-PR --prompt="Fix tool error in <file>: <exact error>. Root cause: <your analysis>. Fix: <what to change>. Test by running: <how to verify>"
131136
```

app/(dashboard)/followup/actions/send-gmail/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ ${"```"}
100100
const auth = await getGCloudOAuth2Client({
101101
email: user.email,
102102
scope: ["https://www.googleapis.com/auth/gmail.compose"],
103-
authorize: (url) => {
103+
authorize: (_url) => {
104104
DIE("not possible to authorize here, plz refresh page");
105105
},
106106
});

app/api/router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const router = t.router({
1515
.meta({ openapi: { method: "GET", path: "/version", description: "Get version of ComfyPR" } })
1616
.input(z.object({}))
1717
.output(z.object({ version: z.string() }))
18-
.query(({}) => ({ version: pkg.version })),
18+
.query(() => ({ version: pkg.version })),
1919
dumpCsv: t.procedure
2020
.meta({ openapi: { method: "GET", path: "/dump.csv", description: "Get csv dump" } })
2121
.input(z.object({}))

app/api/webhook/github/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export async function POST(request: NextRequest) {
5353
let payload: unknown;
5454
try {
5555
payload = JSON.parse(rawBody);
56-
} catch (error) {
56+
} catch (_error) {
5757
return NextResponse.json({ error: "Invalid JSON payload" }, { status: 400 });
5858
}
5959

app/tasks/coreping/coreping.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ async function processPullRequestCorePingTask(
547547
// save status & lastStatus
548548

549549
const { status, statusAt } = await determinePullRequestReviewStatus(pr, {
550-
isUnrelated: (pr) => !task.labels.some((e) => LABELS.includes(e)),
550+
isUnrelated: (_pr) => !task.labels.some((e) => LABELS.includes(e)),
551551
});
552552
// update lastStatus if status changed
553553
const statusChanged = task.status !== status;
@@ -705,7 +705,7 @@ async function _cleanSpammyMessages20251117() {
705705
return;
706706
}
707707

708-
const deletedMessages = await sflow(myspammessages)
708+
const _deletedMessages = await sflow(myspammessages)
709709
.forEach(async (e) => await slack.chat.delete({ channel: channelId, ts: e.ts || DIE() }))
710710
.log(
711711
(e) =>

app/tasks/gh-bounty/gh-bounty.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,12 @@ export default async function runGithubBountyTask() {
9191
)
9292
) {
9393
console.log(`Adding label 'Bounty' to issue ${issue.html_url}`);
94-
!isDryRun &&
95-
(await gh.issues.addLabels({
94+
if (!isDryRun) {
95+
await gh.issues.addLabels({
9696
...parseIssueUrl(issue.html_url),
9797
labels: ["Bounty"],
98-
}));
98+
});
99+
}
99100
}
100101

101102
// add comment
@@ -105,30 +106,33 @@ export default async function runGithubBountyTask() {
105106
if (outdatedComment) {
106107
if (outdatedComment.user?.login === (await ghUser()).login) {
107108
console.log(`Updating comment in issue ${issue.html_url}`);
108-
!isDryRun &&
109-
(await gh.issues.updateComment({
109+
if (!isDryRun) {
110+
await gh.issues.updateComment({
110111
...parseIssueUrl(issue.html_url),
111112
comment_id: outdatedComment.id,
112113
body: bountyMessage,
113-
}));
114+
});
115+
}
114116
}
115117
} else if (!comments.data.some((c) => c.body === bountyMessage)) {
116118
console.log(`Adding comment to issue ${issue.html_url}`);
117-
!isDryRun &&
118-
(await gh.issues.createComment({
119+
if (!isDryRun) {
120+
await gh.issues.createComment({
119121
...parseIssueUrl(issue.html_url),
120122
body: bountyMessage,
121-
}));
123+
});
124+
}
122125
}
123126
console.log(`Issue ${issue.html_url} processed successfully.`);
124127

125128
// mark this issue as done in db.
126-
!isDryRun &&
127-
(await GithubBountyTask.updateOne(
129+
if (!isDryRun) {
130+
await GithubBountyTask.updateOne(
128131
{ issueUrl: issue.html_url },
129132
{ $set: { status: "done-2025-05-29" } },
130133
{ upsert: true },
131-
));
134+
);
135+
}
132136
})
133137
.run();
134138
console.log("All issues processed successfully.");

app/tasks/gh-core-tag-notification/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ const save = async (task: { tagName: string } & Partial<GithubCoreTagNotificatio
6969
tagName: normalizedTask.tagName,
7070
});
7171

72-
return (await GithubCoreTagNotificationTask.findOneAndUpdate(
73-
existing ? { _id: existing._id } : { tagName: normalizedTask.tagName },
74-
{ $set: normalizedTask },
75-
{ upsert: true, returnDocument: "after" },
76-
)) || DIE("never");
72+
return (
73+
(await GithubCoreTagNotificationTask.findOneAndUpdate(
74+
existing ? { _id: existing._id } : { tagName: normalizedTask.tagName },
75+
{ $set: normalizedTask },
76+
{ upsert: true, returnDocument: "after" },
77+
)) || DIE("never")
78+
);
7779
};
7880

7981
if (import.meta.main) {

app/tasks/gh-design/gh-design.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export async function runGithubDesignTask() {
171171
// console.log("Using Slack message template:", JSON.stringify(slackMessageTemplate));
172172

173173
// Start processing design items
174-
const designItemsFlow = await sflow(REPOURLS)
174+
const _designItemsFlow = await sflow(REPOURLS)
175175
.map((url) =>
176176
ghPageFlow(gh.issues.listForRepo)({
177177
...parseGithubRepoUrl(url),

app/tasks/gh-design/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default async function GithubDesignTaskPage() {
4040
}
4141
};
4242

43-
const getRepoFromUrl = (url: string) => {
43+
const _getRepoFromUrl = (url: string) => {
4444
const match = url.match(/github\.com\/([^/]+\/[^/]+)/);
4545
return match?.[1] || url;
4646
};

app/tasks/gh-desktop-release-notification/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,13 @@ const save = async (task: { url: string } & Partial<GithubReleaseNotificationTas
6464
$or: [{ url: normalizedTask.url }, { url: oldUrl }],
6565
});
6666

67-
return (await GithubReleaseNotificationTask.findOneAndUpdate(
68-
existing ? { _id: existing._id } : { url: normalizedTask.url },
69-
{ $set: normalizedTask },
70-
{ upsert: true, returnDocument: "after" },
71-
)) || DIE("never");
67+
return (
68+
(await GithubReleaseNotificationTask.findOneAndUpdate(
69+
existing ? { _id: existing._id } : { url: normalizedTask.url },
70+
{ $set: normalizedTask },
71+
{ upsert: true, returnDocument: "after" },
72+
)) || DIE("never")
73+
);
7274
};
7375

7476
if (import.meta.main) {

0 commit comments

Comments
 (0)