diff --git a/.eslintrc.js b/.eslintrc.js index 42158f30feea34a437df3e5b73354b0478e38535..76c0c9f087b0740b5ccd4275915f46b130e0d3a3 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.js index 4e7e482a1c2725f6aeb42c465ee3037ae0d372b5..7b497c2385a450e7a00eceb15a917e39b23cd637 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.js index a388c15d948bf33649fb95ebcccf5cbbc42b82e7..ec8af902ad46dcfe4b261622e07931f2aed2c139 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.js index 04d077ae85cc178e4f576fffc3ff1f53973bb495..faa6d99ca696ee30e02e01e67a492dc5963e3098 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.js index 52907681f18af99ecbca571aec793ff25b95daaf..4434baf5cd8ae727126674fbbc5fc82125fa6530 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-vars const 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.js index 1e2719e7d819adcb2449af7216050273eba701d7..181b7ea589b215d78afd192a8e5eee2715ab3fc6 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.js index 0ab73d1ac179c98442ca821e965fa50823fc4611..bccae0c25cc991a33737c9586004a6e4311f7294 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 element let 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 accessibility diff --git a/packages/desktop-client/src/components/budget/MobileBudget.js b/packages/desktop-client/src/components/budget/MobileBudget.js index 90c60540529f5964a7af311f36bd4dd9cb191c69..d283cda0daf841ff4a3721b5ad5fd5fc861917c1 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.js index d57a7f9ed11217441e3f635b10d9b24ced56715c..ccad35be89032318c4f31cc1a428ce3f2fbeb1df 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-vars function 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-vars function 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.js index d7587cb2bb19a6422005249b73cfef0a4eab48ba..b1b2386a0c0a899be6f8e60bb664331651c63dc8 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.js index eb3b39ad6749efb31f53fe9fe3a8528d8dc53a16..1a9ea6d46ca819d4ca4fa68d2a1b5cb3fd90bb77 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.js index 67832a3f1ebd216a1b3ddc032f277167811cb030..3be4481c9946a6f58474157363a2f5de70a16cd7 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.js index 9c6252fa5d432d2b319b2b9ce83f57beeaf82c52..4b6225f01855348d40c4bac65449bd5ade2794f5 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.js index db88ad647a844ce64c614307071c84d2103a4507..68ccd1393363da5501237cff8670411a0ca32884 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.js index 90b848eb2e72865a4a92e26e591d157eb62911f7..957c1cf05f7a985c493e490169d2ba56b5ba9e5c 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');