Skip to content

Commit b84ba05

Browse files
committed
fix(docs): linting
1 parent 03dc652 commit b84ba05

File tree

8 files changed

+64
-64
lines changed

8 files changed

+64
-64
lines changed

examples/delegated-routing/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
"react-scripts": "1.1.5"
1919
},
2020
"scripts": {
21-
"start": "react-scripts start",
22-
"build": "react-scripts build",
23-
"test": "react-scripts test --env=jsdom",
24-
"eject": "react-scripts eject"
21+
"start": "react-scripts start"
2522
}
2623
}

examples/delegated-routing/public/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
66
<meta name="theme-color" content="#000000">
77
<title>Delegated Routing</title>
8+
<link rel="stylesheet" type="text/css" href="main.css">
89
</head>
910
<body>
1011
<noscript>

examples/delegated-routing/src/App.css renamed to examples/delegated-routing/public/main.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
font-family: sans-serif;
5+
}
6+
17
section * {
28
margin: 10px;
39
}

examples/delegated-routing/src/App.js

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,46 @@
1-
import React, { Component } from 'react';
2-
import './App.css';
3-
import Ipfs from 'ipfs';
4-
import libp2pBundle from './libp2p-bundle';
1+
// eslint-disable-next-line
2+
'use strict'
3+
4+
const React = require('react')
5+
const Component = React.Component
6+
const Ipfs = require('ipfs')
7+
const libp2pBundle = require('./libp2p-bundle')
8+
// require('./App.css')
59

610
const BootstrapNode = '/ip4/127.0.0.1/tcp/8081/ws/ipfs/QmdoG8DpzYUZMVP5dGmgmigZwR1RE8Cf6SxMPg1SBXJAQ8'
711

812
class App extends Component {
9-
constructor(props) {
10-
super(props);
13+
constructor (props) {
14+
super(props)
1115
this.state = {
1216
peers: 0,
1317
// This hash is the IPFS readme
1418
hash: 'QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB',
1519
// This peer is one of the Bootstrap nodes for IPFS
1620
peer: 'QmV6kA2fB8kTr6jc3pL5zbNsjKbmPUHAPKKHRBYe1kDEyc',
1721
isLoading: 0
18-
};
19-
this.peerInterval = null;
22+
}
23+
this.peerInterval = null
2024

21-
this.handleHashChange = this.handleHashChange.bind(this);
22-
this.handleHashSubmit = this.handleHashSubmit.bind(this);
23-
this.handlePeerChange = this.handlePeerChange.bind(this);
24-
this.handlePeerSubmit = this.handlePeerSubmit.bind(this);
25+
this.handleHashChange = this.handleHashChange.bind(this)
26+
this.handleHashSubmit = this.handleHashSubmit.bind(this)
27+
this.handlePeerChange = this.handlePeerChange.bind(this)
28+
this.handlePeerSubmit = this.handlePeerSubmit.bind(this)
2529
}
2630

27-
handleHashChange(event) {
31+
handleHashChange (event) {
2832
this.setState({
2933
hash: event.target.value
30-
});
34+
})
3135
}
32-
handlePeerChange(event) {
36+
handlePeerChange (event) {
3337
this.setState({
3438
peer: event.target.value
35-
});
39+
})
3640
}
3741

38-
handleHashSubmit(event) {
39-
event.preventDefault();
42+
handleHashSubmit (event) {
43+
event.preventDefault()
4044
this.setState({
4145
isLoading: this.state.isLoading + 1
4246
})
@@ -48,10 +52,10 @@ class App extends Component {
4852
response: data.toString(),
4953
isLoading: this.state.isLoading - 1
5054
})
51-
});
55+
})
5256
}
53-
handlePeerSubmit(event) {
54-
event.preventDefault();
57+
handlePeerSubmit (event) {
58+
event.preventDefault()
5559
this.setState({
5660
isLoading: this.state.isLoading + 1
5761
})
@@ -63,10 +67,10 @@ class App extends Component {
6367
response: JSON.stringify(results, null, 2),
6468
isLoading: this.state.isLoading - 1
6569
})
66-
});
70+
})
6771
}
6872

