From 20564b093d257191e070751daea376f4c09718f1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 19:58:57 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/renderer/src/stories/JSONSchemaForm.js | 11 ++++------- .../guided-mode/data/GuidedPathExpansion.js | 18 ++++++++---------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/renderer/src/stories/JSONSchemaForm.js b/src/renderer/src/stories/JSONSchemaForm.js index a3d425cc4..d0b3a592d 100644 --- a/src/renderer/src/stories/JSONSchemaForm.js +++ b/src/renderer/src/stories/JSONSchemaForm.js @@ -60,7 +60,7 @@ export const getSchema = (path, schema, base = []) => { // if (resolved?.["$ref"]) return this.getSchema(resolved["$ref"].split("/").slice(1)); // NOTE: This assumes reference to the root of the schema return resolved; -} +}; const additionalPropPattern = "additional"; @@ -463,8 +463,7 @@ export class JSONSchemaForm extends LitElement { }; validate = async (resolved = this.resolved) => { - - if (this.validateEmptyValues === false) this.validateEmptyValues = true + if (this.validateEmptyValues === false) this.validateEmptyValues = true; // Validate against the entire JSON Schema const copy = structuredClone(resolved); @@ -570,7 +569,7 @@ export class JSONSchemaForm extends LitElement { return this.#schema; } - getSchema = (path, schema = this.schema) => getSchema(path, schema, this.base); + getSchema = (path, schema = this.schema) => getSchema(path, schema, this.base); #renderInteractiveElement = (name, info, required, path = [], value, propertyType) => { let isRequired = this.#isRequired([...path, name]); @@ -880,9 +879,7 @@ export class JSONSchemaForm extends LitElement { type: "error", missing: true, }); - } - - else if (this.validateEmptyValues === null) { + } else if (this.validateEmptyValues === null) { warnings.push({ message: `${schema.title ?? header(name)} is a suggested property.`, type: "warning", diff --git a/src/renderer/src/stories/pages/guided-mode/data/GuidedPathExpansion.js b/src/renderer/src/stories/pages/guided-mode/data/GuidedPathExpansion.js index cee51209c..8f88aec22 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedPathExpansion.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedPathExpansion.js @@ -26,12 +26,12 @@ export async function autocompleteFormatString(path) { const { base_directory } = path.reduce((acc, key) => acc[key] ?? {}, this.form.resolved); const schema = getSchema(path, this.info.globalState.schema.source_data); - - const isFile = 'file_path' in schema.properties - const pathType = isFile ? 'file' : 'directory' - const description = isFile ? schema.properties.file_path.description : schema.properties.folder_path.description - + const isFile = "file_path" in schema.properties; + const pathType = isFile ? "file" : "directory"; + + const description = isFile ? schema.properties.file_path.description : schema.properties.folder_path.description; + const notify = (message, type) => { if (notification) this.dismiss(notification); return (notification = this.notify(message, type)); @@ -61,7 +61,7 @@ export async function autocompleteFormatString(path) { properties: { path: { type: "string", - title: `Example ${isFile ? 'File' : "Folder"}`, + title: `Example ${isFile ? "File" : "Folder"}`, format: pathType, description: description ?? `Provide an example ${pathType} for the selected interface`, }, @@ -81,12 +81,10 @@ export async function autocompleteFormatString(path) { const value = parent[name]; if (name === "path") { - - const toUpdate = ['subject_id', 'session_id'] - toUpdate.forEach(key => form.getFormElement([key]).requestUpdate()) + const toUpdate = ["subject_id", "session_id"]; + toUpdate.forEach((key) => form.getFormElement([key]).requestUpdate()); if (value) { - if (fs.lstatSync(value).isSymbolicLink()) return [ {