Lint and tidying up

This commit is contained in:
Dean 2024-06-26 14:29:42 +01:00
parent 9adae8a9fd
commit 21c335caab
7 changed files with 16 additions and 22 deletions

View File

@ -7,7 +7,6 @@
export let disabled = true
</script>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div class:container={!!tooltip}>
<slot />
{#if tooltip}

View File

@ -272,7 +272,7 @@
*/
const onRowTriggerUpdate = async update => {
if (
update.hasOwnProperty("tableId") &&
Object.hasOwn(update, "tableId") &&
$selectedAutomation.testData?.row?.tableId !== update.tableId
) {
try {
@ -301,7 +301,7 @@
return
} catch (e) {
console.error("Error saving automation", error)
console.error("Error saving automation", e)
notifications.error("Error saving automation")
}
}
@ -328,7 +328,7 @@
// Exclude default or invalid data from the test data
let updatedFields = {}
for (const key of Object.keys(block?.inputs?.fields || {})) {
if (update.fields.hasOwnProperty(key)) {
if (Object.hasOwn(update.fields, key)) {
if (key !== "") {
updatedFields[key] = updatedAutomation.testData?.fields?.[key]
}
@ -343,7 +343,7 @@
},
})
} catch (e) {
console.error("Error saving automation", error)
console.error("Error saving automation", e)
notifications.error("Error saving automation")
}
}

View File

@ -20,7 +20,6 @@
$: {
let fields = {}
// DEAN - review this
for (const [key, type] of Object.entries(block?.inputs?.fields ?? {})) {
fields = {
...fields,

View File

@ -1,7 +1,6 @@
<script>
import { tables } from "stores/builder"
import {
Label,
ActionButton,
Popover,
Icon,
@ -74,8 +73,8 @@
schemaFields = Object.entries(table?.schema ?? {})
.filter(entry => {
const [key, field] = entry
return field.type !== "formula" && !field.autocolumn // DEAN - revise autocolumn exclusion for testmodal
const [, field] = entry
return field.type !== "formula" && !field.autocolumn
})
.sort(
([, schemaA], [, schemaB]) =>
@ -84,7 +83,7 @@
// Parse out any data not in the schema.
for (const column in editableFields) {
if (!(column in table?.schema)) {
if (!Object.hasOwn(table?.schema, column)) {
delete editableFields[column]
}
}
@ -99,7 +98,7 @@
editableRow[key] == null || editableRow[key]?.length === 0
// Put non-empty elements into the update and add their key to the fields list.
if (!emptyField && !editableFields.hasOwnProperty(key)) {
if (!emptyField && !Object.hasOwn(editableFields, key)) {
editableFields = {
...editableFields,
[key]: key,
@ -111,7 +110,7 @@
if (emptyField) {
if (editableFields[key]?.clearRelationships === true) {
const emptyField = coerce(
!$memoStore?.row.hasOwnProperty(key) ? "" : $memoStore?.row[key],
!Object.hasOwn($memoStore?.row, key) ? "" : $memoStore?.row[key],
fieldSchema.type
)
@ -209,7 +208,6 @@
let outcome = Object.keys(result).reduce((acc, key) => {
if (result[key] !== null) {
acc[key] = result[key]
} else {
}
return acc
}, {})
@ -234,7 +232,7 @@
</script>
{#each schemaFields || [] as [field, schema]}
{#if !schema.autocolumn && editableFields.hasOwnProperty(field)}
{#if !schema.autocolumn && Object.hasOwn(editableFields, field)}
<PropField label={field} fullWidth={isFullWidth(schema.type)}>
<div class="prop-control-wrap">
{#if isTestModal}
@ -329,9 +327,9 @@
{#if !schema.autocolumn}
<li
class="table_field spectrum-Menu-item"
class:is-selected={editableFields.hasOwnProperty(field)}
on:click={e => {
if (editableFields.hasOwnProperty(field)) {
class:is-selected={Object.hasOwn(editableFields, field)}
on:click={() => {
if (Object.hasOwn(editableFields, field)) {
editableFields[field] = null
} else {
editableFields[field] = {}

View File

@ -42,7 +42,6 @@
function handleAttachmentParams(keyValueObj) {
let params = {}
// DEAN - review this
if (!keyValueObj) {
return null
}

View File

@ -93,7 +93,7 @@ export async function run({ inputs, appId, emitter }: AutomationStepInput) {
if (isEmpty) {
if (
inputs.meta?.fields.hasOwnProperty(key) &&
Object.hasOwn(inputs.meta?.fields, key) &&
fieldConfig?.clearRelationships === true
) {
// Explicitly clear the field on update
@ -113,11 +113,11 @@ export async function run({ inputs, appId, emitter }: AutomationStepInput) {
(acc: Record<string, any>, key: string) => {
const fieldConfig = inputs.meta?.fields?.[key]
// Ignore legacy config.
if (fieldConfig.hasOwnProperty("clearRelationships")) {
if (Object.hasOwn(fieldConfig, "clearRelationships")) {
return acc
}
acc[key] =
inputs.row.hasOwnProperty(key) &&
Object.hasOwn(inputs.row, key) &&
(!inputs.row[key] || inputs.row[key]?.length === 0)
? null
: inputs.row[key]

View File

@ -21,7 +21,6 @@ const parseArrayString = (value: any) => {
*/
export const TYPE_TRANSFORM_MAP: any = {
[FieldType.LINK]: {
null: [],
"": [],
//@ts-ignore
[null]: [],