Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1fe8b3e

Browse files
committed
Update to latest version of eslint with new rules
1 parent bc96406 commit 1fe8b3e

File tree

10 files changed

+84
-82
lines changed

10 files changed

+84
-82
lines changed

.eslintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@
185185
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
186186
"no-use-before-define": 0,
187187
"no-useless-call": 2,
188+
"no-useless-escape": 2,
189+
"no-useless-return": 2,
188190
"no-var": 2,
189191
"no-void": 2,
190192
"no-warning-comments": 0,

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"test": "npm run lint && npm run check && npm run testonly",
2525
"testonly": "babel-node ./node_modules/.bin/_mocha $npm_package_options_mocha",
2626
"t": "babel-node ./node_modules/.bin/_mocha --require ./resources/mocha-bootload",
27-
"lint": "eslint src",
27+
"lint": "eslint src || (printf '\\033[33mTry: \\033[7m npm run lint -- --fix \\033[0m\\n' && exit 1)",
2828
"check": "flow check",
2929
"check-cover": "for file in {src/*.js,src/**/*.js}; do echo $file; flow coverage $file; done",
3030
"build": "babel src --ignore __tests__ --out-dir dist/ && cp package.json dist/",
@@ -65,7 +65,7 @@
6565
"chai-json-equal": "0.0.1",
6666
"chai-subset": "1.3.0",
6767
"coveralls": "2.11.14",
68-
"eslint": "3.8.1",
68+
"eslint": "3.9.1",
6969
"eslint-plugin-babel": "3.3.0",
7070
"eslint-plugin-flowtype": "2.25.0",
7171
"flow-bin": "0.32.0",

src/execution/__tests__/variables-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ describe('Execute: Handles inputs', () => {
349349
message:
350350
'Variable "$input" got invalid value ' +
351351
'{"a":"foo","b":"bar","c":"baz","extra":"dog"}.' +
352-
'\nIn field \"extra\": Unknown field.'
352+
'\nIn field "extra": Unknown field.'
353353
});
354354
});
355355

src/language/__tests__/lexer-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ describe('Lexer', () => {
160160
kind: TokenKind.STRING,
161161
start: 0,
162162
end: 15,
163-
value: 'slashes \\ \/'
163+
value: 'slashes \\ /'
164164
});
165165

166166
expect(

src/language/__tests__/parser-test.js

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -205,59 +205,59 @@ fragment ${fragmentName} on Type {
205205
{ kind: Kind.DOCUMENT,
206206
loc: { start: 0, end: 41 },
207207
definitions:
208-
[ { kind: Kind.OPERATION_DEFINITION,
209-
loc: { start: 0, end: 40 },
210-
operation: 'query',
211-
name: null,
212-
variableDefinitions: null,
213-
directives: [],
214-
selectionSet:
208+
[ { kind: Kind.OPERATION_DEFINITION,
209+
loc: { start: 0, end: 40 },
210+
operation: 'query',
211+
name: null,
212+
variableDefinitions: null,
213+
directives: [],
214+
selectionSet:
215+
{ kind: Kind.SELECTION_SET,
216+
loc: { start: 0, end: 40 },
217+
selections:
218+
[ { kind: Kind.FIELD,
219+
loc: { start: 4, end: 38 },
220+
alias: null,
221+
name:
222+
{ kind: Kind.NAME,
223+
loc: { start: 4, end: 8 },
224+
value: 'node' },
225+
arguments:
226+
[ { kind: Kind.ARGUMENT,
227+
name:
228+
{ kind: Kind.NAME,
229+
loc: { start: 9, end: 11 },
230+
value: 'id' },
231+
value:
232+
{ kind: Kind.INT,
233+
loc: { start: 13, end: 14 },
234+
value: '4' },
235+
loc: { start: 9, end: 14 } } ],
236+
directives: [],
237+
selectionSet:
215238
{ kind: Kind.SELECTION_SET,
216-
loc: { start: 0, end: 40 },
239+
loc: { start: 16, end: 38 },
217240
selections:
218-
[ { kind: Kind.FIELD,
219-
loc: { start: 4, end: 38 },
220-
alias: null,
221-
name:
222-
{ kind: Kind.NAME,
223-
loc: { start: 4, end: 8 },
224-
value: 'node' },
225-
arguments:
226-
[ { kind: Kind.ARGUMENT,
227-
name:
228-
{ kind: Kind.NAME,
229-
loc: { start: 9, end: 11 },
230-
value: 'id' },
231-
value:
232-
{ kind: Kind.INT,
233-
loc: { start: 13, end: 14 },
234-
value: '4' },
235-
loc: { start: 9, end: 14 } } ],
236-
directives: [],
237-
selectionSet:
238-
{ kind: Kind.SELECTION_SET,
239-
loc: { start: 16, end: 38 },
240-
selections:
241-
[ { kind: Kind.FIELD,
242-
loc: { start: 22, end: 24 },
243-
alias: null,
244-
name:
245-
{ kind: Kind.NAME,
246-
loc: { start: 22, end: 24 },
247-
value: 'id' },
248-
arguments: [],
249-
directives: [],
250-
selectionSet: null },
251-
{ kind: Kind.FIELD,
252-
loc: { start: 30, end: 34 },
253-
alias: null,
254-
name:
255-
{ kind: Kind.NAME,
256-
loc: { start: 30, end: 34 },
257-
value: 'name' },
258-
arguments: [],
259-
directives: [],
260-
selectionSet: null } ] } } ] } } ] }
241+
[ { kind: Kind.FIELD,
242+
loc: { start: 22, end: 24 },
243+
alias: null,
244+
name:
245+
{ kind: Kind.NAME,
246+
loc: { start: 22, end: 24 },
247+
value: 'id' },
248+
arguments: [],
249+
directives: [],
250+
selectionSet: null },
251+
{ kind: Kind.FIELD,
252+
loc: { start: 30, end: 34 },
253+
alias: null,
254+
name:
255+
{ kind: Kind.NAME,
256+
loc: { start: 30, end: 34 },
257+
value: 'name' },
258+
arguments: [],
259+
directives: [],
260+
selectionSet: null } ] } } ] } } ] }
261261
);
262262
});
263263

