Skip to content

Commit 374095c

Browse files
authored
Merge pull request #21 from marmelab/change_trailing_comma_policy
[RFR] Change Trailing Comma Policy
2 parents d345d6e + 195346a commit 374095c

19 files changed

+68
-68
lines changed

.eslintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
{
2424
"singleQuote": true,
2525
"tabWidth": 4,
26-
"trailingComma": "all"
26+
"trailingComma": "es5"
2727
}
2828
],
2929
"import/no-extraneous-dependencies": "off",
@@ -43,4 +43,4 @@
4343
}
4444
]
4545
}
46-
}
46+
}

src/graphQLClientServer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default function(data, url = 'http://localhost:3000/graphql') {
5656
query.query,
5757
undefined,
5858
undefined,
59-
query.variables,
59+
query.variables
6060
).then(
6161
result => {
6262
const body = JSON.stringify(result);
@@ -66,7 +66,7 @@ export default function(data, url = 'http://localhost:3000/graphql') {
6666
error => {
6767
req.setResponseHeader('Content-Type', 'application/json');
6868
req.receive(500, JSON.stringify(error));
69-
},
69+
}
7070
);
7171
});
7272

src/introspection/DateType.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default new GraphQLScalarType({
1818
if (ast.kind !== Kind.STRING) {
1919
throw new GraphQLError(
2020
`Query error: Can only parse dates strings, got a: ${ast.kind}`,
21-
[ast],
21+
[ast]
2222
);
2323
}
2424
if (isNaN(Date.parse(ast.value))) {

src/introspection/getFieldsFromEntities.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default (entities, checkRequired = true) => {
3636
fieldValues[fieldName],
3737
checkRequired
3838
? fieldValues[fieldName].length === nbValues
39-
: false,
39+
: false
4040
),
4141
};
4242
return fields;

src/introspection/getFieldsFromEntities.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ test('does infer field types', () => {
77
{ id: 1, foo: 'foo1' },
88
{ id: 2, foo: 'foo2', bar: 'bar1' },
99
{ id: 3, bar: 'bar2' },
10-
]),
10+
])
1111
).toEqual({
1212
id: { type: new GraphQLNonNull(GraphQLID) },
1313
foo: { type: GraphQLString },

src/introspection/getFilterTypesFromData.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const getRangeFiltersFromEntities = entities => {
1515
const fieldType = getTypeFromValues(
1616
fieldName,
1717
fieldValues[fieldName],
18-
false,
18+
false
1919
);
2020
if (
2121
fieldType == GraphQLInt ||
@@ -98,9 +98,9 @@ export default data =>
9898
q: { type: GraphQLString },
9999
},
100100
getFieldsFromEntities(data[key], false),
101-
getRangeFiltersFromEntities(data[key]),
101+
getRangeFiltersFromEntities(data[key])
102102
),
103103
}),
104104
}),
105-
{},
105+
{}
106106
);

src/introspection/getSchemaFromData.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export default data => {
128128
fields: types.reduce((fields, type) => {
129129
const typeFields = typesByName[type.name].getFields();
130130
const nullableTypeFields = Object.keys(
131-
typeFields,
131+
typeFields
132132
).reduce((f, fieldName) => {
133133
f[fieldName] = Object.assign({}, typeFields[fieldName], {
134134
type:

src/introspection/getSchemaFromData.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ test('creates one type per data type', () => {
107107
const typeMap = getSchemaFromData(data).getTypeMap();
108108
expect(typeMap['Post'].name).toEqual(PostType.name);
109109
expect(Object.keys(typeMap['Post'].getFields())).toEqual(
110-
Object.keys(PostType.getFields()),
110+
Object.keys(PostType.getFields())
111111
);
112112
expect(typeMap['User'].name).toEqual(UserType.name);
113113
expect(Object.keys(typeMap['User'].getFields())).toEqual(
114-
Object.keys(UserType.getFields()),
114+
Object.keys(UserType.getFields())
115115
);
116116
});
117117

src/introspection/getTypeFromValues.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,33 +42,33 @@ export default (name, values = [], isRequired = false) => {
4242
if (valuesAreBoolean(leafValues)) {
4343
return requiredTypeOrNormal(
4444
new GraphQLList(GraphQLBoolean),
45-
isRequired,
45+
isRequired
4646
);
4747
}
4848
if (valuesAreString(leafValues)) {
4949
return requiredTypeOrNormal(
5050
new GraphQLList(GraphQLString),
51-
isRequired,
51+
isRequired
5252
);
5353
}
5454
if (valuesAreInteger(leafValues)) {
5555
return requiredTypeOrNormal(
5656
new GraphQLList(GraphQLInt),
57-
isRequired,
57+
isRequired
5858
);
5959
}
6060
if (valuesAreNumeric(leafValues)) {
6161
return requiredTypeOrNormal(
6262
new GraphQLList(GraphQLFloat),
63-
isRequired,
63+
isRequired
6464
);
6565
}
6666
if (valuesAreObject(leafValues)) {
6767
return requiredTypeOrNormal(GraphQLJSON, isRequired);
6868
}
6969
return requiredTypeOrNormal(
7070
new GraphQLList(GraphQLString),
71-
isRequired,
71+
isRequired
7272
); // FIXME introspect further
7373
}
7474
if (valuesAreBoolean(values)) {

src/introspection/getTypeFromValues.spec.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ test('returns GraphQLID for fields named id or xxx_id', () => {
1818

1919
test('returns GraphQLList for arrays', () => {
2020
expect(getTypeFromValues('foo', [[true, false], [true]])).toEqual(
21-
new GraphQLList(GraphQLBoolean),
21+
new GraphQLList(GraphQLBoolean)
2222
);
2323
expect(getTypeFromValues('foo', [['a', 'b'], ['c', 'd']])).toEqual(
24-
new GraphQLList(GraphQLString),
24+
new GraphQLList(GraphQLString)
2525
);
2626
expect(getTypeFromValues('foo', [[123, 456], [789, 123]])).toEqual(
27-
new GraphQLList(GraphQLInt),
27+
new GraphQLList(GraphQLInt)
2828
);
2929
expect(getTypeFromValues('foo', [[1.23, 456], [-5, 123]])).toEqual(
30-
new GraphQLList(GraphQLFloat),
30+
new GraphQLList(GraphQLFloat)
3131
);
3232
});
3333

3434
test('returns GraphQLBoolean for booleans', () =>
3535
expect(getTypeFromValues('foo', [true, true, false])).toEqual(
36-
GraphQLBoolean,
36+
GraphQLBoolean
3737
));
3838

3939
test('returns GraphQLString for strings', () => {
@@ -49,28 +49,28 @@ test('returns GraphQLFloat for floats', () =>
4949

5050
test('returns DateType for Dates', () =>
5151
expect(
52-
getTypeFromValues('foo', [new Date('2017-03-15'), new Date()]),
52+
getTypeFromValues('foo', [new Date('2017-03-15'), new Date()])
5353
).toEqual(DateType));
5454

5555
test('returns GraphQLJSON for objects', () =>
5656
expect(
57-
getTypeFromValues('foo', [{ foo: 1 }, { bar: 2 }, { id: 'a' }]),
57+
getTypeFromValues('foo', [{ foo: 1 }, { bar: 2 }, { id: 'a' }])
5858
).toEqual(GraphQLJSON));
5959

6060
test('returns GraphQLJSON for arrays of objects', () =>
6161
expect(
62-
getTypeFromValues('foo', [[{ foo: 1 }, { bar: 2 }], [{ id: 'a' }]]),
62+
getTypeFromValues('foo', [[{ foo: 1 }, { bar: 2 }], [{ id: 'a' }]])
6363
).toEqual(GraphQLJSON));
6464

6565
test('returns GraphQLString for mixed values', () =>
6666
expect(getTypeFromValues('foo', [0, '&', new Date()])).toEqual(
67-
GraphQLString,
67+
GraphQLString
6868
));
6969

7070
test('returns GraphQLString for no values', () =>
7171
expect(getTypeFromValues('foo')).toEqual(GraphQLString));
7272

7373
test('returns GraphQLNonNull when all values are filled', () =>
7474
expect(getTypeFromValues('foo', [], true)).toEqual(
75-
new GraphQLNonNull(GraphQLString),
75+
new GraphQLNonNull(GraphQLString)
7676
));

0 commit comments

Comments
 (0)