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: {
|
detail: {
|
||||||
id: string;
|
id: string;
|
||||||
action: string;
|
action: string;
|
||||||
data?: any;
|
data?: Record<string, unknown>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ export interface ContentFetchConfig {
|
|||||||
apiService?: string;
|
apiService?: string;
|
||||||
database?: string;
|
database?: string;
|
||||||
reporting?: string;
|
reporting?: string;
|
||||||
onSuccess?: (data: any) => Promise<void>;
|
onSuccess?: (data: Record<string, unknown>) => Promise<void>;
|
||||||
onError?: (error: Error) => Promise<void>;
|
onError?: (error: Error) => Promise<void>;
|
||||||
onComplete?: (result: ContentFetchResult) => Promise<void>;
|
onComplete?: (result: ContentFetchResult) => Promise<void>;
|
||||||
};
|
};
|
||||||
@@ -266,7 +266,7 @@ export interface DualScheduleConfiguration {
|
|||||||
|
|
||||||
export interface ContentFetchResult {
|
export interface ContentFetchResult {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
data?: any;
|
data?: Record<string, unknown>;
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
contentAge: number;
|
contentAge: number;
|
||||||
error?: string;
|
error?: string;
|
||||||
@@ -795,7 +795,7 @@ export interface TimeSafariProjectNotification {
|
|||||||
type: 'project';
|
type: 'project';
|
||||||
subtype: TimeSafariProjectSubtype;
|
subtype: TimeSafariProjectSubtype;
|
||||||
project: PlanSummary;
|
project: PlanSummary;
|
||||||
previousClaim?: any; // Previous claim data
|
previousClaim?: Record<string, unknown>; // Previous claim data
|
||||||
notificationPriority: 'high' | 'medium' | 'low';
|
notificationPriority: 'high' | 'medium' | 'low';
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
}
|
}
|
||||||
@@ -854,8 +854,8 @@ export interface EnhancedTimeSafariNotification {
|
|||||||
// Type-specific properties (union approach)
|
// Type-specific properties (union approach)
|
||||||
offer?: OfferSummaryRecord;
|
offer?: OfferSummaryRecord;
|
||||||
project?: PlanSummary;
|
project?: PlanSummary;
|
||||||
person?: { did: any; name?: string };
|
person?: { did: string; name?: string };
|
||||||
item?: { id: string; name?: string; type?: string };
|
item?: { id: string; name?: string; type?: string };
|
||||||
relevantProjects?: PlanSummary[];
|
relevantProjects?: PlanSummary[];
|
||||||
previousClaim?: any;
|
previousClaim?: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
@@ -20,13 +20,13 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
|||||||
private scheduledNotifications: Set<string> = new Set();
|
private scheduledNotifications: Set<string> = new Set();
|
||||||
private activeDid?: string;
|
private activeDid?: string;
|
||||||
|
|
||||||
async configure(_options: any): Promise<void> {
|
async configure(_options: Record<string, unknown>): Promise<void> {
|
||||||
// Web implementation placeholder
|
// Web implementation placeholder
|
||||||
console.log('Configure called on web platform');
|
// Configuration applied for web platform
|
||||||
}
|
}
|
||||||
|
|
||||||
async maintainRollingWindow(): Promise<void> {
|
async maintainRollingWindow(): Promise<void> {
|
||||||
console.log('Maintain rolling window called on web platform');
|
// Rolling window maintenance for web platform
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRollingWindowStats(): Promise<{
|
async getRollingWindowStats(): Promise<{
|
||||||
@@ -34,7 +34,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
|||||||
maintenanceNeeded: boolean;
|
maintenanceNeeded: boolean;
|
||||||
timeUntilNextMaintenance: number;
|
timeUntilNextMaintenance: number;
|
||||||
}> {
|
}> {
|
||||||
console.log('Get rolling window stats called on web platform');
|
// Get rolling window stats for web platform
|
||||||
return {
|
return {
|
||||||
stats: 'Web platform - rolling window not applicable',
|
stats: 'Web platform - rolling window not applicable',
|
||||||
maintenanceNeeded: false,
|
maintenanceNeeded: false,
|
||||||
@@ -48,7 +48,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
|||||||
canSchedule: boolean;
|
canSchedule: boolean;
|
||||||
fallbackWindow: string;
|
fallbackWindow: string;
|
||||||
}> {
|
}> {
|
||||||
console.log('Get exact alarm status called on web platform');
|
// Get exact alarm status for web platform
|
||||||
return {
|
return {
|
||||||
supported: false,
|
supported: false,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
@@ -247,7 +247,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
|||||||
/**
|
/**
|
||||||
* Schedule content fetch (web implementation)
|
* 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);
|
console.log('Content fetch scheduled (web mock):', config);
|
||||||
// Mock implementation - in real app would use Service Worker
|
// Mock implementation - in real app would use Service Worker
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
|||||||
/**
|
/**
|
||||||
* Schedule user notification (web implementation)
|
* 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);
|
console.log('User notification scheduled (web mock):', config);
|
||||||
// Mock implementation - in real app would use browser notifications
|
// Mock implementation - in real app would use browser notifications
|
||||||
}
|
}
|
||||||
@@ -263,7 +263,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
|||||||
/**
|
/**
|
||||||
* Schedule dual notification (web implementation)
|
* 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);
|
console.log('Dual notification scheduled (web mock):', config);
|
||||||
// Mock implementation combining content fetch and user notification
|
// Mock implementation combining content fetch and user notification
|
||||||
}
|
}
|
||||||
@@ -381,7 +381,10 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate next notification time
|
// 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();
|
const delay = nextTime.getTime() - Date.now();
|
||||||
|
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
@@ -411,7 +414,7 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Handle notification click
|
// Handle notification click
|
||||||
browserNotification.onclick = () => {
|
browserNotification.onclick = (): void => {
|
||||||
if (notification.url) {
|
if (notification.url) {
|
||||||
window.open(notification.url, '_blank');
|
window.open(notification.url, '_blank');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user