feat: improve code quality with optional linting enhancements
- Replace 'any' types with more specific types (Record<string, unknown>, string)
- Add return type annotations to arrow functions
- Replace console.log statements with descriptive comments
- Replace non-null assertions with proper null checks
- Improve type safety in core plugin interfaces
Linting status: ✅ 0 errors, 436 warnings (down from 452 warnings)
Code quality improvements: +16 warnings resolved
This commit is contained in:
@@ -68,7 +68,7 @@ export interface NotificationEvent extends Event {
|
||||
detail: {
|
||||
id: string;
|
||||
action: string;
|
||||
data?: any;
|
||||
data?: Record<string, unknown>;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ export interface ContentFetchConfig {
|
||||
apiService?: string;
|
||||
database?: string;
|
||||
reporting?: string;
|
||||
onSuccess?: (data: any) => Promise<void>;
|
||||
onSuccess?: (data: Record<string, unknown>) => Promise<void>;
|
||||
onError?: (error: Error) => Promise<void>;
|
||||
onComplete?: (result: ContentFetchResult) => Promise<void>;
|
||||
};
|
||||
@@ -266,7 +266,7 @@ export interface DualScheduleConfiguration {
|
||||
|
||||
export interface ContentFetchResult {
|
||||
success: boolean;
|
||||
data?: any;
|
||||
data?: Record<string, unknown>;
|
||||
timestamp: number;
|
||||
contentAge: number;
|
||||
error?: string;
|
||||
@@ -795,7 +795,7 @@ export interface TimeSafariProjectNotification {
|
||||
type: 'project';
|
||||
subtype: TimeSafariProjectSubtype;
|
||||
project: PlanSummary;
|
||||
previousClaim?: any; // Previous claim data
|
||||
previousClaim?: Record<string, unknown>; // Previous claim data
|
||||
notificationPriority: 'high' | 'medium' | 'low';
|
||||
timestamp: number;
|
||||
}
|
||||
@@ -854,8 +854,8 @@ export interface EnhancedTimeSafariNotification {
|
||||
// Type-specific properties (union approach)
|
||||
offer?: OfferSummaryRecord;
|
||||
project?: PlanSummary;
|
||||
person?: { did: any; name?: string };
|
||||
person?: { did: string; name?: string };
|
||||
item?: { id: string; name?: string; type?: string };
|
||||
relevantProjects?: PlanSummary[];
|
||||
previousClaim?: any;
|
||||
previousClaim?: Record<string, unknown>;
|
||||
}
|
||||
@@ -20,13 +20,13 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
||||
private scheduledNotifications: Set<string> = new Set();
|
||||
private activeDid?: string;
|
||||
|
||||
async configure(_options: any): Promise<void> {
|
||||
async configure(_options: Record<string, unknown>): Promise<void> {
|
||||
// Web implementation placeholder
|
||||
console.log('Configure called on web platform');
|
||||
// Configuration applied for web platform
|
||||
}
|
||||
|
||||
async maintainRollingWindow(): Promise<void> {
|
||||
console.log('Maintain rolling window called on web platform');
|
||||
// Rolling window maintenance for web platform
|
||||
}
|
||||
|
||||
async getRollingWindowStats(): Promise<{
|
||||
@@ -34,7 +34,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
||||
maintenanceNeeded: boolean;
|
||||
timeUntilNextMaintenance: number;
|
||||
}> {
|
||||
console.log('Get rolling window stats called on web platform');
|
||||
// Get rolling window stats for web platform
|
||||
return {
|
||||
stats: 'Web platform - rolling window not applicable',
|
||||
maintenanceNeeded: false,
|
||||
@@ -48,7 +48,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
||||
canSchedule: boolean;
|
||||
fallbackWindow: string;
|
||||
}> {
|
||||
console.log('Get exact alarm status called on web platform');
|
||||
// Get exact alarm status for web platform
|
||||
return {
|
||||
supported: false,
|
||||
enabled: false,
|
||||
@@ -247,7 +247,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
||||
/**
|
||||
* Schedule content fetch (web implementation)
|
||||
*/
|
||||
async scheduleContentFetch(config: any): Promise<void> {
|
||||
async scheduleContentFetch(config: Record<string, unknown>): Promise<void> {
|
||||
console.log('Content fetch scheduled (web mock):', config);
|
||||
// Mock implementation - in real app would use Service Worker
|
||||
}
|
||||
@@ -255,7 +255,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
||||
/**
|
||||
* Schedule user notification (web implementation)
|
||||
*/
|
||||
async scheduleUserNotification(config: any): Promise<void> {
|
||||
async scheduleUserNotification(config: Record<string, unknown>): Promise<void> {
|
||||
console.log('User notification scheduled (web mock):', config);
|
||||
// Mock implementation - in real app would use browser notifications
|
||||
}
|
||||
@@ -263,7 +263,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
||||
/**
|
||||
* Schedule dual notification (web implementation)
|
||||
*/
|
||||
async scheduleDualNotification(config: any): Promise<void> {
|
||||
async scheduleDualNotification(config: Record<string, unknown>): Promise<void> {
|
||||
console.log('Dual notification scheduled (web mock):', config);
|
||||
// Mock implementation combining content fetch and user notification
|
||||
}
|
||||
@@ -381,7 +381,10 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
||||
}
|
||||
|
||||
// Calculate next notification time
|
||||
const nextTime = this.calculateNextNotificationTime(options.time!);
|
||||
if (!options.time) {
|
||||
throw new Error('Time parameter is required for scheduling');
|
||||
}
|
||||
const nextTime = this.calculateNextNotificationTime(options.time);
|
||||
const delay = nextTime.getTime() - Date.now();
|
||||
|
||||
if (delay > 0) {
|
||||
@@ -411,7 +414,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
||||
});
|
||||
|
||||
// Handle notification click
|
||||
browserNotification.onclick = () => {
|
||||
browserNotification.onclick = (): void => {
|
||||
if (notification.url) {
|
||||
window.open(notification.url, '_blank');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user