Browse Source

fix(lint): fix linting errors

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
c78b176cd5
  1. 4
      app/api/index.js
  2. 16
      app/components/Channels/Channels.js
  3. 30
      app/components/LndSyncing/LndSyncing.js
  4. 7
      app/components/Peers/Peers.js
  5. 1
      app/lnd/lib/lightning.js
  6. 2
      app/lnd/subscribe/index.js
  7. 2
      app/reducers/balance.js
  8. 8
      app/reducers/lnd.js
  9. 1
      app/reducers/transaction.js
  10. 9
      app/routes/app/components/App.js

4
app/api/index.js

@ -16,8 +16,8 @@ export function requestTickers(ids) {
}
export function requestBlockHeight(id) {
const BASE_URL = `https://testnet-api.smartbit.com.au/v1/blockchain/blocks?limit=1`
export function requestBlockHeight() {
const BASE_URL = 'https://testnet-api.smartbit.com.au/v1/blockchain/blocks?limit=1'
return axios({
method: 'get',
url: BASE_URL

16
app/components/Channels/Channels.js

@ -27,15 +27,15 @@ const Channels = ({
}) => {
const refreshClicked = (event) => {
// store event in icon so we dont get an error when react clears it
let icon = event.currentTarget
const icon = event.currentTarget
// fetch channels
fetchChannels()
// clear animation after the second so we can reuse it
setTimeout(() => icon.style.animation = '', 1000)
setTimeout(() => { icon.style.animation = '' }, 1000)
// spin icon for 1 sec
// spin icon for 1 sec
icon.style.animation = 'spin 1000ms linear 1'
}
@ -48,7 +48,14 @@ const Channels = ({
explorerLinkBase={explorerLinkBase}
closeChannel={closeChannel}
/>
<ChannelForm form={channelForm} setForm={setChannelForm} ticker={ticker} peers={peers} openChannel={openChannel} currentTicker={currentTicker} />
<ChannelForm
form={channelForm}
setForm={setChannelForm}
ticker={ticker}
peers={peers}
openChannel={openChannel}
currentTicker={currentTicker}
/>
<div className={styles.header}>
<h3>Channels</h3>
<span
@ -113,6 +120,7 @@ const Channels = ({
}
Channels.propTypes = {
fetchChannels: PropTypes.func.isRequired,
ticker: PropTypes.object.isRequired,
peers: PropTypes.array.isRequired,
channelsLoading: PropTypes.bool.isRequired,

30
app/components/LndSyncing/LndSyncing.js

@ -1,14 +1,15 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import styles from './LndSyncing.scss'
class LndSyncing extends Component {
constructor(props) {
super(props);
super(props);
this.state = {
facts: [
{
title: 'No2x',
description: 'Segwit2x is a hard fork proposal led by Barry Silbert and the NYA signers. The idea was drawn up and signed in a locked hotel room with select individuals and goes against everything that Bitcoin stands for. There is no favoritism in Bitcoin. There are no politicians. Hash power and business don\'t speak for us. Don\'t trust, verify.'
description: 'Segwit2x is a hard fork proposal led by Barry Silbert and the NYA signers. The idea was drawn up and signed in a locked hotel room with select individuals and goes against everything that Bitcoin stands for. There is no favoritism in Bitcoin. There are no politicians. Hash power and business don\'t speak for us. Don\'t trust, verify.' // eslint-disable-line
},
{
title: 'Gang',
@ -41,8 +42,7 @@ class LndSyncing extends Component {
<h3>zap</h3>
<div className={styles.loading}>
{!fetchingBlockHeight && <h4>{syncPercentage}%</h4>}
<div className={styles.spinner}>
</div>
<div className={styles.spinner} />
<h1>syncing your lightning node to the blockchain</h1>
</div>
<div className={styles.facts}>
@ -52,15 +52,13 @@ class LndSyncing extends Component {
</div>
<ul>
{
facts.map((facts, index) => {
return (
<li
className={`${styles.factButton} ${currentFact === index && styles.active}`}
key={index}
onClick={() => this.setState({ currentFact: index })}
/>
)
})
facts.map((fact, index) => (
<li
className={`${styles.factButton} ${currentFact === index && styles.active}`}
key={index}
onClick={() => this.setState({ currentFact: index })}
/>
))
}
</ul>
</div>
@ -69,4 +67,10 @@ class LndSyncing extends Component {
}
}
LndSyncing.propTypes = {
fetchBlockHeight: PropTypes.func.isRequired,
fetchingBlockHeight: PropTypes.bool.isRequired,
syncPercentage: PropTypes.number.isRequired
}
export default LndSyncing

7
app/components/Peers/Peers.js

@ -21,15 +21,15 @@ const Peers = ({
}) => {
const refreshClicked = (event) => {
// store event in icon so we dont get an error when react clears it
let icon = event.currentTarget
const icon = event.currentTarget
// fetch peers
fetchPeers()
// clear animation after the second so we can reuse it
setTimeout(() => icon.style.animation = '', 1000)
setTimeout(() => { icon.style.animation = '' }, 1000)
// spin icon for 1 sec
// spin icon for 1 sec
icon.style.animation = 'spin 1000ms linear 1'
}
@ -70,6 +70,7 @@ const Peers = ({
}
Peers.propTypes = {
fetchPeers: PropTypes.func.isRequired,
peersLoading: PropTypes.bool.isRequired,
peers: PropTypes.array.isRequired,
setPeer: PropTypes.func.isRequired,

1
app/lnd/lib/lightning.js

@ -5,7 +5,6 @@ import config from '../config'
module.exports = (rpcpath, host) => {
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA'
console.log('RPC PATH: ', path.join(__dirname, 'rpc.proto'))
const rpc = grpc.load(path.join(__dirname, 'rpc.proto'))
const lndCert = fs.readFileSync(config.cert)

2
app/lnd/subscribe/index.js

@ -2,8 +2,6 @@ import subscribeToTransactions from './transactions'
import subscribeToInvoices from './invoices'
export default (mainWindow, lnd) => {
console.log('mainWindow: ', mainWindow)
console.log('lnd: ', lnd)
subscribeToTransactions(mainWindow, lnd)
subscribeToInvoices(mainWindow, lnd)
}

2
app/reducers/balance.js

@ -21,7 +21,7 @@ export const fetchBalance = () => async (dispatch) => {
}
// Receive IPC event for balance
export const receiveBalance = (event, { walletBalance, channelBalance }) => dispatch => {
export const receiveBalance = (event, { walletBalance, channelBalance }) => (dispatch) => {
dispatch({ type: RECEIVE_BALANCE, walletBalance, channelBalance })
}

8
app/reducers/lnd.js

@ -22,7 +22,7 @@ export const RECEIVE_BLOCK_HEIGHT = 'RECEIVE_BLOCK_HEIGHT'
export const lndSyncing = () => dispatch => dispatch({ type: START_SYNCING })
// Receive IPC event for LND stoping sync
export const lndSynced = () => dispatch => {
export const lndSynced = () => (dispatch) => {
// Fetch data now that we know LND is synced
dispatch(fetchTicker())
dispatch(fetchBalance())
@ -32,7 +32,9 @@ export const lndSynced = () => dispatch => {
}
// Receive IPC event for LND streaming a line
export const lndStdout = (event, lndBlockHeight) => dispatch => dispatch({ type: RECEIVE_LINE, lndBlockHeight: lndBlockHeight.split(' ')[0].split(/(\r\n|\n|\r)/gm)[0] })
export const lndStdout = (event, lndBlockHeight) => dispatch => (
dispatch({ type: RECEIVE_LINE, lndBlockHeight: lndBlockHeight.split(' ')[0].split(/(\r\n|\n|\r)/gm)[0] })
)
export function getBlockHeight() {
return {
@ -64,7 +66,7 @@ const ACTION_HANDLERS = {
[RECEIVE_LINE]: (state, { lndBlockHeight }) => ({ ...state, lndBlockHeight }),
[GET_BLOCK_HEIGHT]: state => ({ ...state, fetchingBlockHeight: true }),
[RECEIVE_BLOCK_HEIGHT]: (state, { blockHeight }) => ({ ...state, blockHeight, fetchingBlockHeight: false }),
[RECEIVE_BLOCK_HEIGHT]: (state, { blockHeight }) => ({ ...state, blockHeight, fetchingBlockHeight: false })
}
// ------------------------------------

1
app/reducers/transaction.js

@ -73,7 +73,6 @@ export const transactionError = () => (dispatch) => {
// Listener for when a new transaction is pushed from the subscriber
export const newTransaction = (event, { transaction }) => (dispatch) => {
console.log('transaction: ', transaction)
// Fetch new balance
dispatch(fetchBalance())

9
app/routes/app/components/App.js

@ -11,10 +11,6 @@ class App extends Component {
componentWillMount() {
const { fetchTicker, fetchBalance, fetchInfo, lnd: { syncing } } = this.props
if (syncing) {
fetchBlockHeight()
}
if (!syncing) {
fetchTicker()
fetchBalance()
@ -86,6 +82,11 @@ class App extends Component {
}
App.propTypes = {
lnd: PropTypes.object.isRequired,
syncPercentage: PropTypes.number.isRequired,
fetchBlockHeight: PropTypes.func.isRequired,
modal: PropTypes.object.isRequired,
ticker: PropTypes.object.isRequired,
balance: PropTypes.object.isRequired,

Loading…
Cancel
Save