A local-first personal finance app
:rotating_light: enabling no-unused-vars eslint rule (#469)
Matiss Janis Aboltinsb0e251160315
diff --git a/.eslintrc.js b/.eslintrc.jsindex 42158f30fe..76c0c9f087 100644--- a/.eslintrc.js+++ b/.eslintrc.js@@ -3,7 +3,14 @@ module.exports = {extends: ['react-app'],rules: {'prettier/prettier': 'error',- 'no-unused-vars': 'off', // TODO: re-enable once issues are fixed+ 'no-unused-vars': [+ 'error',+ {+ args: 'none',+ varsIgnorePattern: '^_',+ ignoreRestSiblings: true+ }+ ],'no-loop-func': 'off','no-restricted-globals': 'off',diff --git a/packages/desktop-client/src/components/MobileWebMessage.js b/packages/desktop-client/src/components/MobileWebMessage.jsindex 4e7e482a1c..7b497c2385 100644--- a/packages/desktop-client/src/components/MobileWebMessage.js+++ b/packages/desktop-client/src/components/MobileWebMessage.js@@ -8,13 +8,6 @@ import { colors, styles } from 'loot-design/src/style';import { isMobile } from '../util';-function isOSX() {- var ua = window.navigator.userAgent;- var iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i);- var webkit = !!ua.match(/WebKit/i);- return iOS && webkit && !ua.match(/CriOS/i);-}-let buttonStyle = { border: 0, fontSize: 15, padding: '10px 13px' };export default function MobileWebMessage() {diff --git a/packages/desktop-client/src/components/SyncRefresh.js b/packages/desktop-client/src/components/SyncRefresh.jsindex a388c15d94..ec8af902ad 100644--- a/packages/desktop-client/src/components/SyncRefresh.js+++ b/packages/desktop-client/src/components/SyncRefresh.js@@ -1,4 +1,4 @@-import React, { useState } from 'react';+import { useState } from 'react';export default function SyncRefresh({ onSync, children }) {let [syncing, setSyncing] = useState(false);diff --git a/packages/desktop-client/src/components/Titlebar.js b/packages/desktop-client/src/components/Titlebar.jsindex 04d077ae85..faa6d99ca6 100644--- a/packages/desktop-client/src/components/Titlebar.js+++ b/packages/desktop-client/src/components/Titlebar.js@@ -18,7 +18,7 @@ import {P} from 'loot-design/src/components/common';import SheetValue from 'loot-design/src/components/spreadsheet/SheetValue';-import { colors, styles } from 'loot-design/src/style';+import { colors } from 'loot-design/src/style';import ArrowLeft from 'loot-design/src/svg/v1/ArrowLeft';import AlertTriangle from 'loot-design/src/svg/v2/AlertTriangle';import ArrowButtonRight1 from 'loot-design/src/svg/v2/ArrowButtonRight1';diff --git a/packages/desktop-client/src/components/accounts/MobileAccount.js b/packages/desktop-client/src/components/accounts/MobileAccount.jsindex 52907681f1..4434baf5cd 100644--- a/packages/desktop-client/src/components/accounts/MobileAccount.js+++ b/packages/desktop-client/src/components/accounts/MobileAccount.js@@ -181,6 +181,7 @@ function Account(props) {setSearchText(text);};+ // eslint-disable-next-line no-unused-varsconst onSelectTransaction = transaction => {if (isPreviewId(transaction.id)) {let parts = transaction.id.split('/');diff --git a/packages/desktop-client/src/components/accounts/MobileAccounts.js b/packages/desktop-client/src/components/accounts/MobileAccounts.jsindex 1e2719e7d8..181b7ea589 100644--- a/packages/desktop-client/src/components/accounts/MobileAccounts.js+++ b/packages/desktop-client/src/components/accounts/MobileAccounts.js@@ -176,15 +176,15 @@ export class AccountList extends React.Component {const {accounts,updatedAccounts,- transactions,- categories,+ // transactions,+ // categories,getBalanceQuery,getOnBudgetBalance,getOffBudgetBalance,onAddAccount,- onSelectAccount,- onSelectTransaction,- refreshControl+ onSelectAccount+ // onSelectTransaction,+ // refreshControl} = this.props;const budgetedAccounts = accounts.filter(account => account.offbudget === 0@@ -304,15 +304,7 @@ function Accounts(props) {navigate(`/transaction/${transaction}`);};- let {- navigation,- accounts,- categories,- payees,- newTransactions,- updatedAccounts,- prefs- } = props;+ let { accounts, categories, newTransactions, updatedAccounts, prefs } = props;let numberFormat = prefs.numberFormat || 'comma-dot';return (@@ -329,7 +321,7 @@ function Accounts(props) {getBalanceQuery={queries.accountBalance}getOnBudgetBalance={queries.budgetedAccountBalance}getOffBudgetBalance={queries.offbudgetAccountBalance}- onAddAccount={() => {}} //navigation.navigate('AddAccountModal')}+ onAddAccount={() => {}} // () => navigate('AddAccountModal')onSelectAccount={onSelectAccount}onSelectTransaction={onSelectTransaction}// refreshControl={diff --git a/packages/desktop-client/src/components/accounts/MobileTransaction.js b/packages/desktop-client/src/components/accounts/MobileTransaction.jsindex 0ab73d1ac1..bccae0c25c 100644--- a/packages/desktop-client/src/components/accounts/MobileTransaction.js+++ b/packages/desktop-client/src/components/accounts/MobileTransaction.js@@ -13,10 +13,8 @@ import { titleFirst } from 'loot-core/src/shared/util';import { integerToCurrency, groupById } from 'loot-core/src/shared/util';import { Text, TextOneLine, View } from 'loot-design/src/components/common';import { styles, colors } from 'loot-design/src/style';-import AlertTriangle from 'loot-design/src/svg/v2/AlertTriangle';import ArrowsSynchronize from 'loot-design/src/svg/v2/ArrowsSynchronize';import CheckCircle1 from 'loot-design/src/svg/v2/CheckCircle1';-import EditSkull1 from 'loot-design/src/svg/v2/EditSkull1';const zIndices = { SECTION_HEADING: 10 };@@ -61,20 +59,17 @@ export function DateHeader({ date }) {}function Status({ status }) {- let color, Icon;+ let color;switch (status) {case 'missed':color = colors.r3;- Icon = EditSkull1;break;case 'due':color = colors.y3;- Icon = AlertTriangle;break;case 'upcoming':color = colors.n4;- Icon = ArrowsSynchronize;break;default:}@@ -101,7 +96,7 @@ export class Transaction extends React.PureComponent {payees,showCategory,added,- onSelect,+ // onSelect,style} = this.props;let {@@ -327,7 +322,7 @@ export class TransactionList extends React.Component {payees={this.props.payees}showCategory={this.props.showCategory}added={this.props.isNew(transaction.id)}- onSelect={() => {}} //this.props.onSelect(transaction)}+ onSelect={() => {}} // onSelect(transaction)}/></Item>);@@ -446,11 +441,7 @@ function ListBoxSection({ section, state }) {function Option({ isLast, item, state }) {// Get props for the option elementlet ref = React.useRef();- let { optionProps, isSelected, isDisabled } = useOption(- { key: item.key },- state,- ref- );+ let { optionProps, isSelected } = useOption({ key: item.key }, state, ref);// Determine whether we should show a keyboard// focus ring for accessibilitydiff --git a/packages/desktop-client/src/components/budget/MobileBudget.js b/packages/desktop-client/src/components/budget/MobileBudget.jsindex 90c6054052..d283cda0da 100644--- a/packages/desktop-client/src/components/budget/MobileBudget.js+++ b/packages/desktop-client/src/components/budget/MobileBudget.js@@ -230,8 +230,7 @@ class Budget extends React.Component {};render() {- const { currentMonth, bounds, editMode, initialized, showBudgetDetails } =- this.state;+ const { currentMonth, bounds, editMode, initialized } = this.state;const {categories,categoryGroups,diff --git a/packages/desktop-client/src/components/budget/MobileBudgetTable.js b/packages/desktop-client/src/components/budget/MobileBudgetTable.jsindex d57a7f9ed1..ccad35be89 100644--- a/packages/desktop-client/src/components/budget/MobileBudgetTable.js+++ b/packages/desktop-client/src/components/budget/MobileBudgetTable.js@@ -1,4 +1,4 @@-import React, { useMemo, useEffect, useContext, useState } from 'react';+import React from 'react';// import {// RectButton,// PanGestureHandler,@@ -164,6 +164,7 @@ export class BudgetCell extends React.PureComponent {}}+// eslint-disable-next-line no-unused-varsfunction BudgetGroupPreview({ group, pending, style }) {// let opacity = useMemo(() => new Animated.Value(0), []);@@ -209,6 +210,7 @@ function BudgetGroupPreview({ group, pending, style }) {);}+// eslint-disable-next-line no-unused-varsfunction BudgetCategoryPreview({ name, pending, style }) {return (// <Animated.View@@ -271,11 +273,11 @@ export class BudgetCategory extends React.PureComponent {category,editing,index,- gestures,- editMode,+ // gestures,+ // editMode,style,month,- onEdit,+ // onEdit,onBudgetAction} = this.props;@@ -576,13 +578,13 @@ export class BudgetGroup extends React.PureComponent {render() {const {group,- editingId,+ // editingId,editMode,gestures,month,onEditCategory,onReorderCategory,- onReorderGroup,+ // onReorderGroup,onAddCategory,onBudgetAction} = this.props;@@ -730,7 +732,7 @@ export class BudgetGroups extends React.Component {type,categoryGroups,editingId,- editMode,+ // editMode,gestures,month,onEditCategory,diff --git a/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.js b/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.jsindex d7587cb2bb..b1b2386a0c 100644--- a/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.js+++ b/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.js@@ -7,8 +7,7 @@ import {VictoryArea,VictoryAxis,VictoryVoronoiContainer,- VictoryGroup,- VictoryContainer+ VictoryGroup} from 'victory';import theme from '../chart-theme';diff --git a/packages/desktop-client/src/components/settings/UI.js b/packages/desktop-client/src/components/settings/UI.jsindex eb3b39ad67..1a9ea6d46c 100644--- a/packages/desktop-client/src/components/settings/UI.js+++ b/packages/desktop-client/src/components/settings/UI.js@@ -1,5 +1,4 @@import React, { useState } from 'react';-import { useEffect } from 'react';import { useLocation } from 'react-router';import { css, media } from 'glamor';diff --git a/packages/loot-core/src/platform/exceptions/index.web.js b/packages/loot-core/src/platform/exceptions/index.web.jsindex 67832a3f1e..3be4481c99 100644--- a/packages/loot-core/src/platform/exceptions/index.web.js+++ b/packages/loot-core/src/platform/exceptions/index.web.js@@ -1,5 +1,3 @@-/* global globalThis */-export function captureException(exc) {console.log('[Exception]', exc);}diff --git a/packages/loot-design/src/components/common.js b/packages/loot-design/src/components/common.jsindex 9c6252fa5d..4b6225f018 100644--- a/packages/loot-design/src/components/common.js+++ b/packages/loot-design/src/components/common.js@@ -16,7 +16,7 @@ import {ListboxList,ListboxOption} from '@reach/listbox';-import { css, media } from 'glamor';+import { css } from 'glamor';import hotkeys from 'hotkeys-js';import { integerToCurrency } from 'loot-core/src/shared/util';diff --git a/packages/loot-design/src/components/sidebar.js b/packages/loot-design/src/components/sidebar.jsindex db88ad647a..68ccd13933 100644--- a/packages/loot-design/src/components/sidebar.js+++ b/packages/loot-design/src/components/sidebar.js@@ -1,12 +1,9 @@import React, { useState, useMemo, useCallback, useEffect } from 'react';import { RectButton } from 'react-native-gesture-handler';-import { useDispatch } from 'react-redux';import { useLocation } from 'react-router';-import { withRouter } from 'react-router-dom';import { css } from 'glamor';-import { closeBudget } from 'loot-core/src/client/actions/budgets';import Platform from 'loot-core/src/client/platform';import { styles, colors } from '../style';@@ -14,7 +11,6 @@ import Add from '../svg/v1/Add';import CheveronDown from '../svg/v1/CheveronDown';import CheveronRight from '../svg/v1/CheveronRight';import Cog from '../svg/v1/Cog';-import DotsHorizontalTriple from '../svg/v1/DotsHorizontalTriple';import Reports from '../svg/v1/Reports';import StoreFrontIcon from '../svg/v1/StoreFront';import TuningIcon from '../svg/v1/Tuning';@@ -27,9 +23,7 @@ import {AlignedText,AnchorLink,ButtonLink,- Button,- Menu,- Tooltip+ Button} from './common';import { useDraggable, useDroppable, DropHighlight } from './sort.js';import CellValue from './spreadsheet/CellValue';diff --git a/packages/loot-design/src/setupTests.js b/packages/loot-design/src/setupTests.jsindex 90b848eb2e..957c1cf05f 100644--- a/packages/loot-design/src/setupTests.js+++ b/packages/loot-design/src/setupTests.js@@ -1,6 +1,3 @@-import { fireEvent } from '@testing-library/react';-import { act } from 'react-dom/test-utils';-import { resetStore } from 'loot-core/src/mocks/redux';const uuid = require('loot-core/src/platform/uuid');