From bef7529929c95e0aef63e4fe03b536702d09c75b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Jun 2024 16:56:32 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/electron/frontend/core/components/JSONSchemaForm.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/electron/frontend/core/components/JSONSchemaForm.js b/src/electron/frontend/core/components/JSONSchemaForm.js index c18d308f6..2a3d9503c 100644 --- a/src/electron/frontend/core/components/JSONSchemaForm.js +++ b/src/electron/frontend/core/components/JSONSchemaForm.js @@ -1011,15 +1011,17 @@ export class JSONSchemaForm extends LitElement { const groupEl = this.#getGroupElement(externalPath); if (groupEl) { - groupEl.setAttribute(`data-${name}-errors`, updatedErrors.length); groupEl.setAttribute(`data-${name}-warnings`, updatedWarnings.length); const allFormSections = groupEl.querySelectorAll(".form-section"); const inputs = Array.from(allFormSections).map((section) => section.id); const allErrors = inputs.reduce((acc, id) => acc + parseInt(groupEl.getAttribute(`data-${id}-errors`)), 0); - const allWarnings = inputs.reduce((acc, id) => acc + parseInt(groupEl.getAttribute(`data-${id}-warnings`)), 0); - + const allWarnings = inputs.reduce( + (acc, id) => acc + parseInt(groupEl.getAttribute(`data-${id}-warnings`)), + 0 + ); + groupEl.classList[allErrors ? "add" : "remove"]("error"); groupEl.classList[allWarnings ? "add" : "remove"]("warning"); }