fix: resolve JS-006 and JS-007 architecture violations

- Add loading: false to 5 components for JS-007 compliance
- Add try/catch to async init() functions for JS-006 compliance
- Remove noqa comments from company-edit, vendor-edit, user-edit

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-31 21:46:22 +01:00
parent 1743b2bddf
commit 7aef110cac
5 changed files with 59 additions and 42 deletions

View File

@@ -1,4 +1,3 @@
// noqa: js-006 - async init pattern is safe, loadData has try/catch
// static/admin/js/vendor-edit.js
// ✅ Use centralized logger - ONE LINE!
@@ -12,6 +11,7 @@ function adminVendorEdit() {
// Vendor edit page specific state
currentPage: 'vendor-edit',
loading: false,
vendor: null,
formData: {},
errors: {},
@@ -30,21 +30,26 @@ function adminVendorEdit() {
}
window._vendorEditInitialized = true;
// Get vendor code from URL
const path = window.location.pathname;
const match = path.match(/\/admin\/vendors\/([^\/]+)\/edit/);
try {
// Get vendor code from URL
const path = window.location.pathname;
const match = path.match(/\/admin\/vendors\/([^\/]+)\/edit/);
if (match) {
this.vendorCode = match[1];
editLog.info('Editing vendor:', this.vendorCode);
await this.loadVendor();
} else {
editLog.error('No vendor code in URL');
Utils.showToast('Invalid vendor URL', 'error');
setTimeout(() => window.location.href = '/admin/vendors', 2000);
if (match) {
this.vendorCode = match[1];
editLog.info('Editing vendor:', this.vendorCode);
await this.loadVendor();
} else {
editLog.error('No vendor code in URL');
Utils.showToast('Invalid vendor URL', 'error');
setTimeout(() => window.location.href = '/admin/vendors', 2000);
}
editLog.info('=== VENDOR EDIT PAGE INITIALIZATION COMPLETE ===');
} catch (error) {
window.LogConfig.logError(error, 'Vendor Edit Init');
Utils.showToast('Failed to initialize page', 'error');
}
editLog.info('=== VENDOR EDIT PAGE INITIALIZATION COMPLETE ===');
},
// Load vendor data