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/company-edit.js
// Create custom logger for company edit
@@ -11,6 +10,7 @@ function adminCompanyEdit() {
// Company edit page specific state
currentPage: 'company-edit',
loading: false,
company: null,
formData: {},
errors: {},
@@ -48,21 +48,26 @@ function adminCompanyEdit() {
}
window._companyEditInitialized = true;
// Get company ID from URL
const path = window.location.pathname;
const match = path.match(/\/admin\/companies\/(\d+)\/edit/);
try {
// Get company ID from URL
const path = window.location.pathname;
const match = path.match(/\/admin\/companies\/(\d+)\/edit/);
if (match) {
this.companyId = parseInt(match[1], 10);
companyEditLog.info('Editing company:', this.companyId);
await this.loadCompany();
} else {
companyEditLog.error('No company ID in URL');
Utils.showToast('Invalid company URL', 'error');
setTimeout(() => window.location.href = '/admin/companies', 2000);
if (match) {
this.companyId = parseInt(match[1], 10);
companyEditLog.info('Editing company:', this.companyId);
await this.loadCompany();
} else {
companyEditLog.error('No company ID in URL');
Utils.showToast('Invalid company URL', 'error');
setTimeout(() => window.location.href = '/admin/companies', 2000);
}
companyEditLog.info('=== COMPANY EDIT PAGE INITIALIZATION COMPLETE ===');
} catch (error) {
window.LogConfig.logError(error, 'Company Edit Init');
Utils.showToast('Failed to initialize page', 'error');
}
companyEditLog.info('=== COMPANY EDIT PAGE INITIALIZATION COMPLETE ===');
},
// Load company data