mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 00:41:25 +00:00
chore: Enable typescript/no-explicit-any rule.
This commit is contained in:
@@ -155,7 +155,6 @@ export function extractMentions(message: string): string[] {
|
||||
const mentions: string[] = [];
|
||||
let match: RegExpExecArray | null;
|
||||
|
||||
// biome-ignore lint/suspicious/noAssignInExpressions: Standard regex iteration pattern
|
||||
while ((match = mentionRegex.exec(message)) !== null) {
|
||||
const username = match[1];
|
||||
if (username) {
|
||||
|
||||
@@ -64,7 +64,6 @@ export const twitchOutbound: ChannelOutboundAdapter = {
|
||||
return { ok: true, to: normalizedTo };
|
||||
}
|
||||
// Fallback to first allowFrom entry
|
||||
// biome-ignore lint/style/noNonNullAssertion: length > 0 check ensures element exists
|
||||
return { ok: true, to: allowList[0] };
|
||||
}
|
||||
|
||||
@@ -74,7 +73,6 @@ export const twitchOutbound: ChannelOutboundAdapter = {
|
||||
|
||||
// No target provided, use allowFrom fallback
|
||||
if (allowList.length > 0) {
|
||||
// biome-ignore lint/style/noNonNullAssertion: length > 0 check ensures element exists
|
||||
return { ok: true, to: allowList[0] };
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,12 @@ const mockQuit = vi.fn();
|
||||
const mockUnbind = vi.fn();
|
||||
|
||||
// Event handler storage for testing
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const messageHandlers: Array<(channel: string, user: string, message: string, msg: any) => void> =
|
||||
[];
|
||||
|
||||
// Mock functions that track handlers and return unbind objects
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const mockOnMessage = vi.fn((handler: any) => {
|
||||
messageHandlers.push(handler);
|
||||
return { unbind: mockUnbind };
|
||||
@@ -269,6 +271,7 @@ describe("TwitchClientManager", () => {
|
||||
|
||||
// Check the stored handler is handler2
|
||||
const key = manager.getAccountKey(testAccount);
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((manager as any).messageHandlers.get(key)).toBe(handler2);
|
||||
});
|
||||
});
|
||||
@@ -290,7 +293,9 @@ describe("TwitchClientManager", () => {
|
||||
await manager.disconnect(testAccount);
|
||||
|
||||
const key = manager.getAccountKey(testAccount);
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((manager as any).clients.has(key)).toBe(false);
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((manager as any).messageHandlers.has(key)).toBe(false);
|
||||
});
|
||||
|
||||
@@ -309,6 +314,7 @@ describe("TwitchClientManager", () => {
|
||||
expect(mockQuit).toHaveBeenCalledTimes(1);
|
||||
|
||||
const key2 = manager.getAccountKey(testAccount2);
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((manager as any).clients.has(key2)).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -321,7 +327,9 @@ describe("TwitchClientManager", () => {
|
||||
await manager.disconnectAll();
|
||||
|
||||
expect(mockQuit).toHaveBeenCalledTimes(2);
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((manager as any).clients.size).toBe(0);
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((manager as any).messageHandlers.size).toBe(0);
|
||||
});
|
||||
|
||||
@@ -387,6 +395,7 @@ describe("TwitchClientManager", () => {
|
||||
|
||||
it("should create client if not already connected", async () => {
|
||||
// Clear the existing client
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
(manager as any).clients.clear();
|
||||
|
||||
// Reset connect call count for this specific test
|
||||
|
||||
Reference in New Issue
Block a user