Skip to content

Commit

Permalink
const eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
carkom committed Dec 5, 2023
1 parent 1efd5e2 commit c844907
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export function ChooseGraph({
setScrollWidth(!value ? 0 : value);
};

let headerScrollRef = useRef<HTMLDivElement>(null);
let listScrollRef = useRef<HTMLDivElement>(null);
let totalScrollRef = useRef<HTMLDivElement>(null);
const headerScrollRef = useRef<HTMLDivElement>(null);
const listScrollRef = useRef<HTMLDivElement>(null);
const totalScrollRef = useRef<HTMLDivElement>(null);

const handleScrollTotals = scroll => {
headerScrollRef.current.scrollLeft = scroll.target.scrollLeft;
Expand Down
12 changes: 6 additions & 6 deletions packages/desktop-client/src/components/reports/ReportOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export type UncategorizedEntity = CategoryEntity & {
has_category: boolean;
};

let uncategorizedCategory: UncategorizedEntity = {
const uncategorizedCategory: UncategorizedEntity = {
name: 'Uncategorized',
id: null,
uncategorized_id: '1',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -108,7 +108,7 @@ type UncategorizedGroupEntity = CategoryGroupEntity & {
categories?: UncategorizedEntity[];
};

let uncategouncatGrouprizedGroup: UncategorizedGroupEntity = {
const uncategouncatGrouprizedGroup: UncategorizedGroupEntity = {
name: 'Uncategorized & Off Budget',
id: null,
hidden: false,
Expand All @@ -120,15 +120,15 @@ export const categoryLists = (
showUncategorized: boolean,
categories: { list: CategoryEntity[]; grouped: CategoryGroupEntity[] },
) => {
let categoryList = showUncategorized
const categoryList = showUncategorized
? [
...categories.list,
uncategorizedCategory,
transferCategory,
offBudgetCategory,
]
: categories.list;
let categoryGroup = showUncategorized
const categoryGroup = showUncategorized
? [
...categories.grouped.filter(f => showOffBudgetHidden || !f.hidden),
uncategouncatGrouprizedGroup,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 };
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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';
Expand Down Expand Up @@ -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,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 && {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c844907

Please sign in to comment.