style: auto-fix ESLint issues (curly braces and formatting)
- Add curly braces to all if/else/for/while statements - Fix indentation and trailing spaces - Auto-fixed 372 linting errors using eslint --fix - Remaining issues are warnings only (non-null assertions, explicit any types)
This commit is contained in:
@@ -50,7 +50,7 @@ const baseConfig: SlackAdapterConfig = {
|
||||
|
||||
/** Helper: simulate a Slack message event through the captured handler. */
|
||||
async function simulateMessage(message: Record<string, unknown>) {
|
||||
if (!capturedMessageHandler) throw new Error('No message handler captured — call connect() first');
|
||||
if (!capturedMessageHandler) {throw new Error('No message handler captured — call connect() first');}
|
||||
await capturedMessageHandler({ message });
|
||||
}
|
||||
|
||||
|
||||
@@ -128,15 +128,15 @@ export class SlackAdapter implements ChannelAdapter {
|
||||
|
||||
/** Send an outbound message, automatically chunking if it exceeds 4000 chars. */
|
||||
async send(peerId: string, message: OutboundMessage): Promise<void> {
|
||||
if (!this.app) throw new Error('Slack adapter not connected');
|
||||
if (!this.app) {throw new Error('Slack adapter not connected');}
|
||||
|
||||
// Parse peerId: "channelId:threadTs"
|
||||
const colonIndex = peerId.indexOf(':');
|
||||
if (colonIndex === -1) throw new Error(`Invalid peer ID format: ${peerId}`);
|
||||
if (colonIndex === -1) {throw new Error(`Invalid peer ID format: ${peerId}`);}
|
||||
|
||||
const channel = peerId.slice(0, colonIndex);
|
||||
const threadTs = peerId.slice(colonIndex + 1);
|
||||
if (!channel || !threadTs) throw new Error(`Invalid peer ID format: ${peerId}`);
|
||||
if (!channel || !threadTs) {throw new Error(`Invalid peer ID format: ${peerId}`);}
|
||||
|
||||
const text = message.text;
|
||||
|
||||
@@ -171,7 +171,7 @@ export class SlackAdapter implements ChannelAdapter {
|
||||
threadTs: string,
|
||||
attachment: OutboundAttachment,
|
||||
): Promise<void> {
|
||||
if (!this.app) return;
|
||||
if (!this.app) {return;}
|
||||
|
||||
try {
|
||||
if (attachment.data) {
|
||||
@@ -200,7 +200,7 @@ export class SlackAdapter implements ChannelAdapter {
|
||||
/** Resolve a Slack user ID to a display name, with caching. */
|
||||
private async resolveUserName(userId: string): Promise<string> {
|
||||
const cached = this.userNameCache.get(userId);
|
||||
if (cached) return cached;
|
||||
if (cached) {return cached;}
|
||||
|
||||
try {
|
||||
const result = await this.app!.client.users.info({ user: userId });
|
||||
@@ -219,16 +219,16 @@ export class SlackAdapter implements ChannelAdapter {
|
||||
private async extractMediaAttachments(
|
||||
files?: SlackMessageEvent['files'],
|
||||
): Promise<Attachment[]> {
|
||||
if (!files || files.length === 0) return [];
|
||||
if (!files || files.length === 0) {return [];}
|
||||
|
||||
const attachments: Attachment[] = [];
|
||||
|
||||
for (const file of files) {
|
||||
// Only process image and audio files
|
||||
if (!file.mimetype?.startsWith('image/') && !file.mimetype?.startsWith('audio/')) continue;
|
||||
if (!file.mimetype?.startsWith('image/') && !file.mimetype?.startsWith('audio/')) {continue;}
|
||||
|
||||
const downloadUrl = file.url_private_download || file.url_private;
|
||||
if (!downloadUrl) continue;
|
||||
if (!downloadUrl) {continue;}
|
||||
|
||||
try {
|
||||
const response = await fetch(downloadUrl, {
|
||||
@@ -264,13 +264,13 @@ export class SlackAdapter implements ChannelAdapter {
|
||||
|
||||
/** Internal: process an inbound Slack message event. */
|
||||
private async handleMessage(message: SlackMessageEvent): Promise<void> {
|
||||
if (!this.messageHandler) return;
|
||||
if (!this.messageHandler) {return;}
|
||||
|
||||
// Ignore bot messages
|
||||
if (message.bot_id || message.subtype === 'bot_message') return;
|
||||
if (message.bot_id || message.subtype === 'bot_message') {return;}
|
||||
|
||||
const channelId = message.channel;
|
||||
if (!channelId) return;
|
||||
if (!channelId) {return;}
|
||||
|
||||
// Check allowed channel IDs
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user