69-
componentDidMount() {
73+
componentDidMount () {
7074
window.ipfs = this.ipfs = new Ipfs({
7175
config: {
7276
Addresses: {
@@ -101,7 +105,7 @@ class App extends Component {
101105
console.log('Connected!')
102106
})
103107

104-
this.peerInterval = setInterval(() => {
108+
this.peerInterval = setInterval(() => {
105109
this.ipfs.swarm.peers((err, peers) => {
106110
if (err) console.log(err)
107111
if (peers) this.setState({peers: peers.length})
@@ -110,7 +114,7 @@ class App extends Component {
110114
})
111115
}
112116

113-
render() {
117+
render () {
114118
return (
115119
<div>
116120
<header className="center">
@@ -133,7 +137,7 @@ class App extends Component {
133137
</label>
134138
</form>
135139
</section>
136-
<section className={[this.state.isLoading > 0 ? 'loading': '', 'loader'].join(' ')}>
140+
<section className={[this.state.isLoading > 0 ? 'loading' : '', 'loader'].join(' ')}>
137141
<div className="lds-ripple"><div></div><div></div></div>
138142
</section>
139143
<section>
@@ -142,8 +146,8 @@ class App extends Component {
142146
</pre>
143147
</section>
144148
</div>
145-
);
149+
)
146150
}
147151
}
148152

149-
export default App;
153+
module.exports = App

examples/delegated-routing/src/App.test.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

examples/delegated-routing/src/index.css

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import React from 'react';
2-
import ReactDOM from 'react-dom';
3-
import './index.css';
4-
import App from './App';
1+
// eslint-disable-next-line
2+
'use strict'
53

6-
ReactDOM.render(<App />, document.getElementById('root'));
4+
const React = require('react') // eslint-disable-line no-unused-vars
5+
const ReactDOM = require('react-dom')
6+
const App = require('./App') // eslint-disable-line no-unused-vars
7+
// require('index.css')
8+
9+
ReactDOM.render(<App />, document.getElementById('root'))

examples/delegated-routing/src/libp2p-bundle.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
import Libp2p from 'libp2p';
2-
import Websockets from 'libp2p-websockets';
3-
import WebSocketStar from 'libp2p-websocket-star';
4-
import WebRTCStar from 'libp2p-webrtc-star';
5-
import MPLEX from 'libp2p-mplex';
6-
import SECIO from 'libp2p-secio';
7-
import KadDHT from 'libp2p-kad-dht';
8-
import DelegatedPeerRouter from 'libp2p-delegated-peer-routing';
9-
import DelegatedContentRouter from 'libp2p-delegated-content-routing';
1+
// eslint-disable-next-line
2+
'use strict'
103

11-
export default ({peerInfo, peerBook}) => {
12-
const wrtcstar = new WebRTCStar({id: peerInfo.id});
13-
const wsstar = new WebSocketStar({id: peerInfo.id});
4+
const Libp2p = require('libp2p')
5+
const Websockets = require('libp2p-websockets')
6+
const WebSocketStar = require('libp2p-websocket-star')
7+
const WebRTCStar = require('libp2p-webrtc-star')
8+
const MPLEX = require('libp2p-mplex')
9+
const SECIO = require('libp2p-secio')
10+
const KadDHT = require('libp2p-kad-dht')
11+
const DelegatedPeerRouter = require('libp2p-delegated-peer-routing')
12+
const DelegatedContentRouter = require('libp2p-delegated-content-routing')
13+
14+
module.exports = ({peerInfo, peerBook}) => {
15+
const wrtcstar = new WebRTCStar({id: peerInfo.id})
16+
const wsstar = new WebSocketStar({id: peerInfo.id})
1417
const delegatedApiOptions = {
1518
host: '0.0.0.0',
1619
protocol: 'http',
@@ -72,4 +75,4 @@ export default ({peerInfo, peerBook}) => {
7275
}
7376
}
7477
})
75-
};
78+
}

0 commit comments

Comments
 (0)