From 041647d1f6c4056af8177689f6caa68faab49e77 Mon Sep 17 00:00:00 2001 From: Anthony Date: Thu, 12 Aug 2021 13:53:28 +0200 Subject: [PATCH] fix lot of linting errors and make command more userful --- package.json | 2 +- .../walletFiatAccountHistory/view.jsx | 33 +++------ ui/component/walletFiatBalance/view.jsx | 30 ++++---- .../walletFiatPaymentBalance/view.jsx | 21 ++---- .../walletFiatPaymentHistory/view.jsx | 64 +++++++---------- ui/page/settingsStripeAccount/view.jsx | 3 +- ui/page/settingsStripeCard/view.jsx | 4 +- ui/page/wallet/view.jsx | 70 ++++++++----------- 8 files changed, 87 insertions(+), 140 deletions(-) diff --git a/package.json b/package.json index e6765f310..eb99f3de0 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "build:dir": "yarn build -- --dir -c.compression=store -c.mac.identity=null", "crossenv": "./node_modules/cross-env/dist/bin/cross-env", "lint": "eslint 'ui/**/*.{js,jsx}' && eslint 'web/**/*.{js,jsx}' && eslint 'electron/**/*.js' && flow", - "lint-fix": "eslint --fix 'ui/**/*.{js,jsx}' && eslint --fix 'web/**/*.{js,jsx}' && eslint --fix 'electron/**/*.js' && flow", + "lint-fix": "eslint --fix --quiet 'ui/**/*.{js,jsx}' && eslint --fix --quiet 'web/**/*.{js,jsx}' && eslint --fix --quiet 'electron/**/*.js'", "format": "prettier 'src/**/*.{js,jsx,scss,json}' --write", "flow-defs": "flow-typed install", "precommit": "lint-staged", diff --git a/ui/component/walletFiatAccountHistory/view.jsx b/ui/component/walletFiatAccountHistory/view.jsx index 3c83c3d69..dd40d08c4 100644 --- a/ui/component/walletFiatAccountHistory/view.jsx +++ b/ui/component/walletFiatAccountHistory/view.jsx @@ -1,16 +1,7 @@ // @flow -import * as ICONS from 'constants/icons'; -import * as MODALS from 'constants/modal_types'; -import * as PAGES from 'constants/pages'; import React from 'react'; -import CreditAmount from 'component/common/credit-amount'; import Button from 'component/button'; -import HelpLink from 'component/common/help-link'; import Card from 'component/common/card'; -import Icon from 'component/common/icon'; -import LbcSymbol from 'component/common/lbc-symbol'; -import I18nMessage from 'component/i18nMessage'; -import { formatNumberWithCommas } from 'util/number'; import { Lbryio } from 'lbryinc'; import moment from 'moment'; @@ -20,43 +11,37 @@ type Props = { }; const WalletBalance = (props: Props) => { - const { - - } = props; - // receive transactions from parent component let accountTransactions = props.transactions; // reverse so most recent payments come first - if(accountTransactions){ + if (accountTransactions) { accountTransactions = accountTransactions.reverse(); } - if(accountTransactions && accountTransactions.length > 10 ){ + if (accountTransactions && accountTransactions.length > 10) { accountTransactions.length = 10; } - const [detailsExpanded, setDetailsExpanded] = React.useState(false); + // const [detailsExpanded, setDetailsExpanded] = React.useState(false); const [accountStatusResponse, setAccountStatusResponse] = React.useState(); const [subscriptions, setSubscriptions] = React.useState([]); var environment = 'test'; - function getAccountStatus(){ + function getAccountStatus() { return Lbryio.call( 'account', 'status', { - environment + environment, }, 'post' ); } React.useEffect(() => { - - - (async function(){ + (async function() { const response = await getAccountStatus(); setAccountStatusResponse(response); @@ -68,7 +53,7 @@ const WalletBalance = (props: Props) => { return ( <>
@@ -116,7 +101,7 @@ const WalletBalance = (props: Props) => { ))}
- {!accountTransactions &&

No Transactions

} + {!accountTransactions &&

No Transactions

}
)} @@ -170,7 +155,7 @@ const WalletBalance = (props: Props) => { ))} - {(!subscriptions || subscriptions.length === 0) &&

No Subscriptions

} + {(!subscriptions || subscriptions.length === 0) &&

No Subscriptions

} } diff --git a/ui/component/walletFiatBalance/view.jsx b/ui/component/walletFiatBalance/view.jsx index fbf08ba55..4661aa2f9 100644 --- a/ui/component/walletFiatBalance/view.jsx +++ b/ui/component/walletFiatBalance/view.jsx @@ -1,16 +1,12 @@ // @flow import * as ICONS from 'constants/icons'; -import * as MODALS from 'constants/modal_types'; import * as PAGES from 'constants/pages'; import React from 'react'; import CreditAmount from 'component/common/credit-amount'; import Button from 'component/button'; -import HelpLink from 'component/common/help-link'; import Card from 'component/common/card'; import Icon from 'component/common/icon'; -import LbcSymbol from 'component/common/lbc-symbol'; import I18nMessage from 'component/i18nMessage'; -import { formatNumberWithCommas } from 'util/number'; type Props = { accountDetails: any, @@ -27,8 +23,8 @@ const WalletBalance = (props: Props) => { const [detailsExpanded, setDetailsExpanded] = React.useState(false); return ( - <>{1 == 1 && {accountDetails && accountDetails.total_received_unpaid/100 || 0} USD} + <>{{(accountDetails && (accountDetails.total_received_unpaid / 100)) || 0} USD} subtitle={ This is your remaining balance that can still be withdrawn to your bank account @@ -37,11 +33,11 @@ const WalletBalance = (props: Props) => { actions={ <>

- ${accountDetails && accountDetails.total_tipped / 100 || 0} Total Received Tips + ${(accountDetails && (accountDetails.total_tipped / 100)) || 0} Total Received Tips

- ${accountDetails && accountDetails.total_paid_out/100 || 0} Withdrawn + ${(accountDetails && (accountDetails.total_paid_out / 100)) || 0} Withdrawn