diff --git a/packages/desktop-client/src/components/reports/ChooseGraph.tsx b/packages/desktop-client/src/components/reports/ChooseGraph.tsx index 254ec1f1217..4dca723153a 100644 --- a/packages/desktop-client/src/components/reports/ChooseGraph.tsx +++ b/packages/desktop-client/src/components/reports/ChooseGraph.tsx @@ -29,9 +29,9 @@ export function ChooseGraph({ setScrollWidth(!value ? 0 : value); }; - let headerScrollRef = useRef(null); - let listScrollRef = useRef(null); - let totalScrollRef = useRef(null); + const headerScrollRef = useRef(null); + const listScrollRef = useRef(null); + const totalScrollRef = useRef(null); const handleScrollTotals = scroll => { headerScrollRef.current.scrollLeft = scroll.target.scrollLeft; diff --git a/packages/desktop-client/src/components/reports/ReportOptions.tsx b/packages/desktop-client/src/components/reports/ReportOptions.tsx index 7077d497cac..69f0ef1626c 100644 --- a/packages/desktop-client/src/components/reports/ReportOptions.tsx +++ b/packages/desktop-client/src/components/reports/ReportOptions.tsx @@ -76,7 +76,7 @@ export type UncategorizedEntity = CategoryEntity & { has_category: boolean; }; -let uncategorizedCategory: UncategorizedEntity = { +const uncategorizedCategory: UncategorizedEntity = { name: 'Uncategorized', id: null, uncategorized_id: '1', @@ -85,7 +85,7 @@ let uncategorizedCategory: UncategorizedEntity = { is_transfer: false, has_category: false, }; -let transferCategory: UncategorizedEntity = { +const transferCategory: UncategorizedEntity = { name: 'Transfers', id: null, uncategorized_id: '2', @@ -94,7 +94,7 @@ let transferCategory: UncategorizedEntity = { is_transfer: true, has_category: false, }; -let offBudgetCategory: UncategorizedEntity = { +const offBudgetCategory: UncategorizedEntity = { name: 'Off Budget', id: null, uncategorized_id: '3', @@ -108,7 +108,7 @@ type UncategorizedGroupEntity = CategoryGroupEntity & { categories?: UncategorizedEntity[]; }; -let uncategouncatGrouprizedGroup: UncategorizedGroupEntity = { +const uncategouncatGrouprizedGroup: UncategorizedGroupEntity = { name: 'Uncategorized & Off Budget', id: null, hidden: false, @@ -120,7 +120,7 @@ export const categoryLists = ( showUncategorized: boolean, categories: { list: CategoryEntity[]; grouped: CategoryGroupEntity[] }, ) => { - let categoryList = showUncategorized + const categoryList = showUncategorized ? [ ...categories.list, uncategorizedCategory, @@ -128,7 +128,7 @@ export const categoryLists = ( offBudgetCategory, ] : categories.list; - let categoryGroup = showUncategorized + const categoryGroup = showUncategorized ? [ ...categories.grouped.filter(f => showOffBudgetHidden || !f.hidden), uncategouncatGrouprizedGroup, diff --git a/packages/desktop-client/src/components/reports/spreadsheets/default-spreadsheet.tsx b/packages/desktop-client/src/components/reports/spreadsheets/default-spreadsheet.tsx index 6d4a7453b32..47c1cf8cdb1 100644 --- a/packages/desktop-client/src/components/reports/spreadsheets/default-spreadsheet.tsx +++ b/packages/desktop-client/src/components/reports/spreadsheets/default-spreadsheet.tsx @@ -113,19 +113,19 @@ export default function createSpreadsheet({ const monthData = months.reduce((arr, month) => { let perMonthAssets = 0; let perMonthDebts = 0; - let stacked = {}; + const stacked = {}; groupByList.map(item => { let stackAmounts = 0; - let monthAssets = filterHiddenItems(item, assets) + const monthAssets = filterHiddenItems(item, assets) .filter( asset => asset.date === month && asset[groupByLabel] === item.id, ) .reduce((a, v) => (a = a + v.amount), 0); perMonthAssets += monthAssets; - let monthDebts = filterHiddenItems(item, debts) + const monthDebts = filterHiddenItems(item, debts) .filter(debt => debt.date === month && debt[groupByLabel] === item.id) .reduce((a, v) => (a = a + v.amount), 0); perMonthDebts += monthDebts; @@ -157,9 +157,7 @@ export default function createSpreadsheet({ return arr; }, []); - let calcData; - - calcData = groupByList.map(item => { + const calcData = groupByList.map(item => { const calc = recalculate({ item, months, assets, debts, groupByLabel }); return { ...calc }; }); diff --git a/packages/desktop-client/src/components/reports/spreadsheets/grouped-spreadsheet.ts b/packages/desktop-client/src/components/reports/spreadsheets/grouped-spreadsheet.ts index f3198f69e74..90d679c046e 100644 --- a/packages/desktop-client/src/components/reports/spreadsheets/grouped-spreadsheet.ts +++ b/packages/desktop-client/src/components/reports/spreadsheets/grouped-spreadsheet.ts @@ -20,9 +20,9 @@ function createGroupedSpreadsheet({ hidden, uncat, }: createSpreadsheetProps) { - let [catList, catGroup] = categoryLists(hidden, uncat, categories); + const [catList, catGroup] = categoryLists(hidden, uncat, categories); - let categoryFilter = (catList || []).filter( + const categoryFilter = (catList || []).filter( category => !category.hidden && selectedCategories && @@ -36,7 +36,7 @@ function createGroupedSpreadsheet({ return null; } - let { filters } = await send('make-filters-from-conditions', { + const { filters } = await send('make-filters-from-conditions', { conditions: conditions.filter(cond => !cond.customName), }); const conditionsOpKey = conditionsOp === 'or' ? '$or' : '$and'; @@ -80,14 +80,14 @@ function createGroupedSpreadsheet({ let groupedDebts = 0; group.categories.map(item => { - let monthAssets = filterHiddenItems(item, assets) + const monthAssets = filterHiddenItems(item, assets) .filter( asset => asset.date === month && asset.category === item.id, ) .reduce((a, v) => (a = a + v.amount), 0); groupedAssets += monthAssets; - let monthDebts = filterHiddenItems(item, debts) + const monthDebts = filterHiddenItems(item, debts) .filter( debts => debts.date === month && debts.category === item.id, ) diff --git a/packages/desktop-client/src/components/reports/spreadsheets/makeQuery.ts b/packages/desktop-client/src/components/reports/spreadsheets/makeQuery.ts index 546b8f8b957..19d56b811d3 100644 --- a/packages/desktop-client/src/components/reports/spreadsheets/makeQuery.ts +++ b/packages/desktop-client/src/components/reports/spreadsheets/makeQuery.ts @@ -11,7 +11,7 @@ function makeQuery( conditionsOpKey: string, filters: unknown[], ) { - let query = q('transactions') + const query = q('transactions') .filter( //Show Offbudget and hidden categories !hidden && { diff --git a/packages/desktop-client/src/components/reports/spreadsheets/recalculate.ts b/packages/desktop-client/src/components/reports/spreadsheets/recalculate.ts index 86f3f9d06d5..e6b516dfaef 100644 --- a/packages/desktop-client/src/components/reports/spreadsheets/recalculate.ts +++ b/packages/desktop-client/src/components/reports/spreadsheets/recalculate.ts @@ -26,12 +26,12 @@ function recalculate({ const monthData = months.reduce((arr, month) => { const last = arr.length === 0 ? null : arr[arr.length - 1]; - let monthAssets = filterHiddenItems(item, assets) + const monthAssets = filterHiddenItems(item, assets) .filter(asset => asset.date === month && asset[groupByLabel] === item.id) .reduce((a, v) => (a = a + v.amount), 0); totalAssets += monthAssets; - let monthDebts = filterHiddenItems(item, debts) + const monthDebts = filterHiddenItems(item, debts) .filter(debt => debt.date === month && debt[groupByLabel] === item.id) .reduce((a, v) => (a = a + v.amount), 0); totalDebts += monthDebts;