Browse Source

fix(lint): fix linting errors

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
03f5e22f68
  1. 2
      app/components/Channels/Channel.js
  2. 3
      app/components/CryptoIcon/CryptoIcon.js
  3. 1
      app/components/LoadingBolt/LoadingBolt.js
  4. 1
      app/components/Nav/Nav.js
  5. 4
      app/components/Wallet/Wallet.js
  6. 53
      app/reducers/channels.js
  7. 9
      app/routes/channels/components/Channels.js
  8. 27
      app/routes/wallet/components/Wallet.js

2
app/components/Channels/Channel.js

@ -5,7 +5,7 @@ import { btc } from 'utils'
import styles from './Channel.scss' import styles from './Channel.scss'
const Channel = ({ ticker, channel, closeChannel, currentTicker }) => ( const Channel = ({ ticker, channel, closeChannel, currentTicker }) => (
<li className={styles.channel} onClick={() => setChannel(channel)}> <li className={styles.channel}>
<header className={styles.header}> <header className={styles.header}>
<div> <div>
<span className={styles.status}>Open</span> <span className={styles.status}>Open</span>

3
app/components/CryptoIcon/CryptoIcon.js

@ -1,10 +1,9 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import path from 'path'
import Isvg from 'react-inlinesvg' import Isvg from 'react-inlinesvg'
import skinnyBitcoinIcon from 'icons/skinny_bitcoin.svg' import skinnyBitcoinIcon from 'icons/skinny_bitcoin.svg'
import litecoinIcon from 'icons/skinny_bitcoin.svg' import litecoinIcon from 'icons/litecoin.svg'
const CryptoIcon = ({ currency, styles }) => { const CryptoIcon = ({ currency, styles }) => {
switch (currency) { switch (currency) {

1
app/components/LoadingBolt/LoadingBolt.js

@ -1,5 +1,4 @@
import React from 'react' import React from 'react'
import path from 'path'
import Isvg from 'react-inlinesvg' import Isvg from 'react-inlinesvg'
import cloudboltIcon from 'icons/cloudbolt.svg' import cloudboltIcon from 'icons/cloudbolt.svg'

1
app/components/Nav/Nav.js

@ -1,4 +1,3 @@
import path from 'path'
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { NavLink } from 'react-router-dom' import { NavLink } from 'react-router-dom'

4
app/components/Wallet/Wallet.js

@ -1,12 +1,10 @@
import path from 'path'
import React, { Component } from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { FaQrcode } from 'react-icons/lib/fa' import { FaQrcode } from 'react-icons/lib/fa'
import Isvg from 'react-inlinesvg' import Isvg from 'react-inlinesvg'
import { btc } from 'utils' import { btc } from 'utils'
import ReceiveModal from './ReceiveModal'
import skinnyBitcoinIcon from 'icons/skinny_bitcoin.svg' import skinnyBitcoinIcon from 'icons/skinny_bitcoin.svg'
import ReceiveModal from './ReceiveModal'
import styles from './Wallet.scss' import styles from './Wallet.scss'

53
app/reducers/channels.js

@ -121,7 +121,7 @@ export const pushchannelupdated = () => (dispatch) => {
} }
// Receive IPC event for channel end // Receive IPC event for channel end
export const pushchannelend = event => (dispatch) => { export const pushchannelend = event => (dispatch) => { // eslint-disable-line
dispatch(fetchChannels()) dispatch(fetchChannels())
} }
@ -132,7 +132,7 @@ export const pushchannelerror = (event, { error }) => (dispatch) => {
} }
// Receive IPC event for channel status // Receive IPC event for channel status
export const pushchannelstatus = event => (dispatch) => { export const pushchannelstatus = event => (dispatch) => { // eslint-disable-line
dispatch(fetchChannels()) dispatch(fetchChannels())
} }
@ -284,32 +284,31 @@ export const currentChannels = createSelector(
closingPendingChannels, closingPendingChannels,
filterSelector, filterSelector,
channelSearchQuerySelector, channelSearchQuerySelector,
(allChannels, activeChannels, openChannels, pendingOpenChannels, pendingClosedChannels, filter, searchQuery) => { (allChannelsArr, activeChannelsArr, openChannels, pendingOpenChannels, pendingClosedChannels, filter, searchQuery) => {
// Helper function to deliver correct channel array based on filter // Helper function to deliver correct channel array based on filter
const filteredArray = filter => { const filteredArray = (filterKey) => {
switch(filter) { switch (filterKey) {
case 'ALL_CHANNELS': case 'ALL_CHANNELS':
return allChannels return allChannelsArr
case 'ACTIVE_CHANNELS': case 'ACTIVE_CHANNELS':
return activeChannels return activeChannelsArr
case 'OPEN_CHANNELS': case 'OPEN_CHANNELS':
return openChannels return openChannels
case 'OPEN_PENDING_CHANNELS': case 'OPEN_PENDING_CHANNELS':
return pendingOpenChannels return pendingOpenChannels
case 'CLOSING_PENDING_CHANNELS': case 'CLOSING_PENDING_CHANNELS':
return pendingClosedChannels return pendingClosedChannels
default:
return []
} }
} }
const channelArray = filteredArray(filter.key) const channelArray = filteredArray(filter.key)
console.log('channelArray: ', channelArray) return channelArray.filter(channel => (Object.prototype.hasOwnProperty.call(channel, 'channel') ?
return channelArray.filter(channel => { channel.channel.remote_node_pub.includes(searchQuery) || channel.channel.channel_point.includes(searchQuery)
return Object.prototype.hasOwnProperty.call(channel, 'channel') ? :
channel.channel.remote_node_pub.includes(searchQuery) || channel.channel.channel_point.includes(searchQuery) channel.remote_pubkey.includes(searchQuery) || channel.channel_point.includes(searchQuery)))
:
channel.remote_pubkey.includes(searchQuery) || channel.channel_point.includes(searchQuery)
})
} }
) )
@ -325,18 +324,18 @@ const initialState = {
total_limbo_balance: '', total_limbo_balance: '',
pending_open_channels: [ pending_open_channels: [
{ {
"channel": { channel: {
"remote_node_pub": "0368b02d9e4a44bb156660cf48ed7492445c7cb95435c86125e74953047c7706e3", remote_node_pub: '0368b02d9e4a44bb156660cf48ed7492445c7cb95435c86125e74953047c7706e3',
"channel_point": "01de1cddaf47637b71c37e019f42746aa1135351a4e4539d983ca95f12049a82:0", channel_point: '01de1cddaf47637b71c37e019f42746aa1135351a4e4539d983ca95f12049a82:0',
"capacity": "16777216", capacity: '16777216',
"local_balance": "16768528", local_balance: '16768528',
"remote_balance": "0" remote_balance: '0'
}, },
"confirmation_height": 0, confirmation_height: 0,
"blocks_till_open": 0, blocks_till_open: 0,
"commit_fee": "8688", commit_fee: '8688',
"commit_weight": "600", commit_weight: '600',
"fee_per_kw": "12000" fee_per_kw: '12000'
} }
], ],
pending_closing_channels: [], pending_closing_channels: [],
@ -361,8 +360,8 @@ const initialState = {
{ key: 'ACTIVE_CHANNELS', name: 'Active Channels' }, { key: 'ACTIVE_CHANNELS', name: 'Active Channels' },
{ key: 'OPEN_CHANNELS', name: 'Open Channels' }, { key: 'OPEN_CHANNELS', name: 'Open Channels' },
{ key: 'OPEN_PENDING_CHANNELS', name: 'Open Pending Channels' }, { key: 'OPEN_PENDING_CHANNELS', name: 'Open Pending Channels' },
{ key: 'CLOSING_PENDING_CHANNELS', name: 'Closing Pending Channels' }, { key: 'CLOSING_PENDING_CHANNELS', name: 'Closing Pending Channels' }
], ]
} }
export default function channelsReducer(state = initialState, action) { export default function channelsReducer(state = initialState, action) {

9
app/routes/channels/components/Channels.js

@ -36,7 +36,6 @@ class Channels extends Component {
toggleFilterPulldown, toggleFilterPulldown,
changeFilter, changeFilter,
allChannels,
currentChannels, currentChannels,
openChannels, openChannels,
updateChannelSearchQuery, updateChannelSearchQuery,
@ -68,8 +67,6 @@ class Channels extends Component {
icon.style.animation = 'spin 1000ms linear 1' icon.style.animation = 'spin 1000ms linear 1'
} }
console.log('currentChannels: ',currentChannels)
return ( return (
<div className={`${styles.container} ${viewType === 1 && styles.graphview}`}> <div className={`${styles.container} ${viewType === 1 && styles.graphview}`}>
<ChannelForm {...channelFormProps} /> <ChannelForm {...channelFormProps} />
@ -185,18 +182,22 @@ Channels.propTypes = {
fetchPeers: PropTypes.func.isRequired, fetchPeers: PropTypes.func.isRequired,
channels: PropTypes.object.isRequired, channels: PropTypes.object.isRequired,
allChannels: PropTypes.array.isRequired, currentChannels: PropTypes.array.isRequired,
openChannels: PropTypes.array.isRequired, openChannels: PropTypes.array.isRequired,
updateChannelSearchQuery: PropTypes.func.isRequired, updateChannelSearchQuery: PropTypes.func.isRequired,
setViewType: PropTypes.func.isRequired, setViewType: PropTypes.func.isRequired,
setCurrentChannel: PropTypes.func.isRequired, setCurrentChannel: PropTypes.func.isRequired,
openChannelForm: PropTypes.func.isRequired, openChannelForm: PropTypes.func.isRequired,
closeChannel: PropTypes.func.isRequired,
toggleFilterPulldown: PropTypes.func.isRequired,
changeFilter: PropTypes.func.isRequired,
ticker: PropTypes.object.isRequired, ticker: PropTypes.object.isRequired,
currentTicker: PropTypes.object.isRequired, currentTicker: PropTypes.object.isRequired,
channelFormProps: PropTypes.object.isRequired, channelFormProps: PropTypes.object.isRequired,
nonActiveFilters: PropTypes.object.isRequired,
network: PropTypes.object.isRequired, network: PropTypes.object.isRequired,
fetchDescribeNetwork: PropTypes.func.isRequired, fetchDescribeNetwork: PropTypes.func.isRequired,

27
app/routes/wallet/components/Wallet.js

@ -5,31 +5,20 @@ import styles from './Wallet.scss'
class Wallet extends Component { class Wallet extends Component {
componentWillMount() { componentWillMount() {
const { fetchPeers, fetchChannels } = this.props const { fetchPeers } = this.props
fetchPeers() fetchPeers()
fetchChannels()
} }
render() { render() {
const { const {
ticker,
peers: { peersLoading, peers, peer, peerForm }, peers: { peersLoading, peers, peer, peerForm },
channels: { channelsLoading, channels, channel, channelForm, pendingChannels },
fetchPeers, fetchPeers,
fetchChannels,
setPeer, setPeer,
setChannel,
peerModalOpen, peerModalOpen,
channelModalOpen,
setPeerForm, setPeerForm,
setChannelForm,
connectRequest, connectRequest,
disconnectRequest, disconnectRequest
openChannel,
closeChannel,
currentTicker,
explorerLinkBase
} = this.props } = this.props
return ( return (
@ -55,22 +44,12 @@ class Wallet extends Component {
Wallet.propTypes = { Wallet.propTypes = {
fetchPeers: PropTypes.func.isRequired, fetchPeers: PropTypes.func.isRequired,
fetchChannels: PropTypes.func.isRequired,
ticker: PropTypes.object.isRequired,
peers: PropTypes.object.isRequired, peers: PropTypes.object.isRequired,
channels: PropTypes.object.isRequired,
setPeer: PropTypes.func.isRequired, setPeer: PropTypes.func.isRequired,
setChannel: PropTypes.func.isRequired,
peerModalOpen: PropTypes.bool.isRequired, peerModalOpen: PropTypes.bool.isRequired,
channelModalOpen: PropTypes.bool.isRequired,
setPeerForm: PropTypes.func.isRequired, setPeerForm: PropTypes.func.isRequired,
setChannelForm: PropTypes.func.isRequired,
connectRequest: PropTypes.func.isRequired, connectRequest: PropTypes.func.isRequired,
disconnectRequest: PropTypes.func.isRequired, disconnectRequest: PropTypes.func.isRequired
openChannel: PropTypes.func.isRequired,
closeChannel: PropTypes.func.isRequired,
currentTicker: PropTypes.object.isRequired,
explorerLinkBase: PropTypes.string.isRequired
} }

Loading…
Cancel
Save