Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bc896c5

Browse files
committed
Impose airbnb style
1 parent 4e11d3d commit bc896c5

16 files changed

+251
-251
lines changed

‎.eslintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"extends": ["eslint-config-airbnb"],
23
"env": {
34
"browser": true,
45
"node": true
@@ -12,15 +13,19 @@
1213
"babel"
1314
],
1415
"rules": {
16+
"comma-dangle": 0,
1517
"comma-spacing": 1,
1618
"key-spacing": 0,
19+
"no-eq-null": 0,
20+
"no-param-reassign": 0,
1721
"no-underscore-dangle": 0,
1822
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
1923
"no-var": 2,
2024
"babel/object-shorthand": 2,
2125
"quotes": [1, "single", "avoid-escape"],
2226
"react/display-name": 0,
2327
"react/jsx-no-undef": 2,
28+
"react/jsx-quotes": 0,
2429
"react/jsx-uses-react": 2,
2530
"react/no-did-mount-set-state": 2,
2631
"react/no-did-update-set-state": 2,

‎package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"colors": "^1.1.2",
4848
"css-loader": "^0.15.3",
4949
"eslint": "^1.0.0",
50+
"eslint-config-airbnb": "0.0.7",
5051
"eslint-plugin-babel": "^1.0.0",
5152
"eslint-plugin-mocha": "^0.4.0",
5253
"eslint-plugin-react": "^3.1.0",

‎scripts/bower-prepare.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* globals cat, config, cp, mkdir, rm, test */
2-
/* eslint curly: 0 */
2+
/* eslint curly: 0, no-console: 0 */
33
import 'colors';
44
import 'shelljs/global';
55
import path from 'path';

‎src/LinkMixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default {
3535
* Sets "onClick" to "handleRouteTo".
3636
*/
3737
getLinkProps() {
38-
let {
38+
const {
3939
to,
4040
params,
4141
query,

‎src/MenuItemLink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const MenuItemLink = React.createClass({
99
],
1010

1111
render() {
12-
let props = this.getLinkProps();
12+
const props = this.getLinkProps();
1313
delete props.onSelect; // this is done on the copy of this.props
1414

1515
return (

‎tests/.eslintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
"mocha"
1212
],
1313
"rules": {
14+
"func-names": 0,
1415
"no-alert": 0,
1516
"no-script-url": 0,
1617
"no-unused-expressions": 0,
1718
"react/no-multi-comp": 0,
1819
"react/prop-types": 0,
20+
"react/sort-comp": 0,
1921
"mocha/no-exclusive-tests": 2
2022
}
2123
}

‎tests/ButtonLink.spec.js

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,38 @@ import ButtonLink from '../src/ButtonLink';
55
import Router, { Route, RouteHandler } from 'react-router';
66
import { Foo, Bar } from './TestHandlers';
77
import TestLocation from 'react-router/lib/locations/TestLocation';
8-
let { click } = React.addons.TestUtils.Simulate;
8+
const { click } = React.addons.TestUtils.Simulate;
99

10-
describe('A ButtonLink', function() {
11-
describe('with params and a query', function() {
12-
it('knows how to make its href', function() {
13-
let ButtonLinkHandler = React.createClass({
10+
describe('A ButtonLink', function() {
11+
describe('with params and a query', function() {
12+
it('knows how to make its href', function() {
13+
const ButtonLinkHandler = React.createClass({
1414
render() {
1515
return <ButtonLink to="foo" params={{bar: 'baz'}} query={{qux: 'quux'}}>ButtonLink</ButtonLink>;
1616
}
1717
});
1818

19-
let routes = [
19+
const routes = [
2020
<Route name="foo" path="foo/:bar" handler={Foo} />,
2121
<Route name="link" handler={ButtonLinkHandler} />
2222
];
2323

24-
let div = document.createElement('div');
25-
let testLocation = new TestLocation();
24+
const div = document.createElement('div');
25+
const testLocation = new TestLocation();
2626
testLocation.history = ['/link'];
2727

28-
Router.run(routes, testLocation, function(Handler) {
29-
React.render(<Handler/>, div, function() {
30-
let a = div.querySelector('a');
28+
Router.run(routes, testLocation, function(Handler) {
29+
React.render(<Handler/>, div, function() {
30+
const a = div.querySelector('a');
3131
expect(a.getAttribute('href')).to.equal('/foo/baz?qux=quux');
3232
});
3333
});
3434
});
3535
});
3636

37-
describe('when its route is active', function() {
38-
it('has an active class name', function(done) {
39-
let ButtonLinkHandler = React.createClass({
37+
describe('when its route is active', function() {
38+
it('has an active class name', function(done) {
39+
const ButtonLinkHandler = React.createClass({
4040
render() {
4141
return (
4242
<div>
@@ -52,25 +52,25 @@ describe('A ButtonLink', function () {
5252
}
5353
});
5454

55-
let routes = (
55+
const routes = (
5656
<Route path="/" handler={ButtonLinkHandler}>
5757
<Route name="foo" handler={Foo} />
5858
<Route name="bar" handler={Bar} />
5959
</Route>
6060
);
6161

62-
let div = document.createElement('div');
63-
let testLocation = new TestLocation();
62+
const div = document.createElement('div');
63+
const testLocation = new TestLocation();
6464
testLocation.history = ['/foo'];
65-
let steps = [];
65+
const steps = [];
6666

67-
function assertActive() {
68-
let a = div.querySelector('a');
67+
function assertActive() {
68+
const a = div.querySelector('a');
6969
expect(a.className.split(' ').sort().join(' ')).to.equal('active btn btn-primary btn-sm dontKillMe');
7070
}
7171

72-
function assertInactive() {
73-
let a = div.querySelector('a');
72+
function assertInactive() {
73+
const a = div.querySelector('a');
7474
expect(a.className.split(' ').sort().join(' ')).to.equal('btn btn-primary btn-sm dontKillMe');
7575
}
7676

@@ -89,17 +89,17 @@ describe('A ButtonLink', function () {
8989
done();
9090
});
9191

92-
Router.run(routes, testLocation, function(Handler) {
92+
Router.run(routes, testLocation, function(Handler) {
9393
React.render(<Handler/>, div, () => {
9494
steps.shift()();
9595
});
9696
});
9797
});
9898
});
9999

100-
describe('when clicked', function() {
101-
it('calls a user defined click handler', function(done) {
102-
let ButtonLinkHandler = React.createClass({
100+
describe('when clicked', function() {
101+
it('calls a user defined click handler', function(done) {
102+
const ButtonLinkHandler = React.createClass({
103103
handleClick(event) {
104104
assert.ok(true);
105105
done();
@@ -110,27 +110,27 @@ describe('A ButtonLink', function () {
110110
}
111111
});
112112

113-
let routes = [
113+
const routes = [
114114
<Route name="foo" handler={Foo} />,
115115
<Route name="link" handler={ButtonLinkHandler} />
116116
];
117-
let div = document.createElement('div');
118-
let testLocation = new TestLocation();
117+
const div = document.createElement('div');
118+
const testLocation = new TestLocation();
119119
testLocation.history = ['/link'];
120120

121-
Router.run(routes, testLocation, function(Handler) {
122-
React.render(<Handler/>, div, function() {
121+
Router.run(routes, testLocation, function(Handler) {
122+
React.render(<Handler/>, div, function() {
123123
click(div.querySelector('a'));
124124
});
125125
});
126126
});
127127

128-
it('transitions to the correct route', function(done) {
129-
let div = document.createElement('div');
130-
let testLocation = new TestLocation();
128+
it('transitions to the correct route', function(done) {
129+
const div = document.createElement('div');
130+
const testLocation = new TestLocation();
131131
testLocation.history = ['/link'];
132132

133-
let ButtonLinkHandler = React.createClass({
133+
const ButtonLinkHandler = React.createClass({
134134
handleClick() {
135135
// just here to make sure click handlers don't prevent it from happening
136136
},
@@ -140,29 +140,27 @@ describe('A ButtonLink', function () {
140140
}
141141
});
142142

143-
let routes = [
143+
const routes = [
144144
<Route name="foo" handler={Foo} />,
145145
<Route name="link" handler={ButtonLinkHandler} />
146146
];
147147

148-
let steps = [];
148+
const steps = [];
149149

150-
steps.push(function() {
150+
steps.push(function() {
151151
click(div.querySelector('a'), {button: 0});
152152
});
153153

154-
steps.push(function() {
154+
steps.push(function() {
155155
expect(div.innerHTML).to.match(/Foo/);
156156
done();
157157
});
158158

159-
Router.run(routes, testLocation, function(Handler) {
160-
React.render(<Handler/>, div, function() {
159+
Router.run(routes, testLocation, function(Handler) {
160+
React.render(<Handler/>, div, function() {
161161
steps.shift()();
162162
});
163163
});
164164
});
165-
166165
});
167-
168166
});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /