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 Feb 29, 2024
1 parent 945b62c commit 20564b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
11 changes: 4 additions & 7 deletions src/renderer/src/stories/JSONSchemaForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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`,
},
Expand All @@ -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 [
{
Expand Down

0 comments on commit 20564b0

Please sign in to comment.