Skip to content

Commit 64d589a

Browse files
committed
re-indenting all files to match eslint config
1 parent dd624e3 commit 64d589a

15 files changed

+334
-336
lines changed

examples/webpack.production.config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
var path = require('path')
22
module.exports = {
3-
context: path.join(__dirname, ""),
3+
context: path.join(__dirname, ''),
44
entry: [
55
'./main'
66
],
77
output: {
8-
filename: "app.js",
9-
path: path.join(__dirname, "dist")
8+
filename: 'app.js',
9+
path: path.join(__dirname, 'dist')
1010
},
1111

1212
module: {
@@ -16,10 +16,10 @@ module.exports = {
1616
loaders: ['babel?{presets:["es2015", "react", "stage-2"], plugins:["react-hot-loader/babel"]}']
1717
}, {
1818
test: /\.css$/,
19-
loader: "style-loader!css-loader"
19+
loader: 'style-loader!css-loader'
2020
}, {
2121
test: /\.less$/,
22-
loader: "style-loader!css-loader!less-loader"
22+
loader: 'style-loader!css-loader!less-loader'
2323
}, {
2424
test: /\.(gif|jpg|jpeg|png)(\?]?.*)?$/,
2525
loader: 'url-loader?limit=1024'
@@ -31,7 +31,7 @@ module.exports = {
3131
},
3232

3333
node: {
34-
fs: "empty"
34+
fs: 'empty'
3535
},
3636

3737
// we need this because of enzyme

public/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4-
<meta charset="utf-8">
5-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6-
<title>React Cards</title>
7-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<title>React Cards</title>
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
88
</head>
99
<body>
1010

src/Container.js

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -7,70 +7,70 @@ import style from './style.less'
77

88
export default class Container extends Component {
99

10-
constructor(props) {
11-
super(props)
12-
this.state = { activeNamespace : null, routes: this.createRoutes() }
13-
this.unlisten = null
14-
}
10+
constructor(props) {
11+
super(props)
12+
this.state = { activeNamespace : null, routes: this.createRoutes() }
13+
this.unlisten = null
14+
}
1515

16-
componentWillMount() {
17-
const history = this.props.history? this.props.history : createHistory()
18-
this.unlisten = history.listen((location) => {
19-
this.setState({activeNamespace: location.hash.replace('#/', '')})
20-
})
21-
}
16+
componentWillMount() {
17+
const history = this.props.history ? this.props.history : createHistory()
18+
this.unlisten = history.listen((location) => {
19+
this.setState({activeNamespace: location.hash.replace('#/', '')})
20+
})
21+
}
2222

23-
componentWillUnmount() {
24-
this.unlisten()
25-
}
23+
componentWillUnmount() {
24+
this.unlisten()
25+
}
2626

27-
createRoutes() {
28-
return myro({
29-
'#': {
30-
name: 'index'
31-
},
32-
'#/:namespace': {
33-
name: 'namespace'
34-
}
35-
})
36-
}
27+
createRoutes() {
28+
return myro({
29+
'#': {
30+
name: 'index'
31+
},
32+
'#/:namespace': {
33+
name: 'namespace'
34+
}
35+
})
36+
}
3737

38-
render() {
39-
const { namespaces } = this.props
40-
const { routes, activeNamespace } = this.state
41-
const cards = namespaces[activeNamespace]
42-
const navCard = this.renderNavCard(routes, activeNamespace)
43-
return (
44-
<div className={style.container}>
45-
<h1>React Cards</h1>
46-
{cards
47-
? <div className='react-cards-namespace-cards'>
48-
<CardList namespace={ activeNamespace }>{ [navCard, ...cards] }</CardList>
49-
</div>
50-
: <div className="react-cards-menu">
51-
<CardList>
52-
{map(namespaces, (namespace, key) => (
53-
<Card key={key} noframe>
54-
<a className={style.nav} href={ routes.namespace({ namespace: key }) }>
55-
{ key }
56-
</a>
57-
</Card>
58-
))}
59-
</CardList>
60-
</div>
61-
}
38+
render() {
39+
const { namespaces } = this.props
40+
const { routes, activeNamespace } = this.state
41+
const cards = namespaces[activeNamespace]
42+
const navCard = this.renderNavCard(routes, activeNamespace)
43+
return (
44+
<div className={style.container}>
45+
<h1>React Cards</h1>
46+
{cards
47+
? <div className='react-cards-namespace-cards'>
48+
<CardList namespace={ activeNamespace }>{ [navCard, ...cards] }</CardList>
6249
</div>
63-
)
64-
}
65-
renderNavCard(routes, ns) {
66-
return (
67-
<Card key='navcard' noframe>
68-
<div className={style.navCrumbs}>
69-
<a href={ routes.index() }>home</a>
70-
&nbsp;/&nbsp;
71-
{ns}
50+
: <div className="react-cards-menu">
51+
<CardList>
52+
{map(namespaces, (namespace, key) => (
53+
<Card key={key} noframe>
54+
<a className={style.nav} href={ routes.namespace({ namespace: key }) }>
55+
{ key }
56+
</a>
57+
</Card>
58+
))}
59+
</CardList>
7260
</div>
73-
</Card>
74-
)
75-
}
61+
}
62+
</div>
63+
)
64+
}
65+
renderNavCard(routes, ns) {
66+
return (
67+
<Card key='navcard' noframe>
68+
<div className={style.navCrumbs}>
69+
<a href={ routes.index() }>home</a>
70+
&nbsp;/&nbsp;
71+
{ns}
72+
</div>
73+
</Card>
74+
)
75+
}
7676
}

src/StatefulCard.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default class StatefulCard extends Component {
2929
}
3030
undo() {
3131
if (this.state.history.length < 1) return
32-
const last = this.state.history[this.state.history.length-1]
32+
const last = this.state.history[this.state.history.length - 1]
3333
this.setState({
3434
model: last,
3535
history: this.state.history.slice(0, -1),
@@ -38,7 +38,7 @@ export default class StatefulCard extends Component {
3838
}
3939
redo() {
4040
if (this.state.future.length < 1) return
41-
const last = this.state.future[this.state.future.length-1]
41+
const last = this.state.future[this.state.future.length - 1]
4242
this.setState({
4343
model: last,
4444
future: this.state.future.slice(0, -1),
@@ -67,7 +67,7 @@ export default class StatefulCard extends Component {
6767
}
6868
renderInspect() {
6969
return (
70-
<div className={'react-cards-inspect '+style.inspectBox}>
70+
<div className={'react-cards-inspect ' + style.inspectBox}>
7171
<p style={{fontSize:'.7em',color:'#777'}}>model:</p>
7272
<pre>{JSON.stringify(this.getModel(), null, ' ')}</pre>
7373
</div>

src/TestCard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default class TestCard extends Component {
6868
try {
6969
testModule[name]()
7070
results.push([true, name])
71-
} catch(e) {
71+
} catch (e) {
7272
results.push([e, name])
7373
}
7474
})

src/components.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const MarkdownCard = (props) => (
3030

3131
export class Card extends Component {
3232
constructor(props) {
33-
super(props)
33+
super(props)
3434
}
3535

3636
componentDidMount() {
@@ -40,7 +40,7 @@ export class Card extends Component {
4040
}
4141
}
4242

43-
componentWillUnmount(){
43+
componentWillUnmount() {
4444
if (!this.props.noframe) {
4545
this.iframeNode.iFrameResizer.close()
4646
}
@@ -54,7 +54,7 @@ export class Card extends Component {
5454
<body><div id="content"></div></body>
5555
</html>`
5656
return (
57-
<div className={"reactcards-card "+style.card}>
57+
<div className={'reactcards-card ' + style.card}>
5858
{props.title ? <CardHeader>{props.title}</CardHeader> : null}
5959
{props.doc ? <Markdown className={style.markdownDoc}>{props.doc}</Markdown> : null}
6060
{props.noframe ?

src/namespaceStore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const namespaceStore = (initialState = {}) => ({
33
namespaces: initialState,
44
listeners: [],
55
get(namespace) {
6-
return namespace? this.namespaces[namespace] : this.namespaces
6+
return namespace ? this.namespaces[namespace] : this.namespaces
77
},
88
set(namespace, cards) {
99
this.namespaces[namespace] = cards

test/Container.test.js

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,53 @@ import { Card, CardList } from '../src/components'
88
const namespaces = { foo: [ <Card title="one"/>, <Card title="two" />], bar: [ <Card title="three" /> ] }
99

1010
describe('Testing <Container />', () => {
11-
beforeEach(() => {
12-
history = createHistory()
13-
})
14-
15-
it('should show menu when no cards', () => {
16-
const component = shallow(<Container namespaces={[]} history={history} />)
17-
expect(component.html()).to.contain('react-cards-menu')
18-
})
19-
20-
it('should show menu when no active namespace', () => {
21-
const component = shallow(<Container namespaces={namespaces} history={history} />)
22-
expect(component.html()).to.contain('react-cards-menu')
23-
})
24-
25-
it('should hide menu when active namespace', () => {
26-
history.push('/#/foo')
27-
const component = shallow(<Container namespaces={namespaces} history={history} />)
28-
expect(component.html()).to.not.contain('react-cards-menu')
29-
})
30-
31-
it('should display no cards if active namespace doesn\'t contain cards', () => {
32-
history.push('/#/foobar')
33-
const component = shallow(<Container namespaces={namespaces} history={history} />)
34-
expect(component.find('.react-cards-namespace-cards')).to.have.length(0)
35-
})
36-
37-
it('should display all cards for active namespace', () => {
38-
history.push('/#/foo')
39-
const component = mount(<Container namespaces={namespaces} history={history} />)
40-
expect(component.find('.react-cards-namespace-cards')).to.have.length(1)
11+
beforeEach(() => {
12+
history = createHistory()
13+
})
14+
15+
it('should show menu when no cards', () => {
16+
const component = shallow(<Container namespaces={[]} history={history} />)
17+
expect(component.html()).to.contain('react-cards-menu')
18+
})
19+
20+
it('should show menu when no active namespace', () => {
21+
const component = shallow(<Container namespaces={namespaces} history={history} />)
22+
expect(component.html()).to.contain('react-cards-menu')
23+
})
24+
25+
it('should hide menu when active namespace', () => {
26+
history.push('/#/foo')
27+
const component = shallow(<Container namespaces={namespaces} history={history} />)
28+
expect(component.html()).to.not.contain('react-cards-menu')
29+
})
30+
31+
it('should display no cards if active namespace doesn\'t contain cards', () => {
32+
history.push('/#/foobar')
33+
const component = shallow(<Container namespaces={namespaces} history={history} />)
34+
expect(component.find('.react-cards-namespace-cards')).to.have.length(0)
35+
})
36+
37+
it('should display all cards for active namespace', () => {
38+
history.push('/#/foo')
39+
const component = mount(<Container namespaces={namespaces} history={history} />)
40+
expect(component.find('.react-cards-namespace-cards')).to.have.length(1)
4141
// 1 nav header card + 2 foo cards
42-
expect(component.find('.react-cards-namespace-cards .reactcards-card')).to.have.length(3)
43-
})
44-
45-
it('should display change card when active namespace changes', () => {
46-
history.push('/')
47-
const component = mount(<Container namespaces={namespaces} history={history} />)
48-
expect(component.find('.react-cards-namespace-cards')).to.have.length(0)
49-
history.push('/#/foo')
50-
expect(component.find('.react-cards-namespace-cards')).to.have.length(1)
42+
expect(component.find('.react-cards-namespace-cards .reactcards-card')).to.have.length(3)
43+
})
44+
45+
it('should display change card when active namespace changes', () => {
46+
history.push('/')
47+
const component = mount(<Container namespaces={namespaces} history={history} />)
48+
expect(component.find('.react-cards-namespace-cards')).to.have.length(0)
49+
history.push('/#/foo')
50+
expect(component.find('.react-cards-namespace-cards')).to.have.length(1)
5151
// 1 nav header card + 2 foo cards
52-
expect(component.find('.react-cards-namespace-cards .reactcards-card')).to.have.length(3)
53-
history.push('/#/foobar')
54-
expect(component.find('.react-cards-namespace-cards')).to.have.length(0)
55-
history.push('/#/bar')
56-
expect(component.find('.react-cards-namespace-cards')).to.have.length(1)
52+
expect(component.find('.react-cards-namespace-cards .reactcards-card')).to.have.length(3)
53+
history.push('/#/foobar')
54+
expect(component.find('.react-cards-namespace-cards')).to.have.length(0)
55+
history.push('/#/bar')
56+
expect(component.find('.react-cards-namespace-cards')).to.have.length(1)
5757
// 1 nav header card + 1 bar card
58-
expect(component.find('.react-cards-namespace-cards .reactcards-card')).to.have.length(2)
59-
})
58+
expect(component.find('.react-cards-namespace-cards .reactcards-card')).to.have.length(2)
59+
})
6060
})

0 commit comments

Comments
 (0)