fix(fe): resolve eslint any errors and format frontend files

This commit is contained in:
Dushnilin
2026-09-16 16:33:03 +03:00
parent 0f5967e51c
commit e10509033c
7 changed files with 1073 additions and 1055 deletions
File diff suppressed because it is too large Load Diff
@@ -137,7 +137,7 @@ export function resetDirectClashApiState() {
}
function getDisplayName(section: Tachyon.ConfigSection) {
return section.label || (section as any).name || section['.name'];
return section.label || section.name || section['.name'];
}
function getSettingsSection(configSections: Tachyon.ConfigSection[]) {
@@ -1806,7 +1806,7 @@ export async function getDashboardSections(
code: outbound?.code || sectionName,
displayName:
section.label ||
(section as any).name ||
section.name ||
section.interface ||
customName ||
defaultLabel,
@@ -184,7 +184,7 @@ function formatEndpoint(address?: string, port?: string | number): string {
function getDisplayName(section: Tachyon.ConfigSection) {
return (
normalizeString(section.label) ||
normalizeString((section as any).name) ||
normalizeString(section.name) ||
section['.name']
);
}
@@ -2031,7 +2031,7 @@ function renderComponentCard(card: ComponentCard) {
function isComponentCardVisible(
card: ComponentCard,
systemInfo: any,
systemInfo: Record<string, unknown>,
): boolean {
const component = card.component;
if (component === 'tachyon' || component === 'sing_box') {
@@ -2049,7 +2049,7 @@ function isComponentCardVisible(
}
const optKey = `show_component_${component}`;
const val = (systemInfo as Record<string, any>)[optKey];
const val = systemInfo[optKey];
if (val === undefined || val === null || val === '') {
return true;
}
@@ -82,7 +82,11 @@ function getUciSectionName(section) {
}
function getUciSectionLabel(section) {
return (section && section.label) || (section && section.name) || getUciSectionName(section);
return (
(section && section.label) ||
(section && section.name) ||
getUciSectionName(section)
);
}
function isOutboundDetourTargetSection(section, currentSectionId) {
@@ -12837,7 +12841,11 @@ function configureSectionSection(sectionRef, options = {}) {
setActionProvidersAvailabilityLoader(options.loadActionProvidersAvailability);
sectionRef.sectiontitle = function (section_id) {
return uci.get(UCI_PACKAGE, section_id, "label") || uci.get(UCI_PACKAGE, section_id, "name") || section_id;
return (
uci.get(UCI_PACKAGE, section_id, "label") ||
uci.get(UCI_PACKAGE, section_id, "name") ||
section_id
);
};
sectionRef.load = function () {
@@ -1384,7 +1384,9 @@ function createComponentsVisibilityWidget(option, section_id) {
}
});
const wrapper = E("div", { id: "components-visibility-widget-" + section_id });
const wrapper = E("div", {
id: "components-visibility-widget-" + section_id,
});
const listEl = E("div", {
style:
"border:1px solid var(--border-color,#dee2e6);border-radius:6px;overflow:hidden;margin-bottom:8px;max-width:560px;background:var(--card-bg,transparent);",
@@ -1549,7 +1551,9 @@ function createSettingsContent(section, capabilities) {
return createComponentsVisibilityWidget(this, section_id);
};
compVisOpt.formvalue = function (section_id) {
const el = document.getElementById("components-visibility-widget-" + section_id);
const el = document.getElementById(
"components-visibility-widget-" + section_id,
);
return el ? JSON.stringify(el._vis) : "";
};
compVisOpt.write = function (_section_id) {};
@@ -78,11 +78,17 @@ function configureGridSection(sectionRef, type, title, addTitle) {
sectionRef.rowcolors = true;
sectionRef.nodescriptions = true;
sectionRef.modaltitle = function (section_id) {
const label = uci.get(UCI_PACKAGE, section_id, "label") || uci.get(UCI_PACKAGE, section_id, "name");
const label =
uci.get(UCI_PACKAGE, section_id, "label") ||
uci.get(UCI_PACKAGE, section_id, "name");
return section_id ? `${title}: ${label || section_id}` : addTitle;
};
sectionRef.sectiontitle = function (section_id) {
return uci.get(UCI_PACKAGE, section_id, "label") || uci.get(UCI_PACKAGE, section_id, "name") || section_id;
return (
uci.get(UCI_PACKAGE, section_id, "label") ||
uci.get(UCI_PACKAGE, section_id, "name") ||
section_id
);
};
sectionRef.renderSectionAdd = function (extra_class) {
return renderSectionAdd(sectionRef, extra_class);