mirror of
https://github.com/jamescliffordspratt/macros.git
synced 2026-07-22 05:46:53 +00:00
Mark fire-and-forget promises with void (no-floating-promises)
This commit is contained in:
parent
3f0d320c51
commit
8d1c5a345a
14 changed files with 52 additions and 64 deletions
1
lintreport.json
Normal file
1
lintreport.json
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -214,7 +214,7 @@ export class RefreshManager {
|
|||
if (view.previewMode && typeof view.previewMode.rerender === 'function') {
|
||||
view.previewMode.rerender(true);
|
||||
} else {
|
||||
leaf.setViewState(leaf.getViewState());
|
||||
void leaf.setViewState(leaf.getViewState());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ export class MacrosCalcRenderer {
|
|||
|
||||
private saveMetricsConfig(): void {
|
||||
this.plugin.settings.macroscalcMetricsConfigs = this.metricsConfigs;
|
||||
this.plugin.saveSettings();
|
||||
void this.plugin.saveSettings();
|
||||
}
|
||||
|
||||
// Add this method to get display options from metrics config
|
||||
|
|
@ -590,7 +590,7 @@ export class MacrosCalcRenderer {
|
|||
this.setNeedsRefresh();
|
||||
|
||||
// Force re-render the entire component with fresh calculations
|
||||
this.render(this.lastCalculatedTotals, this.lastBreakdownData);
|
||||
void this.render(this.lastCalculatedTotals, this.lastBreakdownData);
|
||||
}
|
||||
|
||||
private refreshDashboard(): void {
|
||||
|
|
@ -979,7 +979,7 @@ export class MacrosCalcRenderer {
|
|||
|
||||
const loadingMessage = detailCell.createEl('p', { text: t('general.loading') });
|
||||
|
||||
(async () => {
|
||||
void (async () => {
|
||||
try {
|
||||
const context = await this.plugin.dataManager.getDocumentContext(item.id);
|
||||
const detailContent = detailCell.createDiv();
|
||||
|
|
@ -1793,11 +1793,4 @@ export class MacrosCalcRenderer {
|
|||
this.chartLoader.destroyChart(caloriesChartId);
|
||||
}
|
||||
} catch (e) {
|
||||
this.plugin.logger.error('Error destroying chart:', e);
|
||||
}
|
||||
});
|
||||
|
||||
this.charts = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
this.plugin.logger.er
|
||||
|
|
@ -30,7 +30,7 @@ export function registerMacrosCalcProcessor(plugin: MacrosPlugin): void {
|
|||
// Add a global event listener for refresh events
|
||||
plugin.registerEvent(
|
||||
plugin.app.workspace.on('layout-change', () => {
|
||||
forceRefreshAllRenderers(plugin);
|
||||
void forceRefreshAllRenderers(plugin);
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -855,10 +855,10 @@ export class NutritionalSettingTab extends PluginSettingTab {
|
|||
previewCanvas.id = this.chartId;
|
||||
|
||||
window.setTimeout(() => {
|
||||
this.initChartPreview(previewCanvas);
|
||||
void this.initChartPreview(previewCanvas);
|
||||
}, 50);
|
||||
|
||||
this.initChartPreview(previewCanvas);
|
||||
void this.initChartPreview(previewCanvas);
|
||||
}
|
||||
|
||||
private renderFoodSourcesTab(containerEl: HTMLElement): void {
|
||||
|
|
@ -1987,7 +1987,4 @@ export class NutritionalSettingTab extends PluginSettingTab {
|
|||
this.previewChart.update();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error creating preview chart:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
console.error('Error creating previ
|
||||
|
|
@ -299,9 +299,9 @@ export class LiveFoodSearchModal extends Modal {
|
|||
this.currentSearchAbortController = null;
|
||||
}
|
||||
if (this.isBarcodeSearch) {
|
||||
this.performBarcodeSearch(currentQuery);
|
||||
void this.performBarcodeSearch(currentQuery);
|
||||
} else if (!this.restoreResultsFromCache(currentQuery)) {
|
||||
this.performSearch(currentQuery);
|
||||
void this.performSearch(currentQuery);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -546,9 +546,9 @@ export class LiveFoodSearchModal extends Modal {
|
|||
// Detect if this looks like a barcode (all numbers, 8-14 digits)
|
||||
if (/^\d{8,14}$/.test(searchTerm)) {
|
||||
this.isBarcodeSearch = true;
|
||||
this.performBarcodeSearch(searchTerm);
|
||||
void this.performBarcodeSearch(searchTerm);
|
||||
} else {
|
||||
this.performSearch(searchTerm);
|
||||
void this.performSearch(searchTerm);
|
||||
}
|
||||
}
|
||||
}, 300);
|
||||
|
|
@ -569,7 +569,7 @@ export class LiveFoodSearchModal extends Modal {
|
|||
this.scrollToSelectedResult();
|
||||
} else if (event.key === 'Enter' && this.selectedIndex >= 0) {
|
||||
event.preventDefault();
|
||||
this.handleFoodSelection(this.results[this.selectedIndex]);
|
||||
void this.handleFoodSelection(this.results[this.selectedIndex]);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1144,7 +1144,7 @@ export class LiveFoodSearchModal extends Modal {
|
|||
}
|
||||
|
||||
this.component.registerDomEvent(foodDiv, 'click', () => {
|
||||
this.handleFoodSelection(food);
|
||||
void this.handleFoodSelection(food);
|
||||
});
|
||||
|
||||
this.component.registerDomEvent(foodDiv, 'mouseenter', () => {
|
||||
|
|
@ -1485,7 +1485,7 @@ ${food.description}
|
|||
// Create new scroll handler
|
||||
// Fixed: Prefix unused parameter with underscore
|
||||
this.scrollHandler = (_event: Event) => {
|
||||
this.handleScroll();
|
||||
void this.handleScroll();
|
||||
};
|
||||
|
||||
// Add new scroll listener
|
||||
|
|
@ -1872,3 +1872,4 @@ class FileNameModal extends Modal {
|
|||
this.contentEl.empty();
|
||||
}
|
||||
}
|
||||
| ||||