Skip to content

Commit 58a354b

Browse files
committed
chore: prettier
1 parent d2713b2 commit 58a354b

11 files changed

+842
-615
lines changed

__tests__/integration/create.test.js

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
const { graphql } = require('graphql');
32
const { withSchema } = require('../helpers');
43

@@ -90,7 +89,9 @@ test(
9089

9190
const data = result.data.createParent.parent;
9291
expect(data.childrenByParentId.nodes).toHaveLength(2);
93-
data.childrenByParentId.nodes.map(n => expect(n.parentId).toBe(data.id));
92+
data.childrenByParentId.nodes.map((n) =>
93+
expect(n.parentId).toBe(data.id),
94+
);
9495
},
9596
}),
9697
);
@@ -297,7 +298,9 @@ test(
297298

298299
const data = result.data.createParent.parent;
299300
expect(data.childrenByParentId.nodes).toHaveLength(2);
300-
data.childrenByParentId.nodes.map(n => expect(n.parentId).toBe(data.id));
301+
data.childrenByParentId.nodes.map((n) =>
302+
expect(n.parentId).toBe(data.id),
303+
);
301304
},
302305
}),
303306
);
@@ -331,7 +334,9 @@ test(
331334
}
332335
}
333336
`;
334-
const lookupResult = await graphql(schema, lookupQuery, null, { pgClient });
337+
const lookupResult = await graphql(schema, lookupQuery, null, {
338+
pgClient,
339+
});
335340
const { nodeId } = lookupResult.data.childById;
336341
expect(nodeId).not.toBeUndefined();
337342

@@ -380,7 +385,9 @@ test(
380385

381386
const data = result.data.createParent.parent;
382387
expect(data.childrenByParentId.nodes).toHaveLength(5);
383-
data.childrenByParentId.nodes.map(n => expect(n.parentId).toBe(data.id));
388+
data.childrenByParentId.nodes.map((n) =>
389+
expect(n.parentId).toBe(data.id),
390+
);
384391
},
385392
}),
386393
);
@@ -440,7 +447,6 @@ test(
440447
}),
441448
);
442449

443-
444450
test(
445451
'reverse nested mutation creates records',
446452
withSchema({
@@ -579,7 +585,9 @@ test(
579585
}
580586
}
581587
`;
582-
const lookupResult = await graphql(schema, lookupQuery, null, { pgClient });
588+
const lookupResult = await graphql(schema, lookupQuery, null, {
589+
pgClient,
590+
});
583591
const { nodeId } = lookupResult.data.parentById;
584592
expect(nodeId).not.toBeUndefined();
585593

@@ -679,7 +687,9 @@ test(
679687

680688
const data = result.data.createParent.parent;
681689
expect(data.childrenByParentId.nodes).toHaveLength(2);
682-
data.childrenByParentId.nodes.map(n => expect(n.parentId).toEqual(data.id));
690+
data.childrenByParentId.nodes.map((n) =>
691+
expect(n.parentId).toEqual(data.id),
692+
);
683693
},
684694
}),
685695
);
@@ -742,8 +752,9 @@ test(
742752

743753
const data = result.data.createParent.parent;
744754
expect(data.childrenByParentIdAndParentName.nodes).toHaveLength(2);
745-
data.childrenByParentIdAndParentName.nodes
746-
.map(n => expect([n.parentId, n.parentName]).toEqual([data.id, data.name]));
755+
data.childrenByParentIdAndParentName.nodes.map((n) =>
756+
expect([n.parentId, n.parentName]).toEqual([data.id, data.name]),
757+
);
747758
},
748759
}),
749760
);
@@ -807,7 +818,9 @@ test(
807818

808819
const data = result.data.createParent.parent;
809820
expect(data.childrenByParentId.nodes).toHaveLength(2);
810-
data.childrenByParentId.nodes.map(n => expect(n.parentId).toBe(data.id));
821+
data.childrenByParentId.nodes.map((n) =>
822+
expect(n.parentId).toBe(data.id),
823+
);
811824
},
812825
}),
813826
);

__tests__/integration/plurals.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ test(
251251

252252
const result = await graphql(schema, query, null, { pgClient });
253253
expect(result).toHaveProperty('errors');
254-
expect(result.errors[0].message).toMatch(/may only create or connect a single row/);
254+
expect(result.errors[0].message).toMatch(
255+
/may only create or connect a single row/,
256+
);
255257
},
256258
}),
257259
);

