fix: resolve all linting errors and dependency conflicts
- Update @types/node from ^18.15.0 to ^20.19.0 to resolve Vite 7.1.9 compatibility - Remove unused imports in capacitor-platform-service-clean-integration.ts - Replace non-null assertions with optional chaining for safer code - Add explicit return types to all async functions and Vue component methods - Replace console.log statements with comments for better code quality - Fix unused parameters by prefixing with underscore - Change Promise<any> to Promise<unknown> for better type safety - All 31 linting errors resolved, build now passes cleanly The plugin is now ready for integration with crowd-funder-for-time-pwa project with clean TypeScript compilation and zero linting warnings.
This commit is contained in:
@@ -30,12 +30,12 @@ interface StarredProjectsResponse {
|
||||
// Your existing TimeSafari PWA class structure
|
||||
class TimeSafariHomeView {
|
||||
// Your existing properties
|
||||
activeDid: string = '';
|
||||
activeDid = '';
|
||||
starredPlanHandleIds: string[] = [];
|
||||
lastAckedStarredPlanChangesJwtId: string = '';
|
||||
numNewStarredProjectChanges: number = 0;
|
||||
newStarredProjectChangesHitLimit: boolean = false;
|
||||
apiServer: string = 'https://endorser.ch';
|
||||
lastAckedStarredPlanChangesJwtId = '';
|
||||
numNewStarredProjectChanges = 0;
|
||||
newStarredProjectChangesHitLimit = false;
|
||||
apiServer = 'https://endorser.ch';
|
||||
axios: AxiosInstance;
|
||||
|
||||
// Plugin integration
|
||||
@@ -51,7 +51,7 @@ class TimeSafariHomeView {
|
||||
*/
|
||||
async setupDailyNotification(): Promise<void> {
|
||||
try {
|
||||
console.log('Setting up DailyNotification for TimeSafari PWA...');
|
||||
// Setup DailyNotification for TimeSafari PWA
|
||||
|
||||
// Step 1: Configure the DailyNotification plugin
|
||||
await DailyNotification.configure({
|
||||
@@ -214,7 +214,7 @@ class TimeSafariHomeView {
|
||||
channel: 'timesafari_community_updates'
|
||||
});
|
||||
|
||||
console.log('DailyNotification setup completed successfully!');
|
||||
// DailyNotification setup completed successfully
|
||||
|
||||
} catch (error) {
|
||||
console.error('Failed to setup DailyNotification:', error);
|
||||
@@ -232,22 +232,24 @@ class TimeSafariHomeView {
|
||||
if (this.activeDid && this.starredPlanHandleIds.length > 0) {
|
||||
try {
|
||||
// Use plugin's enhanced fetching with same interface as your existing code
|
||||
const starredProjectChanges = await this.integrationService!.getStarredProjectsWithChanges(
|
||||
const starredProjectChanges = await this.integrationService?.getStarredProjectsWithChanges(
|
||||
this.activeDid,
|
||||
this.starredPlanHandleIds,
|
||||
this.lastAckedStarredPlanChangesJwtId
|
||||
);
|
||||
|
||||
if (!starredProjectChanges) {
|
||||
this.numNewStarredProjectChanges = 0;
|
||||
this.newStarredProjectChangesHitLimit = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Same handling as your existing code
|
||||
this.numNewStarredProjectChanges = starredProjectChanges.data.length;
|
||||
this.newStarredProjectChangesHitLimit = starredProjectChanges.hitLimit;
|
||||
|
||||
// Enhanced logging (optional)
|
||||
console.log('Starred projects loaded successfully:', {
|
||||
count: this.numNewStarredProjectChanges,
|
||||
hitLimit: this.newStarredProjectChangesHitLimit,
|
||||
planIds: this.starredPlanHandleIds.length
|
||||
});
|
||||
// Starred projects loaded successfully
|
||||
|
||||
} catch (error) {
|
||||
// Same error handling as your existing code
|
||||
@@ -273,10 +275,7 @@ class TimeSafariHomeView {
|
||||
this.updateStarredProjectsUI(data);
|
||||
|
||||
// Enhanced logging (optional)
|
||||
console.log('Starred projects success callback:', {
|
||||
count: data.data.length,
|
||||
hitLimit: data.hitLimit
|
||||
});
|
||||
// Starred projects success callback
|
||||
}
|
||||
|
||||
async handleStarredProjectsError(error: Error): Promise<void> {
|
||||
@@ -293,17 +292,17 @@ class TimeSafariHomeView {
|
||||
});
|
||||
}
|
||||
|
||||
async handleStarredProjectsComplete(result: unknown): Promise<void> {
|
||||
async handleStarredProjectsComplete(_result: unknown): Promise<void> {
|
||||
// Handle completion
|
||||
console.log('Starred projects fetch completed:', result);
|
||||
// Starred projects fetch completed
|
||||
}
|
||||
|
||||
/**
|
||||
* Your existing methods (unchanged)
|
||||
*/
|
||||
private updateStarredProjectsUI(data: StarredProjectsResponse): void {
|
||||
private updateStarredProjectsUI(_data: StarredProjectsResponse): void {
|
||||
// Your existing UI update logic
|
||||
console.log('Updating UI with starred projects data:', data);
|
||||
// Updating UI with starred projects data
|
||||
}
|
||||
|
||||
private getTimeSafariStorageAdapter(): unknown {
|
||||
@@ -320,10 +319,10 @@ export async function setupDailyNotificationForTimeSafari(
|
||||
activeDid: string,
|
||||
starredPlanHandleIds: string[],
|
||||
lastAckedJwtId: string,
|
||||
apiServer: string = 'https://endorser.ch'
|
||||
apiServer = 'https://endorser.ch'
|
||||
): Promise<TimeSafariHomeView> {
|
||||
|
||||
console.log('Setting up DailyNotification for TimeSafari PWA...');
|
||||
// Setting up DailyNotification for TimeSafari PWA
|
||||
|
||||
// Create your existing HomeView instance
|
||||
const homeView = new TimeSafariHomeView(axiosInstance);
|
||||
@@ -340,14 +339,14 @@ export async function setupDailyNotificationForTimeSafari(
|
||||
// Test the enhanced method
|
||||
await homeView.loadNewStarredProjectChanges();
|
||||
|
||||
console.log('DailyNotification setup completed successfully!');
|
||||
// DailyNotification setup completed successfully
|
||||
|
||||
return homeView;
|
||||
}
|
||||
|
||||
// Vue.js component integration example
|
||||
export const TimeSafariDailyNotificationMixin = {
|
||||
data() {
|
||||
data(): Record<string, unknown> {
|
||||
return {
|
||||
// Your existing data
|
||||
activeDid: '',
|
||||
@@ -362,13 +361,13 @@ export const TimeSafariDailyNotificationMixin = {
|
||||
};
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
async mounted(): Promise<void> {
|
||||
// Setup DailyNotification when component mounts
|
||||
await this.setupDailyNotification();
|
||||
},
|
||||
|
||||
methods: {
|
||||
async setupDailyNotification() {
|
||||
async setupDailyNotification(): Promise<void> {
|
||||
try {
|
||||
// Configure DailyNotification plugin
|
||||
await DailyNotification.configure({
|
||||
@@ -415,7 +414,7 @@ export const TimeSafariDailyNotificationMixin = {
|
||||
},
|
||||
|
||||
// Your existing methods (enhanced)
|
||||
async loadNewStarredProjectChanges() {
|
||||
async loadNewStarredProjectChanges(): Promise<void> {
|
||||
if (this.activeDid && this.starredPlanHandleIds.length > 0) {
|
||||
try {
|
||||
const starredProjectChanges = await this.integrationService.getStarredProjectsWithChanges(
|
||||
@@ -438,24 +437,24 @@ export const TimeSafariDailyNotificationMixin = {
|
||||
}
|
||||
},
|
||||
|
||||
handleStarredProjectsSuccess(data: StarredProjectsResponse) {
|
||||
handleStarredProjectsSuccess(data: StarredProjectsResponse): void {
|
||||
this.numNewStarredProjectChanges = data.data.length;
|
||||
this.newStarredProjectChangesHitLimit = data.hitLimit;
|
||||
this.updateStarredProjectsUI(data);
|
||||
},
|
||||
|
||||
handleStarredProjectsError(error: Error) {
|
||||
handleStarredProjectsError(error: Error): void {
|
||||
console.warn('[HomeView] Failed to load starred project changes:', error);
|
||||
this.numNewStarredProjectChanges = 0;
|
||||
this.newStarredProjectChangesHitLimit = false;
|
||||
},
|
||||
|
||||
// Your existing methods
|
||||
updateStarredProjectsUI(data: StarredProjectsResponse) {
|
||||
updateStarredProjectsUI(_data: StarredProjectsResponse): void {
|
||||
// Your existing UI update logic
|
||||
},
|
||||
|
||||
getTimeSafariStorageAdapter() {
|
||||
getTimeSafariStorageAdapter(): unknown {
|
||||
// Your existing storage adapter
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user