From 4c0bd80f2425575dbdd46db0bac69b0b0d9eeb50 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Thu, 1 Sep 2022 12:47:34 +0100 Subject: [PATCH] Enforce linting in loot-design (#233) * build: add linter to loot-design package * style: automated fixes * style: manual linter fixes --- packages/loot-design/package.json | 10 ++-- .../src/components/PayeeAutocomplete.js | 4 +- .../loot-design/src/components/View.mobile.js | 2 +- .../components/budget/report/components.js | 10 ++-- packages/loot-design/src/components/common.js | 2 +- packages/loot-design/src/components/hooks.js | 2 +- .../src/components/manager/ImportYNAB4.js | 17 ++----- .../src/components/mobile/ScalableImage.js | 2 +- .../src/components/mobile/account.js | 2 +- .../src/components/mobile/budget.js | 48 ++++++++++--------- .../src/components/mobile/budget.test.js | 4 +- .../src/components/mobile/dragdrop.js | 2 +- .../src/components/mobile/transaction.js | 16 ++----- .../components/mobile/transaction.usage.js | 4 +- .../src/components/modals/CloseAccount.js | 10 +--- .../src/components/modals/PlaidExternalMsg.js | 9 +--- .../src/components/payees.usage.js | 7 ++- .../components/spreadsheet/CellDebugger.js | 4 +- .../src/components/spreadsheet/SheetValue.js | 29 +++++------ .../components/spreadsheet/useSheetValue.js | 29 +++++------ packages/loot-design/src/components/table.js | 40 +++++++--------- .../loot-design/src/components/tooltips.js | 3 +- packages/loot-design/src/parse-figma-theme.js | 2 +- packages/loot-design/src/setupTests.js | 2 +- packages/loot-design/src/svg/Add.mobile.js | 8 ++-- packages/loot-design/src/svg/Add.web.js | 8 ++-- packages/loot-design/src/svg/Bank.mobile.js | 6 +-- packages/loot-design/src/svg/Bank.web.js | 6 +-- packages/loot-design/src/svg/Budget.mobile.js | 6 +-- packages/loot-design/src/svg/Budget.web.js | 6 +-- packages/loot-design/src/svg/Check.mobile.js | 3 +- packages/loot-design/src/svg/Check.web.js | 6 +-- packages/loot-design/src/svg/Delete.mobile.js | 6 +-- packages/loot-design/src/svg/Delete.web.js | 6 +-- .../loot-design/src/svg/DownArrow.mobile.js | 6 +-- packages/loot-design/src/svg/DownArrow.web.js | 6 +-- .../loot-design/src/svg/DragIOS.mobile.js | 6 +-- packages/loot-design/src/svg/DragIOS.web.js | 6 +-- .../loot-design/src/svg/ExpandArrow.mobile.js | 6 +-- .../loot-design/src/svg/ExpandArrow.web.js | 12 +++-- .../loot-design/src/svg/LeftArrow.mobile.js | 7 ++- packages/loot-design/src/svg/LeftArrow.web.js | 7 ++- .../loot-design/src/svg/LeftArrow2.mobile.js | 6 +-- .../loot-design/src/svg/LeftArrow2.web.js | 6 +-- .../loot-design/src/svg/LeftArrow3.mobile.js | 6 +-- .../loot-design/src/svg/LeftArrow3.web.js | 6 +-- .../loot-design/src/svg/Loading.mobile.js | 6 +-- packages/loot-design/src/svg/Loading.web.js | 6 +-- packages/loot-design/src/svg/Logo.mobile.js | 6 +-- packages/loot-design/src/svg/Logo.web.js | 6 +-- packages/loot-design/src/svg/Math.mobile.js | 6 +-- packages/loot-design/src/svg/Math.web.js | 6 +-- packages/loot-design/src/svg/Pencil.mobile.js | 7 ++- packages/loot-design/src/svg/Pencil.web.js | 7 ++- .../loot-design/src/svg/Reports.mobile.js | 6 +-- packages/loot-design/src/svg/Reports.web.js | 6 +-- .../loot-design/src/svg/RightArrow.mobile.js | 7 ++- .../loot-design/src/svg/RightArrow.web.js | 7 ++- .../loot-design/src/svg/RightArrow2.mobile.js | 6 +-- .../loot-design/src/svg/RightArrow2.web.js | 6 +-- packages/loot-design/src/svg/Search.mobile.js | 6 +-- packages/loot-design/src/svg/Search.web.js | 6 +-- .../loot-design/src/svg/Settings.mobile.js | 6 +-- packages/loot-design/src/svg/Settings.web.js | 6 +-- .../loot-design/src/svg/Subtract.mobile.js | 6 +-- packages/loot-design/src/svg/Subtract.web.js | 1 - packages/loot-design/src/svg/logo/Logo.ios.js | 6 +-- packages/loot-design/src/svg/merge.mobile.js | 6 +-- packages/loot-design/src/svg/merge.web.js | 6 +-- packages/loot-design/src/svg/split.mobile.js | 6 +-- packages/loot-design/src/svg/split.web.js | 6 +-- yarn.lock | 2 + 72 files changed, 259 insertions(+), 293 deletions(-) diff --git a/packages/loot-design/package.json b/packages/loot-design/package.json index 1b54ea5..4d9a147 100644 --- a/packages/loot-design/package.json +++ b/packages/loot-design/package.json @@ -12,6 +12,8 @@ "chroma-js": "^1.3.3", "date-fns": "2.0.0-alpha.27", "downshift": "1.31.16", + "eslint": "5.6.0", + "eslint-plugin-prettier": "^3.1.4", "fast-glob": "^2.2.2", "formik": "^0.11.10", "glamor": "^2.20.40", @@ -48,7 +50,8 @@ "start:mobile": "IS_REACT_NATIVE=1 react-scripts start", "test": "npm-run-all -cp 'test:*'", "test:web": "jest -c jest.config.js", - "test:react-native": "jest -c jest.rn.config.js" + "test:react-native": "jest -c jest.rn.config.js", + "lint": "eslint src" }, "homepage": "./", "manifest": "manifest.json", @@ -61,8 +64,5 @@ }, "browserslist": [ "electron 3.0" - ], - "eslintConfig": { - "extends": "react-app" - } + ] } diff --git a/packages/loot-design/src/components/PayeeAutocomplete.js b/packages/loot-design/src/components/PayeeAutocomplete.js index 9f48367..4c3ee16 100644 --- a/packages/loot-design/src/components/PayeeAutocomplete.js +++ b/packages/loot-design/src/components/PayeeAutocomplete.js @@ -183,7 +183,9 @@ export default function PayeeAutocomplete({ let payees = useCachedPayees(); let accounts = useCachedAccounts(); - let [focusTransferPayees, setFocusTransferPayees] = useState(defaultFocusTransferPayees); + let [focusTransferPayees, setFocusTransferPayees] = useState( + defaultFocusTransferPayees + ); let payeeSuggestions = useMemo( () => [ { id: 'new', name: '' }, diff --git a/packages/loot-design/src/components/View.mobile.js b/packages/loot-design/src/components/View.mobile.js index e4418c8..f20f299 100644 --- a/packages/loot-design/src/components/View.mobile.js +++ b/packages/loot-design/src/components/View.mobile.js @@ -1,3 +1,3 @@ import { View } from 'react-native'; -export default View +export default View; diff --git a/packages/loot-design/src/components/budget/report/components.js b/packages/loot-design/src/components/budget/report/components.js index 51bdb80..b3d87f9 100644 --- a/packages/loot-design/src/components/budget/report/components.js +++ b/packages/loot-design/src/components/budget/report/components.js @@ -33,7 +33,7 @@ export const BudgetTotalsMonth = React.memo(function BudgetTotalsMonth() { binding={reportBudget.totalBudgetedExpense} type="financial" style={{ color: colors.n4, fontWeight: 600 }} - formatter={(value) => { + formatter={value => { return format(parseFloat(value || '0'), 'financial'); }} /> @@ -136,7 +136,7 @@ function BalanceTooltip({ categoryId, tooltip, monthIndex, onBudgetAction }) { onClose={tooltip.close} >