__tests__/integration/schema/core.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ const { createPostGraphileSchema } = require('postgraphile-core');
22
const printSchemaOrdered = require('../../printSchemaOrdered');
33
const { withPgClient } = require('../../helpers');
44

5-
exports.test = (schemas, options, setup) => () => withPgClient(async (client) => {
6-
if (setup) {
7-
if (typeof setup === 'function') {
8-
await setup(client);
9-
} else {
10-
await client.query(setup);
5+
exports.test = (schemas, options, setup) => () =>
6+
withPgClient(async (client) => {
7+
if (setup) {
8+
if (typeof setup === 'function') {
9+
await setup(client);
10+
} else {
11+
await client.query(setup);
12+
}
1113
}
12-
}
13-
const schema = await createPostGraphileSchema(client, schemas, options);
14-
expect(printSchemaOrdered(schema)).toMatchSnapshot();
15-
});
14+
const schema = await createPostGraphileSchema(client, schemas, options);
15+
expect(printSchemaOrdered(schema)).toMatchSnapshot();
16+
});

__tests__/integration/smartComments.test.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ test(
112112

113113
const result = await graphql(schema, query, null, { pgClient });
114114
expect(result).toHaveProperty('errors');
115-
expect(result.errors[0].message).toMatch(/"childrenUsingId" is not defined/);
115+
expect(result.errors[0].message).toMatch(
116+
/"childrenUsingId" is not defined/,
117+
);
116118
},
117119
}),
118120
);
@@ -231,7 +233,9 @@ test(
231233

232234
const data = result.data.createParent.parent;
233235
expect(data.childrenByParentId.nodes).toHaveLength(2);
234-
data.childrenByParentId.nodes.map(n => expect(n.parentId).toBe(data.id));
236+
data.childrenByParentId.nodes.map((n) =>
237+
expect(n.parentId).toBe(data.id),
238+
);
235239
},
236240
}),
237241
);
@@ -292,7 +296,9 @@ test(
292296

293297
const data = result.data.createParent.parent;
294298
expect(data.childrenByParentId.nodes).toHaveLength(2);
295-
data.childrenByParentId.nodes.map(n => expect(n.parentId).toBe(data.id));
299+
data.childrenByParentId.nodes.map((n) =>
300+
expect(n.parentId).toBe(data.id),
301+
);
296302
},
297303
}),
298304
);
@@ -465,7 +471,9 @@ test(
465471

466472
const data = result.data.createParent.parent;
467473
expect(data.childrenByParentId.nodes).toHaveLength(2);
468-
data.childrenByParentId.nodes.map(n => expect(n.parentId).toBe(data.id));
474+
data.childrenByParentId.nodes.map((n) =>
475+
expect(n.parentId).toBe(data.id),
476+
);
469477
},
470478
}),
471479
);
@@ -526,7 +534,7 @@ test(
526534

527535
const data = result.data.createParent.parent;
528536
expect(data.jane.nodes).toHaveLength(2);
529-
data.jane.nodes.map(n => expect(n.parentId).toBe(data.id));
537+
data.jane.nodes.map((n) => expect(n.parentId).toBe(data.id));
530538
},
531539
}),
532540
);
@@ -584,7 +592,9 @@ test(
584592

585593
const result = await graphql(schema, query, null, { pgClient });
586594
expect(result).toHaveProperty('errors');
587-
expect(result.errors[0].message).toMatch(/"childrenUsingId" is not defined/);
595+
expect(result.errors[0].message).toMatch(
596+
/"childrenUsingId" is not defined/,
597+
);
588598
},
589599
}),
590600
);

