Skip to content

Commit 564ee35

Browse files
committed
Resolve remaining lint warnings
1 parent 4d38a14 commit 564ee35

114 files changed

Lines changed: 8922 additions & 4145 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.

build-css.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ const CSS_FILES = [
3838
'styles/settings-view.css', // SettingsView component with proper BEM scoping
3939
'styles/webhook-settings.css', // Webhook settings UI with proper BEM scoping
4040
'styles/status-bar.css', // StatusBar component with proper BEM scoping
41-
'styles/bases-views.css' // Bases integration views (list and kanban)
41+
'styles/bases-views.css', // Bases integration views (list and kanban)
42+
'styles/static-style-utilities.css' // Static style utility classes migrated from inline styles
4243
];
4344

4445
const MAIN_CSS_TEMPLATE = `/* TaskNotes Plugin Styles */
@@ -119,4 +120,4 @@ function buildCSS() {
119120
}
120121

121122
// Run the build
122-
buildCSS();
123+
buildCSS();

src/api/SystemController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { NaturalLanguageParser } from "../services/NaturalLanguageParser";
44
import { TaskCreationData } from "../types";
55
import { TaskService } from "../services/TaskService";
66
import TaskNotesPlugin from "../main";
7-
7+
88
import { generateOpenAPISpec, Get, Post } from "../utils/OpenAPIDecorators";
99

1010
export class SystemController extends BaseController {
@@ -31,7 +31,7 @@ export class SystemController extends BaseController {
3131
} else if ("path" in adapter && typeof adapter.path === "string") {
3232
vaultPath = adapter.path;
3333
}
34-
} catch (error) {
34+
} catch {
3535
// Silently fail if vault path isn't accessible
3636
}
3737

src/api/TasksController.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { FilterService } from "../services/FilterService";
77
import { TaskManager } from "../utils/TaskManager";
88
import { TaskStatsService } from "../services/TaskStatsService";
99
import TaskNotesPlugin from "../main";
10-
10+
1111
import { Get, Post, Put, Delete } from "../utils/OpenAPIDecorators";
1212

1313
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -108,7 +108,7 @@ export class TasksController extends BaseController {
108108
} else if ("path" in adapter && typeof adapter.path === "string") {
109109
vaultPath = adapter.path;
110110
}
111-
} catch (error) {
111+
} catch {
112112
// Silently fail if vault path isn't accessible
113113
}
114114

@@ -351,7 +351,7 @@ export class TasksController extends BaseController {
351351
} else if ("path" in adapter && typeof adapter.path === "string") {
352352
vaultPath = adapter.path;
353353
}
354-
} catch (error) {
354+
} catch {
355355
// Silently fail if vault path isn't accessible
356356
}
357357

@@ -403,5 +403,4 @@ export class TasksController extends BaseController {
403403
this.sendResponse(res, 500, this.errorResponse(error.message));
404404
}
405405
}
406-
407406
}

src/api/WebhookController.ts

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
21
import { IncomingMessage, ServerResponse } from "http";
2+
import { requestUrl } from "obsidian";
33
import { BaseController } from "./BaseController";
44
import { WebhookConfig, WebhookDelivery, WebhookEvent, WebhookPayload } from "../types";
55
import { createHash, createHmac } from "crypto";
66
import TaskNotesPlugin from "../main";
7-
7+
88
import { Get, Post, Delete } from "../utils/OpenAPIDecorators";
99

1010
export class WebhookController extends BaseController {
@@ -172,7 +172,7 @@ export class WebhookController extends BaseController {
172172
} else if ("path" in adapter && typeof adapter.path === "string") {
173173
vaultPath = adapter.path;
174174
}
175-
} catch (error) {
175+
} catch {
176176
// Silently fail if vault path isn't accessible
177177
}
178178

@@ -243,20 +243,22 @@ export class WebhookController extends BaseController {
243243
headers["X-TaskNotes-Delivery-ID"] = delivery.id;
244244
}
245245

246-
const response = await fetch(webhook.url, {
246+
const response = await requestUrl({
247+
url: webhook.url,
247248
method: "POST",
248249
headers,
249250
body: JSON.stringify(delivery.payload),
251+
throw: false,
250252
});
251253

252254
delivery.responseStatus = response.status;
253255

254-
if (response.ok) {
256+
if (response.status >= 200 && response.status < 300) {
255257
delivery.status = "success";
256258
webhook.successCount++;
257259
webhook.lastTriggered = new Date().toISOString();
258260
} else {
259-
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
261+
throw new Error(`HTTP ${response.status}: ${response.text}`);
260262
}
261263
} catch (error: any) {
262264
delivery.error = error.message;
@@ -333,8 +335,6 @@ export class WebhookController extends BaseController {
333335
payload: WebhookPayload
334336
): Promise<any> {
335337
try {
336-
console.log(`🔧 Applying transformation: ${transformFile}`);
337-
338338
if (transformFile.endsWith(".js")) {
339339
return await this.applyJSTransformation(transformFile, payload);
340340
} else if (transformFile.endsWith(".json")) {
@@ -357,15 +357,10 @@ export class WebhookController extends BaseController {
357357
payload: WebhookPayload
358358
): Promise<any> {
359359
try {
360-
console.log(`📂 Reading transform file: ${transformFile}`);
361-
362360
// Read transformation file from vault
363361
let transformCode: string;
364362
try {
365363
transformCode = await this.plugin.app.vault.adapter.read(transformFile);
366-
console.log(
367-
`✅ Transform file loaded successfully (${transformCode.length} characters)`
368-
);
369364
} catch (readError: any) {
370365
throw new Error(
371366
`Failed to read transform file '${transformFile}': ${readError.message}. Please check the file path and ensure it exists in your vault.`
@@ -386,8 +381,6 @@ export class WebhookController extends BaseController {
386381
);
387382
}
388383

389-
console.log(`🔧 Executing transform function for event: ${payload.event}`);
390-
391384
// Create a safe execution context
392385
// User-authored transform files are an explicit trusted scripting feature.
393386
// eslint-disable-next-line @typescript-eslint/no-implied-eval
@@ -405,7 +398,6 @@ export class WebhookController extends BaseController {
405398
);
406399

407400
const result = transform(payload);
408-
console.log(`✅ Transform completed successfully for ${transformFile}`);
409401
return result;
410402
} catch (error: any) {
411403
console.error(`❌ JS transformation error for '${transformFile}':`, error.message);
@@ -418,15 +410,10 @@ export class WebhookController extends BaseController {
418410
payload: WebhookPayload
419411
): Promise<any> {
420412
try {
421-
console.log(`📂 Reading JSON template file: ${transformFile}`);
422-
423413
// Read template file from vault
424414
let templateContent: string;
425415
try {
426416
templateContent = await this.plugin.app.vault.adapter.read(transformFile);
427-
console.log(
428-
`✅ JSON template file loaded successfully (${templateContent.length} characters)`
429-
);
430417
} catch (readError: any) {
431418
throw new Error(
432419
`Failed to read template file '${transformFile}': ${readError.message}. Please check the file path and ensure it exists in your vault.`
@@ -450,8 +437,6 @@ export class WebhookController extends BaseController {
450437
);
451438
}
452439

453-
console.log(`🔧 Applying JSON template for event: ${payload.event}`);
454-
455440
// Get template for this event or use default
456441
const template = templates[payload.event] || templates.default;
457442
if (!template) {
@@ -463,7 +448,6 @@ export class WebhookController extends BaseController {
463448

464449
// Apply template variable substitution
465450
const result = this.interpolateTemplate(template, payload);
466-
console.log(`✅ JSON template applied successfully for ${transformFile}`);
467451
return result;
468452
} catch (error: any) {
469453
console.error(`❌ JSON transformation error for '${transformFile}':`, error.message);

src/api/loadAPIEndpoints.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { requestUrl } from "obsidian";
2+
13
async function loadAPIEndpoints(container: HTMLElement, apiPort = 8080): Promise<void> {
24
// Show loading message first
35
const loadingEl = container.createEl("p", {
@@ -6,19 +8,16 @@ async function loadAPIEndpoints(container: HTMLElement, apiPort = 8080): Promise
68
});
79

810
try {
9-
10-
console.log(`Fetching API documentation from http://localhost:${apiPort}/api/docs`);
11-
const response = await fetch(`http://localhost:${apiPort}/api/docs`);
12-
13-
console.log("API docs response:", response.status, response.statusText);
11+
const response = await requestUrl({
12+
url: `http://localhost:${apiPort}/api/docs`,
13+
throw: false,
14+
});
1415

