Skip to content

Commit 70ddcf3

Browse files
committed
add StandardJS and remove errors
1 parent 723e617 commit 70ddcf3

File tree

22 files changed

+231
-245
lines changed

22 files changed

+231
-245
lines changed

app/actions/AppActions.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import alt from '../alt';
1+
import alt from '../alt'
22

33
class AppActions {
4-
constructor() {
5-
this.generateActions('getItems');
4+
constructor () {
5+
this.generateActions('getItems')
66
}
77
}
88

9-
export default alt.createActions(AppActions);
9+
export default alt.createActions(AppActions)

app/alt.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
import Alt from 'alt';
2-
export default new Alt();
1+
import Alt from 'alt'
2+
export default new Alt()

app/app.jsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import './favicon.ico';
2-
import './index.html';
3-
import 'babel-core/polyfill';
4-
import 'normalize.css/normalize.css';
5-
import './scss/app.scss';
1+
import './favicon.ico'
2+
import './index.html'
3+
import 'babel-core/polyfill'
4+
import 'normalize.css/normalize.css'
5+
import './scss/app.scss'
66

7-
import React from 'react';
8-
import Router from 'react-router';
7+
import React from 'react'
8+
import Router from 'react-router'
99

10-
import routes from './routes';
10+
import routes from './routes'
1111

1212
Router.run(routes, function (Handler) {
13-
React.render(React.createElement(Handler), document.body);
14-
});
13+
React.render(React.createElement(Handler), document.body)
14+
})

app/app.tests.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'babel-core/polyfill';
1+
import 'babel-core/polyfill'
22

3-
let context = require.context('.', true, /-test\.jsx?$/);
4-
context.keys().forEach(context);
3+
let context = require.context('.', true, /-test\.jsx?$/)
4+
context.keys().forEach(context)

app/components/App/App.jsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
import styles from './_App.scss';
1+
import styles from './_App.scss'
22

3-
import React from 'react';
4-
import { RouteHandler } from 'react-router';
5-
import AppActions from '../../actions/AppActions';
6-
import ItemsStore from '../../stores/ItemsStore';
7-
import Footer from '../Footer/Footer';
3+
import React from 'react'
4+
import { RouteHandler } from 'react-router'
5+
import AppActions from '../../actions/AppActions'
6+
import ItemsStore from '../../stores/ItemsStore'
7+
import Footer from '../Footer/Footer'
88

99
export default class App extends React.Component {
10-
constructor() {
11-
super();
12-
this.state = {items: []};
13-
AppActions.getItems();
10+
constructor () {
11+
super()
12+
this.state = {items: []}
13+
AppActions.getItems()
1414
ItemsStore.listen((data) => {
15-
this.setState({items: data.items});
16-
});
15+
this.setState({items: data.items})
16+
})
1717
}
1818

19-
render() {
19+
render () {
2020
return (
2121
<div className={styles.app}>
2222
<RouteHandler items={this.state.items} />
2323
<Footer />
2424
</div>
25-
);
25+
)
2626
}
2727
}

app/components/Body/Body.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import styles from './_Body.scss';
1+
import styles from './_Body.scss'
22

3-
import React from 'react';
4-
import Menu from '../Menu/Menu';
3+
import React from 'react'
4+
import Menu from '../Menu/Menu'
55

6-
let { PropTypes } = React;
6+
let { PropTypes } = React
77

88
export default class Body extends React.Component {
99

1010
static defaultProps = {
1111
items: []
12-
};
12+
}
1313

1414
static propTypes = {
1515
items: PropTypes.array.isRequired
16-
};
16+
}
1717

18-
render() {
18+
render () {
1919
return (
2020
<div className={styles.body}>
2121
<h1 className={styles.header}>React Seed</h1>
22-
<p>This is an example seed app, powered by React, ES6, Al &amp; webpack.</p>
22+
<p>This is an example seed app, powered by React, ES6, Al &amp webpack.</p>
2323
<p>Here is some example data:</p>
2424
<Menu items={this.props.items} />
2525
<h2>Getting started</h2>
@@ -30,6 +30,6 @@ export default class Body extends React.Component {
3030
<li>Change the data rendered above. Look in: <pre>./app/components/App/App.jsx</pre> Understand how data flows from the actions into the stores and then into the Body component.</li>
3131
</ol>
3232
</div>
33-
);
33+
)
3434
}
3535
}

app/components/Footer/Footer.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import styles from './_Footer.scss';
2-
import React from 'react';
1+
import styles from './_Footer.scss'
2+
import React from 'react'
33

44
export default class Footer extends React.Component {
5-
render() {
6-
var year = (new Date()).getFullYear();
5+
render () {
6+
var year = (new Date()).getFullYear()
77
return (
88
<footer className={styles.footer}>
99
&copy; Your Company&nbsp;{year}
1010
</footer>
11-
);
11+
)
1212
}
1313
}
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import React from 'react/addons';
2-
import Footer from '../Footer.jsx';
3-
import { expect } from 'chai';
1+
/* global describe, it */
42

5-
let { TestUtils } = React.addons;
3+
import React from 'react/addons'
4+
import Footer from '../Footer.jsx'
5+
import { expect } from 'chai'
6+
7+
let { TestUtils } = React.addons
68

79
describe('Footer', () => {
810
it('Should have the correct footer element', () => {
911
let footer = TestUtils.renderIntoDocument(
1012
<Footer />
11-
);
12-
let footerElem = React.findDOMNode(footer);
13-
expect(footerElem.tagName.toLowerCase()).to.equal('footer');
14-
});
15-
});
13+
)
14+
let footerElem = React.findDOMNode(footer)
15+
expect(footerElem.tagName.toLowerCase()).to.equal('footer')
16+
})
17+
})

app/components/Menu/Menu.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
import styles from './_Menu.scss';
2-
import React from 'react';
3-
import MenuItem from './MenuItem';
1+
import styles from './_Menu.scss'
2+
import React from 'react'
3+
import MenuItem from './MenuItem'
44

5-
let { Component, PropTypes } = React;
5+
let { Component, PropTypes } = React
66

77
export default class Menu extends Component {
88

99
static defaultProps = {
1010
items: []
11-
};
11+
}
1212

1313
static propTypes = {
1414
items: PropTypes.array.isRequired
15-
};
15+
}
1616

17-
render() {
17+
render () {
1818
return (
1919
<ul className={styles.menu}>
2020
{this.props.items.map((item, key) => {
21-
return (<MenuItem item={item} key={key} />);
21+
return (<MenuItem item={item} key={key} />)
2222
}, this)}
2323
</ul>
24-
);
24+
)
2525
}
2626
}

app/components/Menu/MenuItem.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import React from 'react';
1+
import React from 'react'
22

3-
let { Component, PropTypes } = React;
3+
let { Component, PropTypes } = React
44

55
export default class MenuItem extends Component {
66

77
static propTypes = {
88
item: PropTypes.object.isRequired
9-
};
9+
}
1010

1111
onItemClick = (e) => {
12-
e.preventDefault();
13-
window.alert('You clicked ' + this.props.item.label);
12+
e.preventDefault()
13+
window.alert('You clicked ' + this.props.item.label)
1414
}
1515

16-
render() {
16+
render () {
1717
return (
1818
<li key={'menu-item-' + this.props.item.id}>
19-
<a href="#" onClick={this.onItemClick}>
19+
<a href='#' onClick={this.onItemClick}>
2020
{this.props.item.label}
2121
</a>
2222
</li>
23-
);
23+
)
2424
}
2525
}

0 commit comments

Comments
 (0)