__tests__/integration/update.test.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ test(
5858

5959
const data = result.data.updateParentById.parent;
6060
expect(data.childrenByParentId.nodes).toHaveLength(3);
61-
data.childrenByParentId.nodes.map(n => expect(n.parentId).toBe(data.id));
61+
data.childrenByParentId.nodes.map((n) =>
62+
expect(n.parentId).toBe(data.id),
63+
);
6264
},
6365
}),
6466
);
@@ -121,7 +123,9 @@ test(
121123

122124
const data = result.data.updateParentById.parent;
123125
expect(data.childrenByParentId.nodes).toHaveLength(2);
124-
data.childrenByParentId.nodes.map(n => expect(n.parentId).toBe(data.id));
126+
data.childrenByParentId.nodes.map((n) =>
127+
expect(n.parentId).toBe(data.id),
128+
);
125129
},
126130
}),
127131
);
@@ -369,7 +373,9 @@ test(
369373

370374
const data = result.data.updateParentById.parent;
371375
expect(data.childrenByParentId.nodes).toHaveLength(1);
372-
data.childrenByParentId.nodes.map(n => expect(n.parentId).toBe(data.id));
376+
data.childrenByParentId.nodes.map((n) =>
377+
expect(n.parentId).toBe(data.id),
378+
);
373379
expect(data.childrenByParentId.nodes[0].name).toEqual('renamed child');
374380
},
375381
}),
@@ -403,7 +409,9 @@ test(
403409
}
404410
}
405411
`;
406-
const lookupResult = await graphql(schema, lookupQuery, null, { pgClient });
412+
const lookupResult = await graphql(schema, lookupQuery, null, {
413+
pgClient,
414+
});
407415
const { nodeId } = lookupResult.data.childById;
408416
expect(nodeId).not.toBeUndefined();
409417

@@ -445,7 +453,9 @@ test(
445453

446454
const data = result.data.updateParentById.parent;
447455
expect(data.childrenByParentId.nodes).toHaveLength(1);
448-
data.childrenByParentId.nodes.map(n => expect(n.parentId).toBe(data.id));
456+
data.childrenByParentId.nodes.map((n) =>
457+
expect(n.parentId).toBe(data.id),
458+
);
449459
expect(data.childrenByParentId.nodes[0].name).toEqual('renamed child');
450460
},
451461
}),
@@ -480,7 +490,9 @@ test(
480490
}
481491
}
482492
`;
483-
const lookupResult = await graphql(schema, lookupQuery, null, { pgClient });
493+
const lookupResult = await graphql(schema, lookupQuery, null, {
494+
pgClient,
495+
});
484496
const { nodeId } = lookupResult.data.childByIdAndParentIdAndName;
485497
expect(nodeId).not.toBeUndefined();
486498

@@ -522,7 +534,9 @@ test(
522534

523535
const data = result.data.updateParentById.parent;
524536
expect(data.childrenByParentId.nodes).toHaveLength(1);
525-
data.childrenByParentId.nodes.map(n => expect(n.parentId).toBe(data.id));
537+
data.childrenByParentId.nodes.map((n) =>
538+
expect(n.parentId).toBe(data.id),
539+
);
526540
expect(data.childrenByParentId.nodes[0].name).toEqual('renamed child');
527541
},
528542
}),

package.json

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@
2626
"@graphile-contrib/pg-simplify-inflector": "^4.0.0-alpha.0",
2727
"eslint": "^5.10.0",
2828
"eslint-config-airbnb-base": "^13.1.0",
29+
"eslint-config-prettier": "^4.0.0",
2930
"eslint-plugin-import": "^2.14.0",
31+
"eslint-plugin-prettier": "^3.0.1",
3032
"graphql": "^14.0.2",
3133
"jest": "^23.6.0",
3234
"jest-junit": "^5.2.0",
3335
"pg": "^7.7.1",
34-
"postgraphile-core": "^4.2.0"
36+
"postgraphile-core": "^4.2.0",
37+
"prettier": "^1.16.4"
3538
},
3639
"jest": {
3740
"testRegex": "__tests__/.*\\.test\\.js$",
@@ -43,14 +46,19 @@
4346
"files": [
4447
"src"
4548
],
49+
"prettier": {
50+
"trailingComma": "all",
51+
"semi": true,
52+
"singleQuote": true,
53+
"arrowParens": "always"
54+
},
4655
"eslintConfig": {
47-
"parserOptions": {
48-
"ecmaFeatures": {
49-
"jsx": true
50-
}
51-
},
5256
"extends": [
53-
"airbnb-base"
57+
"airbnb-base",
58+
"prettier"
59+
],
60+
"plugins": [
61+
"prettier"
5462
],
5563
"env": {
5664
"jest": true
@@ -60,6 +68,7 @@
6068
"jasmine": false
6169
},
6270
"rules": {
71+
"prettier/prettier": "error",
6372
"import/no-unresolved": 0,
6473
"import/no-extraneous-dependencies": 0,
6574
"import/extensions": 0,

0 commit comments

Comments
 (0)