Skip to content
This repository was archived by the owner on Apr 9, 2019. It is now read-only.

Commit 4e08cb5

Browse files
committed
Lint
1 parent 5f29515 commit 4e08cb5

File tree

15 files changed

+1002
-971
lines changed

15 files changed

+1002
-971
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ before_install:
88
install:
99
- npm install
1010
script:
11+
- npm run lint
1112
- npm test

examples/src/example.jsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,30 @@
1-
import React from 'react';
2-
import ReactDOM from 'react-dom';
1+
import React from 'react'
2+
import ReactDOM from 'react-dom'
33

4-
import NavigationController from '../../src/navigation-controller';
5-
import View from './view';
4+
import NavigationController from '../../src/navigation-controller'
5+
import View from './view'
66

77
class App extends React.Component {
8-
constructor(props) {
9-
super(props);
10-
}
11-
render() {
8+
render () {
129
return (
1310
<main>
1411
<h2>Single View</h2>
1512
<p>Start with a single view on the stack</p>
1613
<NavigationController
1714
views={[<View />]}
18-
preserveState={true}
15+
preserveState
1916
transitionTension={10}
2017
transitionFriction={6} />
2118
<h2>Multiple Views</h2>
2219
<p>Start with multiple views on the stack</p>
2320
<NavigationController
2421
views={[<View />, <View index={2} />, <View index={3} />]}
25-
preserveState={true}
22+
preserveState
2623
transitionTension={10}
2724
transitionFriction={6} />
2825
</main>
29-
);
26+
)
3027
}
3128
}
3229

33-
ReactDOM.render(<App />, document.getElementById('app'));
30+
ReactDOM.render(<App />, document.getElementById('app'))

examples/src/view.jsx

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
1-
import React from 'react';
2-
import NavigationController from '../../src/navigation-controller';
1+
import React from 'react'
2+
import NavigationController from '../../src/navigation-controller'
33

44
const {
55
Transition
6-
} = NavigationController;
6+
} = NavigationController
77

88
const colors = [
9-
'#0074D9', '#7FDBFF', '#39CCCC', '#2ECC40', '#FFDC00', '#FF851B', '#FF4136',
9+
'#0074D9', '#7FDBFF', '#39CCCC', '#2ECC40', '#FFDC00', '#FF851B', '#FF4136',
1010
'#F012BE', '#B10DC9'
11-
];
11+
]
1212

13-
function getColor() {
14-
const color = colors.shift();
15-
colors.push(color);
16-
return color;
13+
function getColor () {
14+
const color = colors.shift()
15+
colors.push(color)
16+
return color
1717
}
1818

1919
class View extends React.Component {
20-
constructor(props) {
21-
super(props);
22-
const now = new Date();
20+
constructor (props) {
21+
super(props)
22+
const now = new Date()
2323
this.state = {
2424
counter: 0,
2525
color: getColor(),
2626
time: `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}`
27-
};
27+
}
2828
}
29-
incrementCounter() {
29+
incrementCounter () {
3030
this.setState({
3131
counter: this.state.counter + 1
32-
});
32+
})
3333
}
34-
onNext() {
35-
const view = <View index={this.props.index+1} />;
36-
this.props.navigationController.pushView(view, {});
34+
onNext () {
35+
const view = <View index={this.props.index + 1} />
36+
this.props.navigationController.pushView(view, {})
3737
}
38-
onBack() {
38+
onBack () {
3939
this.props.navigationController.popView({
4040
transition: this.props.modal ? Transition.type.REVEAL_DOWN : Transition.type.PUSH_RIGHT
41-
});
41+
})
4242
}
43-
onModal() {
44-
const view = <View index={this.props.index+1} modal={true} />;
43+
onModal () {
44+
const view = <View index={this.props.index + 1} modal />
4545
this.props.navigationController.pushView(view, {
4646
transition: Transition.type.COVER_UP
47-
});
47+
})
4848
}
49-
onPopToRoot() {
49+
onPopToRoot () {
5050
this.props.navigationController.popToRootView({
5151
transition: this.props.modal ? Transition.type.REVEAL_DOWN : Transition.type.PUSH_RIGHT
52-
});
52+
})
5353
}
54-
render() {
54+
render () {
5555
return (
5656
<div
57-
className="ReactNavigationControllerViewContent"
58-
style={{background:this.state.color}}>
57+
className='ReactNavigationControllerViewContent'
58+
style={{ background: this.state.color }}>
5959
<header>
6060
{this.renderBackButton()}
6161
{this.renderNextButton()}
@@ -71,28 +71,28 @@ class View extends React.Component {
7171
{this.renderPopToRootButton()}
7272
</section>
7373
</div>
74-
);
74+
)
7575
}
76-
renderBackButton() {
77-
const text = this.props.modal ? 'Close' : 'Back';
76+
renderBackButton () {
77+
const text = this.props.modal ? 'Close' : 'Back'
7878
return this.props.index === 1
7979
? <div />
80-
: <button onClick={this.onBack.bind(this)}>{text}</button>;
80+
: <button onClick={this.onBack.bind(this)}>{text}</button>
8181
}
82-
renderNextButton() {
82+
renderNextButton () {
8383
return this.props.modal === true
8484
? <div />
85-
: <button onClick={this.onNext.bind(this)}>Next</button>;
85+
: <button onClick={this.onNext.bind(this)}>Next</button>
8686
}
87-
renderPopToRootButton() {
87+
renderPopToRootButton () {
8888
return this.props.index === 1
8989
? <div />
90-
: <button onClick={this.onPopToRoot.bind(this)}>Pop To Root</button>;
90+
: <button onClick={this.onPopToRoot.bind(this)}>Pop To Root</button>
9191
}
9292
}
9393

94-
View.defaultProps ={
94+
View.defaultProps = {
9595
index: 1
96-
};
96+
}
9797

98-
export default View;
98+
export default View

karma.conf.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Karma configuration
22
// Generated on Sat Mar 28 2015 02:55:40 GMT-0400 (EDT)
33

4-
module.exports = function(config) {
4+
module.exports = function (config) {
55
var c = {
66

77
// base path that will be used to resolve all patterns (eg. files, exclude)
@@ -83,11 +83,11 @@ module.exports = function(config) {
8383
noInfo: true
8484
}
8585

86-
};
86+
}
8787

8888
if (process.env.TRAVIS) {
89-
c.browsers = ['ChromeTravis'];
89+
c.browsers = ['ChromeTravis']
9090
}
9191

92-
config.set(c);
93-
};
92+
config.set(c)
93+
}

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"test": "./node_modules/karma/bin/karma start",
1414
"dist": "babel src --out-dir dist",
1515
"dist/example": "webpack --dist",
16-
"prepublish": "npm run dist"
16+
"prepublish": "npm run dist",
17+
"lint": "standard"
1718
},
1819
"repository": {
1920
"type": "git",
@@ -43,7 +44,14 @@
4344
"react-addons-test-utils": "^0.14.6",
4445
"react-dom": "^0.14.6",
4546
"sinon": "^1.17.2",
47+
"standard": "^8.0.0-beta.5",
4648
"webpack": "^1.12.11",
4749
"webpack-dev-server": "^1.14.1"
50+
},
51+
"standard": {
52+
"ignore": [
53+
"node_modules/**/*",
54+
"examples/assets/**/*"
55+
]
4856
}
4957
}

0 commit comments

Comments
 (0)