src/language/__tests__/visitor-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ describe('Visitor', () => {
139139
const addedField =
140140
{ kind: 'Field',
141141
name:
142-
{ kind: 'Name',
143-
value: '__typename' } };
142+
{ kind: 'Name',
143+
value: '__typename' } };
144144

145145
let didVisitAddedField;
146146

src/language/lexer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ function readString(source, start, line, col, prev): Token {
460460
code = charCodeAt.call(body, position);
461461
switch (code) {
462462
case 34: value += '"'; break;
463-
case 47: value += '\/'; break;
463+
case 47: value += '/'; break;
464464
case 92: value += '\\'; break;
465465
case 98: value += '\b'; break;
466466
case 102: value += '\f'; break;

src/type/__tests__/enumType-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ describe('Type System: Enum Values', () => {
164164
{
165165
message:
166166
'Argument "fromEnum" has invalid value "GREEN".' +
167-
'\nExpected type \"Color\", found "GREEN".',
167+
'\nExpected type "Color", found "GREEN".',
168168
locations: [ { line: 1, column: 23 } ]
169169
}
170170
]
@@ -276,7 +276,7 @@ describe('Type System: Enum Values', () => {
276276
errors: [
277277
{
278278
message:
279-
'Variable "\$color" got invalid value 2.' +
279+
'Variable "$color" got invalid value 2.' +
280280
'\nExpected type "Color", found 2.',
281281
locations: [ { line: 1, column: 12 } ]
282282
}

src/type/__tests__/introspection-test.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -878,26 +878,26 @@ describe('Introspection', () => {
878878
await graphql(schema, request)
879879
).to.containSubset({
880880
data:
881-
{ __schema:
882-
{ types:
883-
[ { kind: 'INPUT_OBJECT',
884-
name: 'TestInputObject',
885-
inputFields:
886-
[ { name: 'a',
887-
type:
888-
{ kind: 'SCALAR',
889-
name: 'String',
890-
ofType: null },
891-
defaultValue: '"foo"' },
892-
{ name: 'b',
893-
type:
894-
{ kind: 'LIST',
895-
name: null,
896-
ofType:
897-
{ kind: 'SCALAR',
898-
name: 'String',
899-
ofType: null } },
900-
defaultValue: null } ] } ] } }
881+
{ __schema:
882+
{ types:
883+
[ { kind: 'INPUT_OBJECT',
884+
name: 'TestInputObject',
885+
inputFields:
886+
[ { name: 'a',
887+
type:
888+
{ kind: 'SCALAR',
889+
name: 'String',
890+
ofType: null },
891+
defaultValue: '"foo"' },
892+
{ name: 'b',
893+
type:
894+
{ kind: 'LIST',
895+
name: null,
896+
ofType:
897+
{ kind: 'SCALAR',
898+
name: 'String',
899+
ofType: null } },
900+
defaultValue: null } ] } ] } }
901901
});
902902
});
903903

src/type/__tests__/validation-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ describe('Type System: Objects must have fields', () => {
372372
() => schemaWithFieldType(new GraphQLObjectType({
373373
name: 'SomeObject',
374374
fields() {
375-
return;
375+
376376
}
377377
}))
378378
).to.throw(
@@ -689,7 +689,7 @@ describe('Type System: Input Objects must have fields', () => {
689689
() => schemaWithInputObject(new GraphQLInputObjectType({
690690
name: 'SomeInputObject',
691691
fields() {
692-
return;
692+
693693
}
694694
}))
695695
).to.throw(

0 commit comments

Comments
 (0)