15-
if (!response.ok) {
16-
throw new Error(`API unavailable (${response.status}: ${response.statusText})`);
16+
if (response.status < 200 || response.status >= 300) {
17+
throw new Error(`API unavailable (${response.status})`);
1718
}
1819

19-
const openApiSpec = await response.json();
20-
21-
console.log("OpenAPI spec loaded:", openApiSpec);
20+
const openApiSpec = response.json;
2221

2322
// Remove loading message
2423
loadingEl.remove();

src/bases/BasesDataAdapter.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { BasesDataItem } from "./helpers";
2-
import type { BasesEntry, BasesEntryGroup, BasesPropertyId, BasesView, TFile, Value } from "obsidian";
2+
import type {
3+
BasesEntry,
4+
BasesEntryGroup,
5+
BasesPropertyId,
6+
BasesView,
7+
TFile,
8+
Value,
9+
} from "obsidian";
310

411
type BasesViewDataSource = Pick<BasesView, "config" | "data">;
512

@@ -120,7 +127,6 @@ export class BasesDataAdapter {
120127
}
121128
}
122129

123-
124130
/**
125131
* Convert Bases Value object to native JavaScript value.
126132
* Handles: PrimitiveValue, ListValue, DateValue, FileValue, NullValue, etc.
@@ -137,11 +143,12 @@ export class BasesDataAdapter {
137143
}
138144

139145
// ListValue
140-
const getListItem = typeof basesValue.get === "function"
141-
? basesValue.get.bind(basesValue)
142-
: typeof basesValue.at === "function"
143-
? basesValue.at.bind(basesValue)
144-
: null;
146+
const getListItem =
147+
typeof basesValue.get === "function"
148+
? basesValue.get.bind(basesValue)
149+
: typeof basesValue.at === "function"
150+
? basesValue.at.bind(basesValue)
151+
: null;
145152
if (typeof basesValue.length === "function" && getListItem) {
146153
const len = basesValue.length();
147154
const result = [];
@@ -220,8 +227,8 @@ export class BasesDataAdapter {
220227
// Format Date objects as YYYY-MM-DD (date only, no time)
221228
if (actualValue instanceof Date) {
222229
const year = actualValue.getFullYear();
223-
const month = String(actualValue.getMonth() + 1).padStart(2, '0');
224-
const day = String(actualValue.getDate()).padStart(2, '0');
230+
const month = String(actualValue.getMonth() + 1).padStart(2, "0");
231+
const day = String(actualValue.getDate()).padStart(2, "0");
225232
return `${year}-${month}-${day}`;
226233
}
227234

@@ -289,7 +296,7 @@ export class BasesDataAdapter {
289296
try {
290297
const value = basesEntry.getValue(propertyId as BasesPropertyId);
291298
return this.convertValueToNative(value);
292-
} catch (e) {
299+
} catch {
293300
return null;
294301
}
295302
}

0 commit comments

Comments
 (0)