Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 10, 2024
1 parent a3870f0 commit bef7529
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/electron/frontend/core/components/JSONSchemaForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit bef7529

Please sign in to comment.