From d7141de64964acbb1118ad42d32a35f60fcca4f7 Mon Sep 17 00:00:00 2001 From: Anatoliy Yastreb Date: Sun, 11 Nov 2018 21:24:01 +0900 Subject: [PATCH] NOBUG: fix formatting --- .prettierrc | 6 ++++++ src/entities/Report.js | 24 ++++++++++++------------ src/selectors/ui/report.js | 9 +++------ 3 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..fa51da29e --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "trailingComma": "es5", + "tabWidth": 2, + "semi": false, + "singleQuote": true +} diff --git a/src/entities/Report.js b/src/entities/Report.js index cba962b25..5725e5b80 100644 --- a/src/entities/Report.js +++ b/src/entities/Report.js @@ -45,18 +45,18 @@ const Report = { { key: REPORT_EXPENSE_INCOME, value: REPORT_EXPENSE_INCOME, - text: 'Expense & Income' + text: 'Expense & Income', }, { key: REPORT_EXPENSE_TAGS, value: REPORT_EXPENSE_TAGS, - text: 'Expense by Tags' + text: 'Expense by Tags', }, { key: REPORT_NET_WORTH, value: REPORT_NET_WORTH, - text: 'Net Worth' - } + text: 'Net Worth', + }, ] }, timespanOptions() { @@ -64,13 +64,13 @@ const Report = { { key: TIMESPAN_YEARLY, value: TIMESPAN_YEARLY, - text: 'Yearly' + text: 'Yearly', }, { key: TIMESPAN_MONTHLY, value: TIMESPAN_MONTHLY, - text: 'Monthly' - } + text: 'Monthly', + }, ] }, timespanLabel(date, timespan) { @@ -79,7 +79,7 @@ const Report = { transactionFilters(report) { return { date: report.date, - accounts: report.accounts + accounts: report.accounts, } }, prepareData(report, transactions, base, exchangeRate, netWorthEnd) { @@ -99,7 +99,7 @@ const Report = { default: return undefined } - } + }, } export default Report @@ -107,10 +107,10 @@ export default Report function dateRange(date, timespan) { const start = timespan === TIMESPAN_YEARLY ? startOfYear : startOfMonth const end = timespan === TIMESPAN_YEARLY ? endOfYear : endOfMonth - let tempDate = new Date(date); - tempDate.setDate(tempDate.getDate()+1); + const tempDate = new Date(date) + tempDate.setDate(tempDate.getDate() + 1) return { start: toUtcTimestamp(start(tempDate)), - end: toUtcTimestamp(end(tempDate)) + end: toUtcTimestamp(end(tempDate)), } } diff --git a/src/selectors/ui/report.js b/src/selectors/ui/report.js index 78bca032e..fd6fcd2b6 100644 --- a/src/selectors/ui/report.js +++ b/src/selectors/ui/report.js @@ -2,10 +2,7 @@ import Report from '../../entities/Report' export const getReport = state => state.ui.report export const getTimespanLabel = state => { - let startdate = new Date(state.ui.report.date.start); - startdate.setDate(startdate.getDate()+1); - return Report.timespanLabel( - startdate, - state.ui.report.timespan - ) + const startDate = new Date(state.ui.report.date.start) + startDate.setDate(startDate.getDate() + 1) + return Report.timespanLabel(startDate, state.ui.report.timespan) }