From 24ef6b90bb722bdbb48358c4357a4453840e6687 Mon Sep 17 00:00:00 2001 From: knod Date: Sun, 2 Dec 2018 07:55:59 -0500 Subject: [PATCH 1/4] Cleans '/src/utils' through 'interpolation.js'. #1018 --- src/utils/CLIENT_DEFAULTS.js | 18 ++++----- src/utils/cashflow.js | 24 ++++++------ src/utils/convert-by-timescale.js | 42 ++++++++++---------- src/utils/convertForUpdate.js | 5 +-- src/utils/getGovData.js | 64 ++++++++++++++++--------------- src/utils/getMembers.js | 49 +++++++++++------------ src/utils/getSideEffects.js | 5 ++- src/utils/getTextForLanguage.js | 21 +++++----- src/utils/getTimeFrames.js | 12 ++++-- src/utils/getUserConfirmation.js | 25 ++++++------ src/utils/interpolation.js | 23 +++++++---- 11 files changed, 151 insertions(+), 137 deletions(-) diff --git a/src/utils/CLIENT_DEFAULTS.js b/src/utils/CLIENT_DEFAULTS.js index fd9e9211..eef9d7a5 100644 --- a/src/utils/CLIENT_DEFAULTS.js +++ b/src/utils/CLIENT_DEFAULTS.js @@ -9,20 +9,20 @@ import { cloneDeep } from 'lodash'; */ const CLIENT_DEFAULTS = { - // Property Name | Default Value | Valid Value Description + // Property Name | Default Value | Valid Value Description - // @todo get this value from the app somewhere - USState: 'MA', // Two-letter code denoting the state the client is in + // @todo get this value from the app somewhere + USState: `MA`, // Two-letter code denoting the state the client is in current: { // Current programs - benefits: [], // Benefit names (e.g. 'snap', 'section8') + benefits: [], // Benefit names (e.g. 'snap', 'section8') // Household // 'm_' for 'member' household: [ - { // 'head' member // one or more member objects - m_age: 30, // whole number - m_role: 'head', // 'head', 'spouse', 'member' + { // 'head' member // one or more member objects + m_age: 30, // whole number + m_role: `head`, // 'head', 'spouse', 'member' m_disabled: false, // boolean }, ], @@ -53,7 +53,7 @@ const CLIENT_DEFAULTS = { disabledMedical: 0, // positive number otherMedical: 0, // positive number /** @todo Make housing expense values more robust. */ - housing: 'homeless', // 'homeless', 'homeowner', 'renter', 'voucher' + housing: `homeless`, // 'homeless', 'homeowner', 'renter', 'voucher' contractRent: 0, // positive number rentShare: 0, // positive number rent: 0, // positive number @@ -78,7 +78,7 @@ const CLIENT_DEFAULTS = { }, // Note: A `future` value will default to the client's `current` value until a user changes it explicitly - future: {}, // same structure // same + future: {}, // same structure // same }; diff --git a/src/utils/cashflow.js b/src/utils/cashflow.js index 9084342c..75c2150d 100644 --- a/src/utils/cashflow.js +++ b/src/utils/cashflow.js @@ -34,7 +34,7 @@ import { const getDependentCostsMonthly = function (client) { let props = UNDER13_CARE_EXPENSES.concat(OVER12_CARE_EXPENSES); return sumProps(client, props); -}; // End getDependentCostsMonthly() +}; /** @@ -47,27 +47,27 @@ const getDependentCostsMonthly = function (client) { */ const getUnder13Expenses = function (client) { return sumProps(client, UNDER13_CARE_EXPENSES); -}; // End getUnder13Expenses() +}; const getOver12Expenses = function (client) { return sumProps(client, OVER12_CARE_EXPENSES); -}; // End getOver13Expenses() +}; const getMedicalExpenses = function (client) { return sumProps(client, ALL_MEDICAL_EXPENSES); -}; // End getMedicalExpenses() +}; const getNonTransportCareCosts = function (client) { return sumProps(client, NON_TRANSPORT_DEPENDENT_COSTS); -}; // End getNonTransportationCareCosts() +}; const getTransportDependentCosts = function (client) { return sumProps(client, TRANSPORT_DEPENDENT_COSTS); -}; // End getTransportDependentCosts() +}; // ================================== @@ -84,7 +84,7 @@ const getHousingCosts = function (client) { } else if (housing === `homeowner`) { return sumProps(client, HOMEOWNER_COSTS); } -}; // End getHousingCosts() +}; // ================================== @@ -101,7 +101,7 @@ const getHousingCosts = function (client) { */ const getGrossUnearnedIncomeMonthly = function (client) { return sumProps(client, UNEARNED_INCOME_SOURCES); -}; // End getGrossUnearnedIncomeMonthly() +}; /** @@ -115,10 +115,10 @@ const getGrossUnearnedIncomeMonthly = function (client) { * income with no deductions or exclusions. */ const getSimpleGrossIncomeMonthly = function (client) { - let earned = client.earned, - unearned = getGrossUnearnedIncomeMonthly(client); + let earned = client.earned, + unearned = getGrossUnearnedIncomeMonthly(client); return earned + unearned; -}; // End getSimpleGrossIncomeMonthly() +}; // ================================== @@ -136,7 +136,7 @@ const getSimpleGrossIncomeMonthly = function (client) { */ const sumProps = function (obj, props) { return sum(values(pick(obj, props))); -}; // End sumProps() +}; export { diff --git a/src/utils/convert-by-timescale.js b/src/utils/convert-by-timescale.js index d9b1b57f..87aa40cf 100644 --- a/src/utils/convert-by-timescale.js +++ b/src/utils/convert-by-timescale.js @@ -13,16 +13,16 @@ let toYearlyFrom = function (amount, startTimescale) { let converted = amount; - if (startTimescale === 'weekly') { + if (startTimescale === `weekly`) { converted = amount * 52; - } else if (startTimescale === 'monthly') { + } else if (startTimescale === `monthly`) { converted = amount * 12; - } else if (startTimescale === 'yearly') { + } else if (startTimescale === `yearly`) { // do nothing } return converted; -}; // End toYearlyFrom() +}; /** Returns `amount` converted from whatever 'timescale' it was before @@ -36,16 +36,16 @@ let toMonthlyFrom = function (amount, startTimescale) { let converted = amount; - if (startTimescale === 'weekly') { + if (startTimescale === `weekly`) { converted = amount * (4 + (1 / 3)); - } else if (startTimescale === 'monthly') { + } else if (startTimescale === `monthly`) { // do nothing - } else if (startTimescale === 'yearly') { + } else if (startTimescale === `yearly`) { converted = amount / 12; } return converted; -}; // End toMonthlyFrom() +}; /** Returns `amount` converted from whatever 'timescale' it was before @@ -59,35 +59,35 @@ let toWeeklyFrom = function (amount, startTimescale) { let converted = amount; - if (startTimescale === 'weekly') { + if (startTimescale === `weekly`) { // do nothing - } else if (startTimescale === 'monthly') { + } else if (startTimescale === `monthly`) { converted = amount / (4 + (1 / 3)); - } else if (startTimescale === 'yearly') { + } else if (startTimescale === `yearly`) { converted = amount * 52; } return converted; -}; // End toWeeklyFrom() +}; let timescaleMultipliers = {}; timescaleMultipliers.fromYearly = { - 'Weekly': 1 / 12 / (4 + 1 / 3), - 'Monthly': 1 / 12, - 'Yearly': 1, + Weekly: 1 / 12 / (4 + 1 / 3), + Monthly: 1 / 12, + Yearly: 1, }; timescaleMultipliers.fromMonthly = { - 'Weekly': 1 / (4 + 1 / 3), - 'Monthly': 1, - 'Yearly': 12, + Weekly: 1 / (4 + 1 / 3), + Monthly: 1, + Yearly: 12, }; timescaleMultipliers.fromWeekly = { - 'Weekly': 1, - 'Monthly': (4 + 1 / 3), - 'Yearly': 52, + Weekly: 1, + Monthly: (4 + 1 / 3), + Yearly: 52, }; diff --git a/src/utils/convertForUpdate.js b/src/utils/convertForUpdate.js index cc55585a..c4aa81a3 100644 --- a/src/utils/convertForUpdate.js +++ b/src/utils/convertForUpdate.js @@ -1,6 +1,3 @@ -/** - * - */ const convertForUpdate = function ({ name, route, ...otherProps }) { let forUpdate = { @@ -10,7 +7,7 @@ const convertForUpdate = function ({ name, route, ...otherProps }) { return forUpdate; -}; // End convertForUpdate() +}; export { convertForUpdate }; diff --git a/src/utils/getGovData.js b/src/utils/getGovData.js index 0a4ab8b8..13658008 100644 --- a/src/utils/getGovData.js +++ b/src/utils/getGovData.js @@ -1,9 +1,11 @@ +/** + * Getting or calculating data values by leveraging common data patterns + * we've seen so far. + * @module + */ + import { moneyToWholeNum } from './math'; -/** -* Getting or calculating data values by leveraging common data patterns -* we've seen so far. -*/ /** Calculate appropriate bracket/limit value (such as income * limit) by number of relevant items (such as number of @@ -25,22 +27,23 @@ import { moneyToWholeNum } from './math'; * @param {object} data Data to use to get a bracket/limit value. * @param {number} data.0 Never known to equal more than 0 so far. * @param {number} data.1 (Or any int key) Value of bracket/limit that - * matches the number described by the key. For example, data.3 would be - * the income limit value for a household with three members. + * matches the number described by the key. For example, data.3 would be + * the income limit value for a household with three members. * @param {number|function} data.eachAdditional Usually an amount to - * add for each person or item over the maximum hardcoded limits. Can be a - * function to calculate said amount based on number of extra items. + * add for each person or item over the maximum hardcoded limits. Can be a + * function to calculate said amount based on number of extra items. * @param {number} numItems Number of items (for example, household size). * @param {number} [percent] Multiplies the result before sending it back. - * You'd pass in 100% as `100`. + * You'd pass in 100% as `100`. * - * @returns Data value determined for the number of items, numItems, wanted. + * @returns {number} */ const getLimitBySize = function (data, numItems, percent) { + // @todo Deal with non-number values? - let safePerc = percent || 100, - limit = null, - maxGiven = getMaxIntKey(data); + let safePerc = percent || 100, + limit = null, + maxGiven = getMaxIntKey(data); if (numItems <= maxGiven) { @@ -56,22 +59,23 @@ const getLimitBySize = function (data, numItems, percent) { // The right kind of math as observed in MA data tables return moneyToWholeNum(limit * (safePerc / 100)); -}; // End getLimitBySize() +}; /** Deals with different value types for data.eachAdditional -* -* @function -* @param {number} numExtra Number of extra items -* @param {number|function} eachAdditional Either a number value to add -* for each extra item or a function that will return that number. -* -* @returns {number} The amount created by those extra items. -*/ + * + * @function + * @param {number} numExtra Number of extra items + * @param {number|function} eachAdditional Either a number value to add + * for each extra item or a function that will return that number. + * + * @returns {number} The amount created by those extra items. + */ const getExtraAmount = function (data, numExtra) { + // @todo Deal with non-number values? - let extraAmount = 0, - eachAdditional = data.eachAdditional; + let extraAmount = 0, + eachAdditional = data.eachAdditional; // Either allow additional amount to be calculated // or add a hard-coded amount. @@ -81,20 +85,20 @@ const getExtraAmount = function (data, numExtra) { } else { // Assumed either number or falsy - /** @todo Future discussioin - flexibility vs. consistency */ + /* @todo Future discussion - flexibility vs. consistency */ let overageRate = eachAdditional || 0; extraAmount = numExtra * overageRate; } return extraAmount; -}; // End getExtraAmount() +}; /** -* Of the keys in an object that can be converted to integers, -* return the highest converted value. -*/ + * Of the keys in an object that can be converted to integers, + * return the highest converted value. + */ const getMaxIntKey = function (data) { let max = 0; for (let key in data) { @@ -106,7 +110,7 @@ const getMaxIntKey = function (data) { } return max; -}; // End getMaxIntKey() +}; export { diff --git a/src/utils/getMembers.js b/src/utils/getMembers.js index 9ba96b03..055e1f91 100644 --- a/src/utils/getMembers.js +++ b/src/utils/getMembers.js @@ -1,15 +1,17 @@ +// @todo Put hard-coded values in data table + // =================== // ACCUMULATORS // =================== /** -* Creates an array containing the members in -* `memberList` that pass `memberTest()` -*/ + * Creates an array containing the members in + * `memberList` that pass `memberTest()` + */ const getEveryMember = function (memberList, memberTest, comparisonData) { - let members = []; + let members = []; for (let memi = 0; memi < memberList.length; memi++) { @@ -22,7 +24,7 @@ const getEveryMember = function (memberList, memberTest, comparisonData) { return members; -}; // End getEveryMember() +}; /** @@ -32,7 +34,7 @@ const getEveryMember = function (memberList, memberTest, comparisonData) { const getEveryMemberOfHousehold = function (client, memberTest, comparisonData) { let household = client.household; return getEveryMember(household, memberTest, comparisonData); -}; // End getEveryMemberOfHousehold() +}; // =================== @@ -42,61 +44,61 @@ const getEveryMemberOfHousehold = function (client, memberTest, comparisonData) // --- HEAD OR SPOUSE --- \\ const isHeadOrSpouse = function (member) { - return member.m_role === 'head' || member.m_role === 'spouse'; -}; // End isHeadOrSpouse() + return member.m_role === `head` || member.m_role === `spouse`; +}; const isNotHeadOrSpouse = function (member) { - return member.m_role !== 'head' && member.m_role !== 'spouse'; -}; // End isNotHeadOrSpouse() + return member.m_role !== `head` && member.m_role !== `spouse`; +}; const getHeadOrSpouseMembers = function (memberList) { return getEveryMember(memberList, isHeadOrSpouse); -}; // End getHeadOrSpouseMembers() +}; const getHeadOrSpouseOfHousehold = function (client) { return getEveryMemberOfHousehold(client, isHeadOrSpouse); -}; // End getHeadOrSpouseOfHousehold() +}; // --- DEPENDENTS --- \\ /** * @todo Is it possible for people older than 18 to still be dependents? * I think that on tax forms it's possible to claim people as - * dependents until age 26. */ - + * dependents until age 26. + */ const isDependent = function (member) { return (member.m_age <= 18 || member.m_disabled) && isNotHeadOrSpouse(member); -}; // End isDependent() +}; const getDependentMembers = function (memberList) { return getEveryMember(memberList, isDependent); -}; // End getDependentMembers() +}; const getDependentsOfHousehold = function (client) { return getEveryMemberOfHousehold(client, isDependent); -}; // End getDependentsOfHousehold() +}; // --- DISABLED --- \\ const isDisabled = function (member) { return member.m_disabled; -}; // End isDisabled() +}; const getDisabledMembers = function (memberList) { return getEveryMember(memberList, isDisabled); -}; // End getDisabledMembers() +}; const getDisabledOfHousehold = function (client) { return getEveryMemberOfHousehold(client, isDisabled); -}; // End getDisabledOfHousehold() +}; // --- 12 OR UNDER --- \\ @@ -104,17 +106,17 @@ const getDisabledOfHousehold = function (client) { // strangely to accommodate mutliple programs more easily const isUnder13 = function (member) { return member.m_age <= 12; -}; // End isUnder13() +}; const getUnder13Members = function (memberList) { return getEveryMember(memberList, isUnder13); -}; // End getUnder13Members() +}; const getUnder13OfHousehold = function (client) { return getEveryMemberOfHousehold(client, isUnder13); -}; // End getUnder13OfHousehold() +}; const isYoungerThan = function (member, comparisonData) { // Can be number or object with correct prop @@ -129,7 +131,6 @@ const getYoungerThan = function (client, age) { const isOlderThan = function (member, comparisonData) { // Can be number or object with correct prop let age = comparisonData.age || comparisonData; - // console.log(age, member.m_age); return member.m_age > age; }; diff --git a/src/utils/getSideEffects.js b/src/utils/getSideEffects.js index 73c48435..393368b9 100644 --- a/src/utils/getSideEffects.js +++ b/src/utils/getSideEffects.js @@ -4,6 +4,7 @@ * new state. */ +// @todo US State specific? const empty = function () { return {}; @@ -41,13 +42,13 @@ const sideEffects = { childTransportation: earnedBecauseOfChildCare, childOtherCare: earnedBecauseOfChildCare, disabledAssistance: earnedBecauseOfAdultCare, -}; // end sideEffects +}; const getSideEffects = function (clientPartial, itemID) { let func = sideEffects[ itemID ] || empty; return func(clientPartial); -}; // End getSideEffects(); +}; export { diff --git a/src/utils/getTextForLanguage.js b/src/utils/getTextForLanguage.js index 4beab951..0e8bd199 100644 --- a/src/utils/getTextForLanguage.js +++ b/src/utils/getTextForLanguage.js @@ -1,5 +1,3 @@ -/** Returns a translator based on the language given */ - // TRANSFORMER FUNCTIONS import { mergeWith } from 'lodash'; import { interpolateTranslations } from './interpolation.js'; @@ -15,8 +13,8 @@ const localizations = getLocalizationData(); let finishedTranslations = { en: interpolateTranslations(localizations.en, inlineComponents) }; /** Customizes Lodash's mergeWith function to replace arrays completely - * (to avoid arrays of English strings being mixed with arrays of translated - * strings, if they happen to have different lengths). + * (to avoid arrays of English strings being mixed with arrays of translated + * strings, if they happen to have different lengths). */ const mergeCustomizer = function (objValue, srcValue) { if (Array.isArray(objValue)) { @@ -26,13 +24,13 @@ const mergeCustomizer = function (objValue, srcValue) { /** * Returns the object named by langName that contains - * the text translations of that language. If that language - * doesn't exist, it warns the coder and returns English. + * the text translations of that language. If that language + * doesn't exist, it warns the coder and returns English. */ const getTextForLanguage = function (langCode) { if (!localizations[ langCode ]) { - console.warn('There\'s no localization for ' + langCode + '. Defaulting to English.'); - langCode = 'en'; + console.warn(`There's no localization for ` + langCode + `. Defaulting to English.`); + langCode = `en`; } if (!finishedTranslations[ langCode ]) { @@ -45,7 +43,10 @@ const getTextForLanguage = function (langCode) { } return finishedTranslations[ langCode ]; -}; // End getTextForLanguage() +}; -export { getTextForLanguage }; +export { + mergeCustomizer, + getTextForLanguage, +}; diff --git a/src/utils/getTimeFrames.js b/src/utils/getTimeFrames.js index 3cebe22d..61ef5742 100644 --- a/src/utils/getTimeFrames.js +++ b/src/utils/getTimeFrames.js @@ -1,13 +1,13 @@ /** * Abstracts current and future program and - * income values on Predictions form + * income values on Predictions form. */ const getBenefitTimeFrames = function (client, benefitCheck, benefitsFunc) { if (client.current[ benefitCheck ]) { return { - benefitCurrent: Math.round(benefitsFunc (client, 'current')), - benefitFuture: Math.round(benefitsFunc (client, 'future')), + benefitCurrent: Math.round(benefitsFunc (client, `current`)), + benefitFuture: Math.round(benefitsFunc (client, `future`)), }; } else { return 0; @@ -21,4 +21,8 @@ const getIncomeTimeFrames = function(client) { }; }; -export { getBenefitTimeFrames, getIncomeTimeFrames }; + +export { + getBenefitTimeFrames, + getIncomeTimeFrames, +}; diff --git a/src/utils/getUserConfirmation.js b/src/utils/getUserConfirmation.js index 53a868ef..f5b51603 100644 --- a/src/utils/getUserConfirmation.js +++ b/src/utils/getUserConfirmation.js @@ -1,23 +1,22 @@ import { getConfirmation as defaultConfirm } from 'history/DOMUtils'; /** - * tl;dr: - * This is a wrapper that temporarily hijacks React history. + * tl;dr: This is a wrapper that temporarily hijacks React history. * * More details: * _history_, which is used by _React Router_ (`HashRouter` - * in App.js), runs the function `getConfirmation()` every - * time the user navigates away from a React 'page'. - * Navigates to a different `Route`, that is. This is useful - * for adding `onunload`-like prompts. + * in App.js), runs the function `getConfirmation()` every + * time the user navigates away from a React 'page'. + * Navigates to a different `Route`, that is. This is useful + * for adding `onunload`-like prompts. * * We could do this in a way that would be persistent - * throughout the site, but that became too hard to follow. - * Instead we pass it down through `props`. When we're done - * hijacking, we restore the old history behavior. We only - * really use the non-default behavior, but we figure it's - * probably good practice to restore the default behavior - * when we're done with our special case. + * throughout the site, but that became too hard to follow. + * Instead we pass it down through `props`. When we're done + * hijacking, we restore the old history behavior. We only + * really use the non-default behavior, but we figure it's + * probably good practice to restore the default behavior + * when we're done with our special case. */ class Confirmer { @@ -36,7 +35,7 @@ class Confirmer { getConfirmation = (message, reactCallback) => { return this.confirm(message, reactCallback); }; +}; -}; // End Confirm export { Confirmer }; diff --git a/src/utils/interpolation.js b/src/utils/interpolation.js index 23c81dd3..bca01fdf 100644 --- a/src/utils/interpolation.js +++ b/src/utils/interpolation.js @@ -1,11 +1,11 @@ -/** Allows insertion of provided components at specified points in a translated text block. */ - import React from 'react'; // To make sure all keys are unique let count = 0; -/** Interpolate components into a single text block (specified as an array) */ +/** Interpolate components into a single text block (specified as an + * array). + */ const interpolateText = function (template, components, langCode) { return template.map((item) => { @@ -38,9 +38,13 @@ const interpolateText = function (template, components, langCode) { return React.cloneElement(component, props); } }); -}; +}; // Ends interpolateText() + -/** Recursively interpolate each template in a translations object */ +/** Recursively interpolate each template in a translations object. + * Allows insertion of provided components at specified points + * in a translated text block. + */ const interpolateTranslations = function (translations, components) { let named = {}, versionRegex = /_v\d+$/; @@ -73,10 +77,13 @@ const interpolateTranslations = function (translations, components) { named[ key ] = interpolateTranslations(value, components); } - } // end for every key in translations + } // ends for every key in translations return named; -}; +}; // Ends interpolateTranslations() -export { interpolateText, interpolateTranslations }; +export { + interpolateText, + interpolateTranslations, +}; From 80c0c32e44c8449a0cad1f7bc2c125e4aa658094 Mon Sep 17 00:00:00 2001 From: knod <3197142-knod@users.noreply.gitlab.com> Date: Wed, 5 Dec 2018 09:13:21 -0500 Subject: [PATCH 2/4] Disable es-lint block for formatting with 'columns' --- src/utils/CLIENT_DEFAULTS.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/utils/CLIENT_DEFAULTS.js b/src/utils/CLIENT_DEFAULTS.js index eef9d7a5..d4ada13b 100644 --- a/src/utils/CLIENT_DEFAULTS.js +++ b/src/utils/CLIENT_DEFAULTS.js @@ -11,21 +11,24 @@ const CLIENT_DEFAULTS = { // Property Name | Default Value | Valid Value Description + /* eslint-disable */ // @todo get this value from the app somewhere - USState: `MA`, // Two-letter code denoting the state the client is in + USState: `MA`, // Two-letter code denoting the state the client is in current: { // Current programs - benefits: [], // Benefit names (e.g. 'snap', 'section8') + benefits: [], // Benefit names (e.g. 'snap', 'section8') // Household // 'm_' for 'member' household: [ { // 'head' member // one or more member objects - m_age: 30, // whole number - m_role: `head`, // 'head', 'spouse', 'member' - m_disabled: false, // boolean + m_age: 30, // whole number + m_role: `head`, // 'head', 'spouse', 'member' + m_disabled: false, // boolean }, ], + /* eslint-enable */ + // Income earned: 0, // positive number (can have more than two decimal places) TAFDC: 0, // positive number From 7dd90b536e3e7d001e38927b2c656cb4e0f9b68f Mon Sep 17 00:00:00 2001 From: knod <3197142-knod@users.noreply.gitlab.com> Date: Thu, 6 Dec 2018 07:42:36 -0500 Subject: [PATCH 3/4] Disable specific rule, add explanitory comment --- src/utils/CLIENT_DEFAULTS.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/CLIENT_DEFAULTS.js b/src/utils/CLIENT_DEFAULTS.js index d4ada13b..f5d2d438 100644 --- a/src/utils/CLIENT_DEFAULTS.js +++ b/src/utils/CLIENT_DEFAULTS.js @@ -8,10 +8,11 @@ import { cloneDeep } from 'lodash'; * two decimal places. */ const CLIENT_DEFAULTS = { + /* eslint-disable key-spacing */ + // Disables eslint spacing for this first section to align with columns declared below // Property Name | Default Value | Valid Value Description - /* eslint-disable */ // @todo get this value from the app somewhere USState: `MA`, // Two-letter code denoting the state the client is in From 02785124b357e8d6e11fba9a301569a268da930f Mon Sep 17 00:00:00 2001 From: knod <3197142-knod@users.noreply.gitlab.com> Date: Sat, 8 Dec 2018 08:48:45 -0500 Subject: [PATCH 4/4] Removes columns --- src/utils/CLIENT_DEFAULTS.js | 116 +++++++++++++++++------------------ 1 file changed, 56 insertions(+), 60 deletions(-) diff --git a/src/utils/CLIENT_DEFAULTS.js b/src/utils/CLIENT_DEFAULTS.js index f5d2d438..8ab3a4ba 100644 --- a/src/utils/CLIENT_DEFAULTS.js +++ b/src/utils/CLIENT_DEFAULTS.js @@ -6,83 +6,79 @@ import { cloneDeep } from 'lodash'; * * Note: A 'positive number' money value can have more than * two decimal places. + * + * @namespace */ const CLIENT_DEFAULTS = { - /* eslint-disable key-spacing */ - // Disables eslint spacing for this first section to align with columns declared below - - // Property Name | Default Value | Valid Value Description // @todo get this value from the app somewhere - USState: `MA`, // Two-letter code denoting the state the client is in + USState: `MA`, // Two-letter code denoting the state the client is in current: { // Current programs - benefits: [], // Benefit names (e.g. 'snap', 'section8') + benefits: [], // Benefit names (e.g. 'snap', 'section8') // Household - // 'm_' for 'member' - household: [ - { // 'head' member // one or more member objects - m_age: 30, // whole number - m_role: `head`, // 'head', 'spouse', 'member' - m_disabled: false, // boolean + household: [ // one or more member objects. 'm_' for 'member' + { + m_age: 30, // whole number + m_role: `head`, // 'head', 'spouse', 'member' + m_disabled: false, // boolean }, ], - /* eslint-enable */ // Income - earned: 0, // positive number (can have more than two decimal places) - TAFDC: 0, // positive number - SSI: 0, // positive number - SSDI: 0, // positive number - childSupportIn: 0, // positive number - unemployment: 0, // positive number - workersComp: 0, // positive number - pension: 0, // positive number - socialSecurity: 0, // positive number - alimony: 0, // positive number - otherIncome: 0, // positive number + earned: 0, // positive number (can have more than two decimal places) + TAFDC: 0, // positive number + SSI: 0, // positive number + SSDI: 0, // positive number + childSupportIn: 0, // positive number + unemployment: 0, // positive number + workersComp: 0, // positive number + pension: 0, // positive number + socialSecurity: 0, // positive number + alimony: 0, // positive number + otherIncome: 0, // positive number // Expenses - childDirectCare: 0, // positive number - childBeforeAndAfterSchoolCare: 0, // positive number - childTransportation: 0, // positive number - childOtherCare: 0, // positive number - earnedBecauseOfChildCare: 0, // positive number - childSupportPaidOut: 0, // positive number - adultDirectCare: 0, // positive number - adultTransportation: 0, // positive number - adultOtherCare: 0, // positive number - disabledAssistance: 0, // positive number - earnedBecauseOfAdultCare: 0, // positive number - disabledMedical: 0, // positive number - otherMedical: 0, // positive number + childDirectCare: 0, // positive number + childBeforeAndAfterSchoolCare: 0, // positive number + childTransportation: 0, // positive number + childOtherCare: 0, // positive number + earnedBecauseOfChildCare: 0, // positive number + childSupportPaidOut: 0, // positive number + adultDirectCare: 0, // positive number + adultTransportation: 0, // positive number + adultOtherCare: 0, // positive number + disabledAssistance: 0, // positive number + earnedBecauseOfAdultCare: 0, // positive number + disabledMedical: 0, // positive number + otherMedical: 0, // positive number /** @todo Make housing expense values more robust. */ - housing: `homeless`, // 'homeless', 'homeowner', 'renter', 'voucher' - contractRent: 0, // positive number - rentShare: 0, // positive number - rent: 0, // positive number - mortgage: 0, // positive number - housingInsurance: 0, // positive number - propertyTax: 0, // positive number - climateControl: false, // boolean - nonHeatElectricity: false, // boolean - phone: false, // boolean - fuelAssistance: false, // boolean Note: Input is 'yes', 'no', but should be being converted - otherExpensesFood: 0, // postitive number - otherExpensesUtilities: 0, // postitive number - otherExpensesCable: 0, // postitive number - otherExpensesMedical: 0, // postitive number - otherExpensesTransport: 0, // postitive number - otherExpensesCareProducts: 0, // postitive number - otherExpensesClothes: 0, // postitive number - otherExpensesPhone: 0, // postitive number - otherExpensesEntertainment: 0, // postitive number - otherExpensesOther: 0, // postitive number - wantsToSeeOtherExpenses: false, // boolean + housing: `homeless`, // 'homeless', 'homeowner', 'renter', 'voucher' + contractRent: 0, // positive number + rentShare: 0, // positive number + rent: 0, // positive number + mortgage: 0, // positive number + housingInsurance: 0, // positive number + propertyTax: 0, // positive number + climateControl: false, // boolean + nonHeatElectricity: false, // boolean + phone: false, // boolean + fuelAssistance: false, // boolean Note: Input is 'yes', 'no', but should be being converted + otherExpensesFood: 0, // postitive number + otherExpensesUtilities: 0, // postitive number + otherExpensesCable: 0, // postitive number + otherExpensesMedical: 0, // postitive number + otherExpensesTransport: 0, // postitive number + otherExpensesCareProducts: 0, // postitive number + otherExpensesClothes: 0, // postitive number + otherExpensesPhone: 0, // postitive number + otherExpensesEntertainment: 0, // postitive number + otherExpensesOther: 0, // postitive number + wantsToSeeOtherExpenses: false, // boolean }, // Note: A `future` value will default to the client's `current` value until a user changes it explicitly - future: {}, // same structure // same + future: {}, // will be copy of `current` };