From f8af99b058b60a9ca0cfdae358e766863c034661 Mon Sep 17 00:00:00 2001 From: Jarrod Flesch Date: Wed, 19 Jan 2022 11:22:27 -0500 Subject: [PATCH] chore: renames flatten to unflatten in reduceFieldsToValues, disables automatic arrow function return in eslint --- .eslintrc.js | 1 + src/admin/components/forms/Form/reduceFieldsToValues.ts | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 575d038773..53ef3f3d7b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -51,6 +51,7 @@ module.exports = { 'react/no-unused-prop-types': 'off', 'no-underscore-dangle': 'off', 'no-use-before-define': 'off', + 'arrow-body-style': 0, '@typescript-eslint/no-use-before-define': ['error'], 'import/extensions': [ 'error', diff --git a/src/admin/components/forms/Form/reduceFieldsToValues.ts b/src/admin/components/forms/Form/reduceFieldsToValues.ts index 6fbe19bbc0..56dbdeec17 100644 --- a/src/admin/components/forms/Form/reduceFieldsToValues.ts +++ b/src/admin/components/forms/Form/reduceFieldsToValues.ts @@ -1,7 +1,7 @@ -import { unflatten } from 'flatley'; +import { unflatten as flatleyUnflatten } from 'flatley'; import { Fields, Data } from './types'; -const reduceFieldsToValues = (fields: Fields, flatten?: boolean): Data => { +const reduceFieldsToValues = (fields: Fields, unflatten?: boolean): Data => { const data = {}; Object.keys(fields).forEach((key) => { @@ -14,8 +14,8 @@ const reduceFieldsToValues = (fields: Fields, flatten?: boolean): Data => { } }); - if (flatten) { - const unflattened = unflatten(data, { safe: true }); + if (unflatten) { + const unflattened = flatleyUnflatten(data, { safe: true }); return unflattened; }