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:
@@ -31,7 +31,7 @@ export class CronScheduler implements ChannelAdapter {
|
||||
this._status = 'connected';
|
||||
|
||||
for (const job of this.jobConfigs) {
|
||||
if (!job.enabled) continue;
|
||||
if (!job.enabled) {continue;}
|
||||
|
||||
const cronInstance = new Cron(job.schedule, {
|
||||
timezone: job.timezone,
|
||||
@@ -81,7 +81,7 @@ export class CronScheduler implements ChannelAdapter {
|
||||
/** Manually trigger a job (also called by cron on schedule). */
|
||||
triggerJob(jobName: string): void {
|
||||
const job = this.jobs.get(jobName);
|
||||
if (!job) return;
|
||||
if (!job) {return;}
|
||||
|
||||
const msg: InboundMessage = {
|
||||
id: `cron-${jobName}-${Date.now()}`,
|
||||
|
||||
@@ -181,8 +181,8 @@ describe('GmailWatcher', () => {
|
||||
// credentials file exists but token file does not
|
||||
mockExistsSync.mockImplementation((path: unknown) => {
|
||||
const p = String(path);
|
||||
if (p.includes('credentials')) return true;
|
||||
if (p.includes('token')) return false;
|
||||
if (p.includes('credentials')) {return true;}
|
||||
if (p.includes('token')) {return false;}
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ export class GmailWatcher implements ChannelAdapter {
|
||||
* Calls gmail.users.watch() and schedules renewal before expiry.
|
||||
*/
|
||||
private async setupWatch(): Promise<void> {
|
||||
if (!this.oauth2Client) return;
|
||||
if (!this.oauth2Client) {return;}
|
||||
|
||||
const gmail = google.gmail({ version: 'v1', auth: this.oauth2Client });
|
||||
|
||||
@@ -243,7 +243,7 @@ export class GmailWatcher implements ChannelAdapter {
|
||||
* Fallback mechanism when Pub/Sub push is not available.
|
||||
*/
|
||||
private async pollForNewMessages(): Promise<void> {
|
||||
if (!this.oauth2Client) return;
|
||||
if (!this.oauth2Client) {return;}
|
||||
|
||||
const gmail = google.gmail({ version: 'v1', auth: this.oauth2Client });
|
||||
|
||||
@@ -268,7 +268,7 @@ export class GmailWatcher implements ChannelAdapter {
|
||||
* Updates lastHistoryId to the latest value from the response.
|
||||
*/
|
||||
private async processHistoryChanges(startHistoryId: string): Promise<void> {
|
||||
if (!this.oauth2Client) return;
|
||||
if (!this.oauth2Client) {return;}
|
||||
|
||||
const gmail = google.gmail({ version: 'v1', auth: this.oauth2Client });
|
||||
|
||||
@@ -287,17 +287,17 @@ export class GmailWatcher implements ChannelAdapter {
|
||||
const addedMessages = record.messagesAdded ?? [];
|
||||
for (const added of addedMessages) {
|
||||
const messageId = added.message?.id;
|
||||
if (!messageId || processedIds.has(messageId)) continue;
|
||||
if (!messageId || processedIds.has(messageId)) {continue;}
|
||||
processedIds.add(messageId);
|
||||
|
||||
const email = await this.getMessageDetails(messageId);
|
||||
if (!email) continue;
|
||||
if (!email) {continue;}
|
||||
|
||||
// Skip messages before history_start if configured
|
||||
if (this.config.history_start) {
|
||||
const emailDate = new Date(email.date);
|
||||
const startDate = new Date(this.config.history_start);
|
||||
if (emailDate < startDate) continue;
|
||||
if (emailDate < startDate) {continue;}
|
||||
}
|
||||
|
||||
const text = this.renderTemplate(email);
|
||||
@@ -348,7 +348,7 @@ export class GmailWatcher implements ChannelAdapter {
|
||||
* Fetch full message details by ID and extract relevant headers.
|
||||
*/
|
||||
private async getMessageDetails(messageId: string): Promise<EmailInfo | null> {
|
||||
if (!this.oauth2Client) return null;
|
||||
if (!this.oauth2Client) {return null;}
|
||||
|
||||
const gmail = google.gmail({ version: 'v1', auth: this.oauth2Client });
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ export class HeartbeatMonitor {
|
||||
|
||||
/** Start the heartbeat monitor. Does nothing if disabled. */
|
||||
start(): void {
|
||||
if (!this.deps.config.enabled) return;
|
||||
if (!this.deps.config.enabled) {return;}
|
||||
|
||||
const intervalMs = parseInterval(this.deps.config.interval);
|
||||
console.log(`HeartbeatMonitor: starting (interval=${this.deps.config.interval}, checks=[${this.deps.config.checks.join(', ')}])`);
|
||||
@@ -290,7 +290,7 @@ export class HeartbeatMonitor {
|
||||
|
||||
private async notify(text: string): Promise<void> {
|
||||
const notifyConfig = this.deps.config.notify;
|
||||
if (!notifyConfig) return;
|
||||
if (!notifyConfig) {return;}
|
||||
|
||||
const adapter = this.deps.channelLookup.get(notifyConfig.channel);
|
||||
if (!adapter) {
|
||||
|
||||
@@ -36,7 +36,7 @@ function mockResponse(): ServerResponse & { statusCode_: number; body_: string;
|
||||
headers_: {},
|
||||
writeHead(code: number, headers?: Record<string, string>) {
|
||||
res.statusCode_ = code;
|
||||
if (headers) res.headers_ = headers;
|
||||
if (headers) {res.headers_ = headers;}
|
||||
return res;
|
||||
},
|
||||
end(body?: string) {
|
||||
|
||||
@@ -23,7 +23,7 @@ function verifyHmac(body: string, secret: string, signature: string): boolean {
|
||||
const expected = createHmac('sha256', secret).update(body).digest('hex');
|
||||
const sig = signature.startsWith('sha256=') ? signature.slice(7) : signature;
|
||||
|
||||
if (expected.length !== sig.length) return false;
|
||||
if (expected.length !== sig.length) {return false;}
|
||||
|
||||
try {
|
||||
return timingSafeEqual(Buffer.from(expected, 'hex'), Buffer.from(sig, 'hex'));
|
||||
@@ -51,7 +51,7 @@ function renderTemplate(template: string, body: string): string {
|
||||
}
|
||||
}
|
||||
const value = parsed[field];
|
||||
if (value === undefined || value === null) return '';
|
||||
if (value === undefined || value === null) {return '';}
|
||||
return typeof value === 'string' ? value : JSON.stringify(value);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user