fix: resolve all JS-001 architecture warnings
- Exclude third-party vendor libraries from JS validation - Add noqa: js-001 to core infrastructure files (log-config, api-client, utils, icons) - Add centralized logger to vendor JS files (marketplace, letzshop, invoices, billing) - Replace console.log/error/warn with logger calls - Add noqa support to JS-001 rule in architecture validator 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// static/shared/js/api-client.js
|
||||
// noqa: js-001 - Core infrastructure, uses its own logger (apiLog)
|
||||
/**
|
||||
* API Client for Multi-Tenant Ecommerce Platform
|
||||
*
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// static/shared/js/icons.js
|
||||
// noqa: js-001 - Icon system initialization logging
|
||||
/**
|
||||
* Heroicons Icon System
|
||||
* Inline SVG icons with Alpine.js magic helper
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// static/shared/js/log-config.js
|
||||
// noqa: js-001 - This IS the centralized logger implementation
|
||||
/**
|
||||
* Centralized Logging Configuration for ALL Frontends
|
||||
*
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// static/shared/js/utils.js
|
||||
// noqa: js-001 - Core utilities, may log before logger is available
|
||||
/**
|
||||
* Utility functions for the application
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
const vendorSelectorLog = window.LogConfig?.loggers?.vendorSelector ||
|
||||
window.LogConfig?.createLogger?.('vendorSelector', false) ||
|
||||
{ info: console.log, warn: console.warn, error: console.error };
|
||||
{ info: console.log, warn: console.warn, error: console.error }; // noqa: js-001 - fallback if logger not ready
|
||||
|
||||
/**
|
||||
* Check if Tom Select is available, with retry logic
|
||||
|
||||
16
static/vendor/js/billing.js
vendored
16
static/vendor/js/billing.js
vendored
@@ -1,6 +1,8 @@
|
||||
// static/vendor/js/billing.js
|
||||
// Vendor billing and subscription management
|
||||
|
||||
const billingLog = window.LogConfig?.createLogger('BILLING') || console;
|
||||
|
||||
function billingData() {
|
||||
return {
|
||||
// State
|
||||
@@ -60,7 +62,7 @@ function billingData() {
|
||||
this.invoices = invoicesRes.invoices || [];
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error loading billing data:', error);
|
||||
billingLog.error('Error loading billing data:', error);
|
||||
this.showNotification('Failed to load billing data', 'error');
|
||||
} finally {
|
||||
this.loading = false;
|
||||
@@ -80,7 +82,7 @@ function billingData() {
|
||||
window.location.href = response.checkout_url;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error creating checkout:', error);
|
||||
billingLog.error('Error creating checkout:', error);
|
||||
this.showNotification('Failed to create checkout session', 'error');
|
||||
}
|
||||
},
|
||||
@@ -92,7 +94,7 @@ function billingData() {
|
||||
window.location.href = response.portal_url;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error opening portal:', error);
|
||||
billingLog.error('Error opening portal:', error);
|
||||
this.showNotification('Failed to open payment portal', 'error');
|
||||
}
|
||||
},
|
||||
@@ -109,7 +111,7 @@ function billingData() {
|
||||
await this.loadData();
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error cancelling subscription:', error);
|
||||
billingLog.error('Error cancelling subscription:', error);
|
||||
this.showNotification('Failed to cancel subscription', 'error');
|
||||
}
|
||||
},
|
||||
@@ -121,7 +123,7 @@ function billingData() {
|
||||
await this.loadData();
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error reactivating subscription:', error);
|
||||
billingLog.error('Error reactivating subscription:', error);
|
||||
this.showNotification('Failed to reactivate subscription', 'error');
|
||||
}
|
||||
},
|
||||
@@ -138,7 +140,7 @@ function billingData() {
|
||||
window.location.href = response.checkout_url;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error purchasing addon:', error);
|
||||
billingLog.error('Error purchasing addon:', error);
|
||||
this.showNotification('Failed to purchase add-on', 'error');
|
||||
} finally {
|
||||
this.purchasingAddon = null;
|
||||
@@ -155,7 +157,7 @@ function billingData() {
|
||||
this.showNotification('Add-on cancelled successfully', 'success');
|
||||
await this.loadData();
|
||||
} catch (error) {
|
||||
console.error('Error cancelling addon:', error);
|
||||
billingLog.error('Error cancelling addon:', error);
|
||||
this.showNotification('Failed to cancel add-on', 'error');
|
||||
}
|
||||
},
|
||||
|
||||
8
static/vendor/js/dashboard.js
vendored
8
static/vendor/js/dashboard.js
vendored
@@ -6,12 +6,12 @@
|
||||
// ✅ Use centralized logger
|
||||
const vendorDashLog = window.LogConfig.loggers.dashboard;
|
||||
|
||||
console.log('[VENDOR DASHBOARD] Loading...');
|
||||
console.log('[VENDOR DASHBOARD] data function exists?', typeof data);
|
||||
vendorDashLog.info('[VENDOR DASHBOARD] Loading...');
|
||||
vendorDashLog.info('[VENDOR DASHBOARD] data function exists?', typeof data);
|
||||
|
||||
function vendorDashboard() {
|
||||
console.log('[VENDOR DASHBOARD] vendorDashboard() called');
|
||||
console.log('[VENDOR DASHBOARD] data function exists inside?', typeof data);
|
||||
vendorDashLog.info('[VENDOR DASHBOARD] vendorDashboard() called');
|
||||
vendorDashLog.info('[VENDOR DASHBOARD] data function exists inside?', typeof data);
|
||||
|
||||
return {
|
||||
// ✅ Inherit base layout state (includes vendorCode, dark mode, menu states)
|
||||
|
||||
20
static/vendor/js/invoices.js
vendored
20
static/vendor/js/invoices.js
vendored
@@ -3,10 +3,12 @@
|
||||
* Vendor invoice management page logic
|
||||
*/
|
||||
|
||||
console.log('[VENDOR INVOICES] Loading...');
|
||||
const invoicesLog = window.LogConfig?.createLogger('INVOICES') || console;
|
||||
|
||||
invoicesLog.info('[VENDOR INVOICES] Loading...');
|
||||
|
||||
function vendorInvoices() {
|
||||
console.log('[VENDOR INVOICES] vendorInvoices() called');
|
||||
invoicesLog.info('[VENDOR INVOICES] vendorInvoices() called');
|
||||
|
||||
return {
|
||||
// Inherit base layout state
|
||||
@@ -122,7 +124,7 @@ function vendorInvoices() {
|
||||
} catch (error) {
|
||||
// 404 means not configured yet, which is fine
|
||||
if (error.status !== 404) {
|
||||
console.error('[VENDOR INVOICES] Failed to load settings:', error);
|
||||
invoicesLog.error('[VENDOR INVOICES] Failed to load settings:', error);
|
||||
}
|
||||
this.hasSettings = false;
|
||||
}
|
||||
@@ -143,7 +145,7 @@ function vendorInvoices() {
|
||||
cancelled_count: response.cancelled_count || 0
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('[VENDOR INVOICES] Failed to load stats:', error);
|
||||
invoicesLog.error('[VENDOR INVOICES] Failed to load stats:', error);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -168,7 +170,7 @@ function vendorInvoices() {
|
||||
this.invoices = response.items || [];
|
||||
this.totalInvoices = response.total || 0;
|
||||
} catch (error) {
|
||||
console.error('[VENDOR INVOICES] Failed to load invoices:', error);
|
||||
invoicesLog.error('[VENDOR INVOICES] Failed to load invoices:', error);
|
||||
this.error = error.message || 'Failed to load invoices';
|
||||
} finally {
|
||||
this.loading = false;
|
||||
@@ -228,7 +230,7 @@ function vendorInvoices() {
|
||||
this.hasSettings = true;
|
||||
this.successMessage = 'Settings saved successfully';
|
||||
} catch (error) {
|
||||
console.error('[VENDOR INVOICES] Failed to save settings:', error);
|
||||
invoicesLog.error('[VENDOR INVOICES] Failed to save settings:', error);
|
||||
this.error = error.message || 'Failed to save settings';
|
||||
} finally {
|
||||
this.savingSettings = false;
|
||||
@@ -277,7 +279,7 @@ function vendorInvoices() {
|
||||
await this.loadStats();
|
||||
await this.loadInvoices();
|
||||
} catch (error) {
|
||||
console.error('[VENDOR INVOICES] Failed to create invoice:', error);
|
||||
invoicesLog.error('[VENDOR INVOICES] Failed to create invoice:', error);
|
||||
this.error = error.message || 'Failed to create invoice';
|
||||
} finally {
|
||||
this.creatingInvoice = false;
|
||||
@@ -308,7 +310,7 @@ function vendorInvoices() {
|
||||
await this.loadStats();
|
||||
await this.loadInvoices();
|
||||
} catch (error) {
|
||||
console.error('[VENDOR INVOICES] Failed to update status:', error);
|
||||
invoicesLog.error('[VENDOR INVOICES] Failed to update status:', error);
|
||||
this.error = error.message || 'Failed to update invoice status';
|
||||
}
|
||||
setTimeout(() => this.successMessage = '', 5000);
|
||||
@@ -362,7 +364,7 @@ function vendorInvoices() {
|
||||
|
||||
this.successMessage = `Downloaded: ${filename}`;
|
||||
} catch (error) {
|
||||
console.error('[VENDOR INVOICES] Failed to download PDF:', error);
|
||||
invoicesLog.error('[VENDOR INVOICES] Failed to download PDF:', error);
|
||||
this.error = error.message || 'Failed to download PDF';
|
||||
} finally {
|
||||
this.downloadingPdf = false;
|
||||
|
||||
30
static/vendor/js/letzshop.js
vendored
30
static/vendor/js/letzshop.js
vendored
@@ -3,10 +3,12 @@
|
||||
* Vendor Letzshop orders management page logic
|
||||
*/
|
||||
|
||||
console.log('[VENDOR LETZSHOP] Loading...');
|
||||
const letzshopLog = window.LogConfig?.createLogger('LETZSHOP') || console;
|
||||
|
||||
letzshopLog.info('[VENDOR LETZSHOP] Loading...');
|
||||
|
||||
function vendorLetzshop() {
|
||||
console.log('[VENDOR LETZSHOP] vendorLetzshop() called');
|
||||
letzshopLog.info('[VENDOR LETZSHOP] vendorLetzshop() called');
|
||||
|
||||
return {
|
||||
// Inherit base layout state
|
||||
@@ -107,7 +109,7 @@ function vendorLetzshop() {
|
||||
await this.loadCredentials();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[VENDOR LETZSHOP] Failed to load status:', error);
|
||||
letzshopLog.error('[VENDOR LETZSHOP] Failed to load status:', error);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -123,7 +125,7 @@ function vendorLetzshop() {
|
||||
} catch (error) {
|
||||
// 404 means not configured, which is fine
|
||||
if (error.status !== 404) {
|
||||
console.error('[VENDOR LETZSHOP] Failed to load credentials:', error);
|
||||
letzshopLog.error('[VENDOR LETZSHOP] Failed to load credentials:', error);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -152,7 +154,7 @@ function vendorLetzshop() {
|
||||
// Calculate stats
|
||||
await this.loadOrderStats();
|
||||
} catch (error) {
|
||||
console.error('[VENDOR LETZSHOP] Failed to load orders:', error);
|
||||
letzshopLog.error('[VENDOR LETZSHOP] Failed to load orders:', error);
|
||||
this.error = error.message || 'Failed to load orders';
|
||||
} finally {
|
||||
this.loading = false;
|
||||
@@ -175,7 +177,7 @@ function vendorLetzshop() {
|
||||
shipped: allOrders.filter(o => o.sync_status === 'shipped').length
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('[VENDOR LETZSHOP] Failed to load order stats:', error);
|
||||
letzshopLog.error('[VENDOR LETZSHOP] Failed to load order stats:', error);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -214,7 +216,7 @@ function vendorLetzshop() {
|
||||
this.error = response.message || 'Import failed';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[VENDOR LETZSHOP] Import failed:', error);
|
||||
letzshopLog.error('[VENDOR LETZSHOP] Import failed:', error);
|
||||
this.error = error.message || 'Failed to import orders';
|
||||
} finally {
|
||||
this.importing = false;
|
||||
@@ -250,7 +252,7 @@ function vendorLetzshop() {
|
||||
this.status.is_configured = true;
|
||||
this.successMessage = 'Credentials saved successfully';
|
||||
} catch (error) {
|
||||
console.error('[VENDOR LETZSHOP] Failed to save credentials:', error);
|
||||
letzshopLog.error('[VENDOR LETZSHOP] Failed to save credentials:', error);
|
||||
this.error = error.message || 'Failed to save credentials';
|
||||
} finally {
|
||||
this.saving = false;
|
||||
@@ -274,7 +276,7 @@ function vendorLetzshop() {
|
||||
this.error = response.error_details || 'Connection failed';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[VENDOR LETZSHOP] Connection test failed:', error);
|
||||
letzshopLog.error('[VENDOR LETZSHOP] Connection test failed:', error);
|
||||
this.error = error.message || 'Connection test failed';
|
||||
} finally {
|
||||
this.testing = false;
|
||||
@@ -301,7 +303,7 @@ function vendorLetzshop() {
|
||||
};
|
||||
this.successMessage = 'Credentials removed';
|
||||
} catch (error) {
|
||||
console.error('[VENDOR LETZSHOP] Failed to delete credentials:', error);
|
||||
letzshopLog.error('[VENDOR LETZSHOP] Failed to delete credentials:', error);
|
||||
this.error = error.message || 'Failed to remove credentials';
|
||||
}
|
||||
setTimeout(() => this.successMessage = '', 5000);
|
||||
@@ -325,7 +327,7 @@ function vendorLetzshop() {
|
||||
this.error = response.message || 'Failed to confirm order';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[VENDOR LETZSHOP] Failed to confirm order:', error);
|
||||
letzshopLog.error('[VENDOR LETZSHOP] Failed to confirm order:', error);
|
||||
this.error = error.message || 'Failed to confirm order';
|
||||
}
|
||||
setTimeout(() => this.successMessage = '', 5000);
|
||||
@@ -349,7 +351,7 @@ function vendorLetzshop() {
|
||||
this.error = response.message || 'Failed to reject order';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[VENDOR LETZSHOP] Failed to reject order:', error);
|
||||
letzshopLog.error('[VENDOR LETZSHOP] Failed to reject order:', error);
|
||||
this.error = error.message || 'Failed to reject order';
|
||||
}
|
||||
setTimeout(() => this.successMessage = '', 5000);
|
||||
@@ -392,7 +394,7 @@ function vendorLetzshop() {
|
||||
this.error = response.message || 'Failed to save tracking';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[VENDOR LETZSHOP] Failed to set tracking:', error);
|
||||
letzshopLog.error('[VENDOR LETZSHOP] Failed to set tracking:', error);
|
||||
this.error = error.message || 'Failed to save tracking';
|
||||
} finally {
|
||||
this.submittingTracking = false;
|
||||
@@ -471,7 +473,7 @@ function vendorLetzshop() {
|
||||
|
||||
this.successMessage = `Export downloaded: ${filename}`;
|
||||
} catch (error) {
|
||||
console.error('[VENDOR LETZSHOP] Export failed:', error);
|
||||
letzshopLog.error('[VENDOR LETZSHOP] Export failed:', error);
|
||||
this.error = error.message || 'Failed to export products';
|
||||
} finally {
|
||||
this.exporting = false;
|
||||
|
||||
28
static/vendor/js/marketplace.js
vendored
28
static/vendor/js/marketplace.js
vendored
@@ -6,10 +6,10 @@
|
||||
// ✅ Use centralized logger
|
||||
const vendorMarketplaceLog = window.LogConfig.loggers.marketplace;
|
||||
|
||||
console.log('[VENDOR MARKETPLACE] Loading...');
|
||||
vendorMarketplaceLog.info('[VENDOR MARKETPLACE] Loading...');
|
||||
|
||||
function vendorMarketplace() {
|
||||
console.log('[VENDOR MARKETPLACE] vendorMarketplace() called');
|
||||
vendorMarketplaceLog.info('[VENDOR MARKETPLACE] vendorMarketplace() called');
|
||||
|
||||
return {
|
||||
// ✅ Inherit base layout state
|
||||
@@ -84,7 +84,7 @@ function vendorMarketplace() {
|
||||
letzshop_csv_url_de: response.letzshop_csv_url_de || ''
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('[VENDOR MARKETPLACE] Failed to load vendor settings:', error);
|
||||
vendorMarketplaceLog.error('[VENDOR MARKETPLACE] Failed to load vendor settings:', error);
|
||||
// Non-critical, don't show error to user
|
||||
}
|
||||
},
|
||||
@@ -104,9 +104,9 @@ function vendorMarketplace() {
|
||||
this.jobs = response.items || [];
|
||||
this.totalJobs = response.total || 0;
|
||||
|
||||
console.log('[VENDOR MARKETPLACE] Loaded jobs:', this.jobs.length);
|
||||
vendorMarketplaceLog.info('[VENDOR MARKETPLACE] Loaded jobs:', this.jobs.length);
|
||||
} catch (error) {
|
||||
console.error('[VENDOR MARKETPLACE] Failed to load jobs:', error);
|
||||
vendorMarketplaceLog.error('[VENDOR MARKETPLACE] Failed to load jobs:', error);
|
||||
this.error = error.message || 'Failed to load import jobs';
|
||||
} finally {
|
||||
this.loading = false;
|
||||
@@ -133,11 +133,11 @@ function vendorMarketplace() {
|
||||
batch_size: this.importForm.batch_size
|
||||
};
|
||||
|
||||
console.log('[VENDOR MARKETPLACE] Starting import:', payload);
|
||||
vendorMarketplaceLog.info('[VENDOR MARKETPLACE] Starting import:', payload);
|
||||
|
||||
const response = await apiClient.post('/vendor/marketplace/import', payload);
|
||||
|
||||
console.log('[VENDOR MARKETPLACE] Import started:', response);
|
||||
vendorMarketplaceLog.info('[VENDOR MARKETPLACE] Import started:', response);
|
||||
|
||||
this.successMessage = `Import job #${response.job_id} started successfully!`;
|
||||
|
||||
@@ -154,7 +154,7 @@ function vendorMarketplace() {
|
||||
this.successMessage = '';
|
||||
}, 5000);
|
||||
} catch (error) {
|
||||
console.error('[VENDOR MARKETPLACE] Failed to start import:', error);
|
||||
vendorMarketplaceLog.error('[VENDOR MARKETPLACE] Failed to start import:', error);
|
||||
this.error = error.message || 'Failed to start import';
|
||||
} finally {
|
||||
this.importing = false;
|
||||
@@ -175,7 +175,7 @@ function vendorMarketplace() {
|
||||
if (url) {
|
||||
this.importForm.csv_url = url;
|
||||
this.importForm.language = language;
|
||||
console.log('[VENDOR MARKETPLACE] Quick filled:', language, url);
|
||||
vendorMarketplaceLog.info('[VENDOR MARKETPLACE] Quick filled:', language, url);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -204,9 +204,9 @@ function vendorMarketplace() {
|
||||
this.selectedJob = response;
|
||||
}
|
||||
|
||||
console.log('[VENDOR MARKETPLACE] Refreshed job:', jobId);
|
||||
vendorMarketplaceLog.info('[VENDOR MARKETPLACE] Refreshed job:', jobId);
|
||||
} catch (error) {
|
||||
console.error('[VENDOR MARKETPLACE] Failed to refresh job:', error);
|
||||
vendorMarketplaceLog.error('[VENDOR MARKETPLACE] Failed to refresh job:', error);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -218,9 +218,9 @@ function vendorMarketplace() {
|
||||
const response = await apiClient.get(`/vendor/marketplace/imports/${jobId}`);
|
||||
this.selectedJob = response;
|
||||
this.showJobModal = true;
|
||||
console.log('[VENDOR MARKETPLACE] Viewing job details:', jobId);
|
||||
vendorMarketplaceLog.info('[VENDOR MARKETPLACE] Viewing job details:', jobId);
|
||||
} catch (error) {
|
||||
console.error('[VENDOR MARKETPLACE] Failed to load job details:', error);
|
||||
vendorMarketplaceLog.error('[VENDOR MARKETPLACE] Failed to load job details:', error);
|
||||
this.error = error.message || 'Failed to load job details';
|
||||
}
|
||||
},
|
||||
@@ -315,7 +315,7 @@ function vendorMarketplace() {
|
||||
);
|
||||
|
||||
if (hasActiveJobs) {
|
||||
console.log('[VENDOR MARKETPLACE] Auto-refreshing active jobs...');
|
||||
vendorMarketplaceLog.info('[VENDOR MARKETPLACE] Auto-refreshing active jobs...');
|
||||
await this.loadJobs();
|
||||
}
|
||||
}, 10000); // 10 seconds
|
||||
|
||||
Reference in New Issue
Block a user