Skip to content

Commit 9ebb576

Browse files
committed
Update to latest eslint rules
1 parent b405861 commit 9ebb576

23 files changed

+883
-898
lines changed

.eslintrc

Lines changed: 171 additions & 218 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"PATENTS"
2626
],
2727
"options": {
28-
"mocha": "--require scripts/mocha-bootload src/**/__tests__/**/*.js"
28+
"mocha": "src/**/__tests__/**/*.js"
2929
},
3030
"scripts": {
3131
"prepublish": "npm test && npm run build",
@@ -47,7 +47,7 @@
4747
"devDependencies": {
4848
"babel-cli": "6.18.0",
4949
"babel-core": "6.18.2",
50-
"babel-eslint": "6.0.4",
50+
"babel-eslint": "7.1.0",
5151
"babel-plugin-check-es2015-constants": "6.8.0",
5252
"babel-plugin-syntax-async-functions": "6.13.0",
5353
"babel-plugin-transform-class-properties": "6.18.0",
@@ -70,14 +70,14 @@
7070
"babel-plugin-transform-object-rest-spread": "6.16.0",
7171
"babel-plugin-transform-regenerator": "6.16.1",
7272
"chai": "3.5.0",
73-
"chai-as-promised": "5.3.0",
74-
"coveralls": "2.11.9",
75-
"eslint": "2.10.2",
76-
"eslint-plugin-flowtype": "2.11.4",
73+
"coveralls": "2.11.15",
74+
"eslint": "3.10.2",
75+
"eslint-plugin-babel": "3.3.0",
76+
"eslint-plugin-flowtype": "2.25.0",
7777
"flow-bin": "0.25.0",
7878
"graphql": "0.7.0",
7979
"isparta": "4.0.0",
80-
"mocha": "2.5.3",
81-
"sane": "1.3.4"
80+
"mocha": "3.1.2",
81+
"sane": "1.4.1"
8282
}
8383
}

scripts/mocha-bootload.js

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

src/__tests__/starWarsConnectionTests.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { graphql } from 'graphql';
1717

