Browse Source

fix(lint): fix lint errors

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
3a1d008466
  1. 3
      .eslintrc
  2. 18
      app/reducers/activity.js
  3. 9
      app/routes/activity/components/Activity.js
  4. 2
      app/routes/activity/components/components/Invoice/Invoice.js
  5. 5
      app/routes/activity/components/components/Payment/Payment.js
  6. 3
      app/routes/activity/components/components/Transaction/Transaction.js

3
.eslintrc

@ -46,7 +46,8 @@
"array": false, "array": false,
"object": true "object": true
}], }],
"prefer-promise-reject-errors": 0 "prefer-promise-reject-errors": 0,
"no-param-reassign": [2, { "props": false }]
}, },
"plugins": [ "plugins": [
"flowtype", "flowtype",

18
app/reducers/activity.js

@ -104,7 +104,6 @@ const searchSelector = state => state.activity.searchText
const paymentsSelector = state => state.payment.payments const paymentsSelector = state => state.payment.payments
const invoicesSelector = state => state.invoice.invoices const invoicesSelector = state => state.invoice.invoices
const transactionsSelector = state => state.transaction.transactions const transactionsSelector = state => state.transaction.transactions
const channelsSelector = state => state.channels.channels
const invoiceExpired = (invoice) => { const invoiceExpired = (invoice) => {
const expiresAt = (parseInt(invoice.creation_date, 10) + parseInt(invoice.expiry, 10)) const expiresAt = (parseInt(invoice.creation_date, 10) + parseInt(invoice.expiry, 10))
@ -127,29 +126,22 @@ const months = ['Jan', 'Feb', 'Mar', 'April', 'May', 'June', 'July', 'Aug', 'Sep
// groups the data by day // groups the data by day
function groupData(data) { function groupData(data) {
const groups = data.reduce((groups, el) => { return data.reduce((arr, el) => {
const d = new Date(returnTimestamp(el) * 1000) const d = new Date(returnTimestamp(el) * 1000)
const date = d.getDate() const date = d.getDate()
const title = `${months[d.getMonth()]} ${date}, ${d.getFullYear()}` const title = `${months[d.getMonth()]} ${date}, ${d.getFullYear()}`
if (!groups[title]) { groups[title] = [] } if (!arr[title]) { arr[title] = [] }
groups[title].push({ el }) arr[title].push({ el })
return groups return arr
}, {}) }, {})
return groups
} }
// takes the result of groupData and returns an array // takes the result of groupData and returns an array
function groupArray(data) { function groupArray(data) {
return Object.keys(data).map((title) => { return Object.keys(data).map(title => ({ title, activity: data[title] }))
return {
title,
activity: data[title]
}
})
} }
// sorts data form new to old according to the timestamp // sorts data form new to old according to the timestamp

9
app/routes/activity/components/Activity.js

@ -74,8 +74,6 @@ class Activity extends Component {
changeFilter, changeFilter,
currentActivity, currentActivity,
network,
walletProps walletProps
} = this.props } = this.props
@ -108,7 +106,7 @@ class Activity extends Component {
<h2>{activityBlock.title}</h2> <h2>{activityBlock.title}</h2>
<ul> <ul>
{ {
activityBlock.activity.map(activity => <li>{this.renderActivity(activity.el)}</li>) activityBlock.activity.map((activity, i) => <li key={i}>{this.renderActivity(activity.el)}</li>)
} }
</ul> </ul>
</li> </li>
@ -129,6 +127,7 @@ Activity.propTypes = {
ticker: PropTypes.object.isRequired, ticker: PropTypes.object.isRequired,
currentTicker: PropTypes.object.isRequired, currentTicker: PropTypes.object.isRequired,
network: PropTypes.object.isRequired,
showActivityModal: PropTypes.func.isRequired, showActivityModal: PropTypes.func.isRequired,
changeFilter: PropTypes.func.isRequired, changeFilter: PropTypes.func.isRequired,
@ -136,7 +135,9 @@ Activity.propTypes = {
activity: PropTypes.object.isRequired, activity: PropTypes.object.isRequired,
currentActivity: PropTypes.array.isRequired, currentActivity: PropTypes.array.isRequired,
balance: PropTypes.object.isRequired, balance: PropTypes.object.isRequired,
walletProps: PropTypes.object.isRequired walletProps: PropTypes.object.isRequired,
currencyName: PropTypes.string.isRequired
} }
export default Activity export default Activity

2
app/routes/activity/components/components/Invoice/Invoice.js

@ -5,10 +5,8 @@ import 'moment-timezone'
import { btc } from 'utils' import { btc } from 'utils'
import Isvg from 'react-inlinesvg' import Isvg from 'react-inlinesvg'
import { FaBolt } from 'react-icons/lib/fa'
import Value from 'components/Value' import Value from 'components/Value'
import checkmarkIcon from 'icons/check_circle.svg' import checkmarkIcon from 'icons/check_circle.svg'
import clockIcon from 'icons/clock.svg'
import styles from '../Activity.scss' import styles from '../Activity.scss'
const Invoice = ({ const Invoice = ({

5
app/routes/activity/components/components/Payment/Payment.js

@ -5,10 +5,7 @@ import Moment from 'react-moment'
import 'moment-timezone' import 'moment-timezone'
import { btc } from 'utils' import { btc } from 'utils'
import Isvg from 'react-inlinesvg'
import { FaBolt } from 'react-icons/lib/fa'
import Value from 'components/Value' import Value from 'components/Value'
import checkmarkIcon from 'icons/check_circle.svg'
import styles from '../Activity.scss' import styles from '../Activity.scss'
const Payment = ({ const Payment = ({
@ -53,9 +50,11 @@ const Payment = ({
} }
Payment.propTypes = { Payment.propTypes = {
currencyName: PropTypes.string.isRequired,
payment: PropTypes.object.isRequired, payment: PropTypes.object.isRequired,
ticker: PropTypes.object.isRequired, ticker: PropTypes.object.isRequired,
currentTicker: PropTypes.object.isRequired, currentTicker: PropTypes.object.isRequired,
nodes: PropTypes.array.isRequired,
showActivityModal: PropTypes.func.isRequired showActivityModal: PropTypes.func.isRequired
} }

3
app/routes/activity/components/components/Transaction/Transaction.js

@ -4,10 +4,7 @@ import Moment from 'react-moment'
import 'moment-timezone' import 'moment-timezone'
import { btc } from 'utils' import { btc } from 'utils'
import Isvg from 'react-inlinesvg'
import { FaChain } from 'react-icons/lib/fa'
import Value from 'components/Value' import Value from 'components/Value'
import checkmarkIcon from 'icons/check_circle.svg'
import styles from '../Activity.scss' import styles from '../Activity.scss'
const Transaction = ({ const Transaction = ({

Loading…
Cancel
Save