1818
describe('Star Wars connections', () => {
1919
it('fetches the first ship of the rebels', async () => {
20-
var query = `
20+
const query = `
2121
query RebelsShipsQuery {
2222
rebels {
2323
name,
@@ -31,7 +31,7 @@ describe('Star Wars connections', () => {
3131
}
3232
}
3333
`;
34-
var expected = {
34+
const expected = {
3535
rebels: {
3636
name: 'Alliance to Restore the Republic',
3737
ships: {
@@ -45,12 +45,12 @@ describe('Star Wars connections', () => {
4545
}
4646
}
4747
};
48-
var result = await graphql(StarWarsSchema, query);
48+
const result = await graphql(StarWarsSchema, query);
4949
expect(result).to.deep.equal({ data: expected });
5050
});
5151

5252
it('fetches the first two ships of the rebels with a cursor', async () => {
53-
var query = `
53+
const query = `
5454
query MoreRebelShipsQuery {
5555
rebels {
5656
name,
@@ -65,7 +65,7 @@ describe('Star Wars connections', () => {
6565
}
6666
}
6767
`;
68-
var expected = {
68+
const expected = {
6969
rebels: {
7070
name: 'Alliance to Restore the Republic',
7171
ships: {
@@ -86,12 +86,12 @@ describe('Star Wars connections', () => {
8686
}
8787
}
8888
};
89-
var result = await graphql(StarWarsSchema, query);
89+
const result = await graphql(StarWarsSchema, query);
9090
expect(result).to.deep.equal({ data: expected });
9191
});
9292

9393
it('fetches the next three ships of the rebels with a cursor', async () => {
94-
var query = `
94+
const query = `
9595
query EndOfRebelShipsQuery {
9696
rebels {
9797
name,
@@ -106,7 +106,7 @@ describe('Star Wars connections', () => {
106106
}
107107
}
108108
`;
109-
var expected = {
109+
const expected = {
110110
rebels: {
111111
name: 'Alliance to Restore the Republic',
112112
ships: {
@@ -133,12 +133,12 @@ describe('Star Wars connections', () => {
133133
}
134134
}
135135
};
136-
var result = await graphql(StarWarsSchema, query);
136+
const result = await graphql(StarWarsSchema, query);
137137
expect(result).to.deep.equal({ data: expected });
138138
});
139139

140140
it('fetches no ships of the rebels at the end of connection', async () => {
141-
var query = `
141+
const query = `
142142
query RebelsQuery {
143143
rebels {
144144
name,
@@ -153,20 +153,20 @@ describe('Star Wars connections', () => {
153153
}
154154
}
155155
`;
156-
var expected = {
156+
const expected = {
157157
rebels: {
158158
name: 'Alliance to Restore the Republic',
159159
ships: {
160160
edges: []
161161
}
162162
}
163163
};
164-
var result = await graphql(StarWarsSchema, query);
164+
const result = await graphql(StarWarsSchema, query);
165165
expect(result).to.deep.equal({ data: expected });
166166
});
167167

168168
it('identifies the end of the list', async () => {
169-
var query = `
169+
const query = `
170170
query EndOfRebelShipsQuery {
171171
rebels {
172172
name,
@@ -193,7 +193,7 @@ describe('Star Wars connections', () => {
193193
}
194194
}
195195
`;
196-
var expected = {
196+
const expected = {
197197
rebels: {
198198
name: 'Alliance to Restore the Republic',
199199
originalShips: {
@@ -237,7 +237,7 @@ describe('Star Wars connections', () => {
237237
}
238238
}
239239
};
240-
var result = await graphql(StarWarsSchema, query);
240+
const result = await graphql(StarWarsSchema, query);
241241
expect(result).to.deep.equal({ data: expected });
242242
});
243243
});

src/__tests__/starWarsData.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,81 +13,81 @@
1313
* JSON objects in a more complex demo.
1414
*/
1515

16-
var xwing = {
16+
const xwing = {
1717
id: '1',
1818
name: 'X-Wing',
1919
};
2020

21-
var ywing = {
21+
const ywing = {
2222
id: '2',
2323
name: 'Y-Wing',
2424
};
2525

26-
var awing = {
26+
const awing = {
2727
id: '3',
2828
name: 'A-Wing',
2929
};
3030

3131
// Yeah, technically it's Corellian. But it flew in the service of the rebels,
3232
// so for the purposes of this demo it's a rebel ship.
33-
var falcon = {
33+
const falcon = {
3434
id: '4',
3535
name: 'Millenium Falcon',
3636
};
3737

38-
var homeOne = {
38+
const homeOne = {
3939
id: '5',
4040
name: 'Home One',
4141
};
4242

43-
var tieFighter = {
43+
const tieFighter = {
4444
id: '6',
4545
name: 'TIE Fighter',
4646
};
4747

48-
var tieInterceptor = {
48+
const tieInterceptor = {
4949
id: '7',
5050
name: 'TIE Interceptor',
5151
};
5252

53-
var executor = {
53+
const executor = {
5454
id: '8',
5555
name: 'Executor',
5656
};
5757

58-
var rebels = {
58+
const rebels = {
5959
id: '1',
6060
name: 'Alliance to Restore the Republic',
61-
ships: ['1', '2', '3', '4', '5']
61+
ships: [ '1', '2', '3', '4', '5' ]
6262
};
6363

64-
var empire = {
64+
const empire = {
6565
id: '2',
6666
name: 'Galactic Empire',
67-
ships: ['6', '7', '8']
67+
ships: [ '6', '7', '8' ]
6868
};
6969

70-
var data = {
70+
const data = {
7171
Faction: {
72-
1: rebels,
73-
2: empire
72+
'1': rebels,
73+
'2': empire
7474
},
7575
Ship: {
76-
1: xwing,
77-
2: ywing,
78-
3: awing,
79-
4: falcon,
80-
5: homeOne,
81-
6: tieFighter,
82-
7: tieInterceptor,
83-
8: executor
76+
'1': xwing,
77+
'2': ywing,
78+
'3': awing,
79+
'4': falcon,
80+
'5': homeOne,
81+
'6': tieFighter,
82+
'7': tieInterceptor,
83+
'8': executor
8484
}
8585
};
8686

87-
var nextShip = 9;
87+
let nextShip = 9;
8888
export function createShip(shipName, factionId) {
89-
var newShip = {
90-
id: '' + (nextShip++),
89+
const newShip = {
90+
id: String(nextShip++),
9191
name: shipName
9292
};
9393
data.Ship[newShip.id] = newShip;

src/__tests__/starWarsMutationTests.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { graphql } from 'graphql';
1717

1818
describe('Star Wars mutations', () => {
1919
it('mutates the data set', async () => {
20-
var mutation = `
20+
const mutation = `
2121
mutation AddBWingQuery($input: IntroduceShipInput!) {
2222
introduceShip(input: $input) {
2323
ship {
@@ -31,14 +31,14 @@ describe('Star Wars mutations', () => {
3131
}
3232
}
3333
`;
34-
var params = {
34+
const params = {
3535
input: {
3636
shipName: 'B-Wing',
3737
factionId: '1',
3838
clientMutationId: 'abcde',
3939
}
4040
};
41-
var expected = {
41+
const expected = {
4242
introduceShip: {
4343
ship: {
4444
id: 'U2hpcDo5',
@@ -50,7 +50,7 @@ describe('Star Wars mutations', () => {
5050
clientMutationId: 'abcde',
5151
}
5252
};
53-
var result = await graphql(StarWarsSchema, mutation, null, null, params);
53+
const result = await graphql(StarWarsSchema, mutation, null, null, params);
5454
expect(result).to.deep.equal({ data: expected });
5555
});
5656
});

0 commit comments

Comments
 (0)