Skip to content

Commit 8545e39

Browse files
authored
add @theguild/prettier-config, prettiffy all files (ardatan#3964)
* prettify with @theguild/prettier-config * add prettier action
1 parent f3666cc commit 8545e39

File tree

139 files changed

+1897
-3070
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+1897
-3070
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+5
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@ about: Create a bug report to help us improve
1010
_Progress of the issue based on the [Contributor Workflow](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md#a-typical-contributor-workflow)_
1111

1212
- [ ] 1. The issue provides a reproduction available on [Github](https://github.com/Urigo/graphql-mesh/tree/master/examples/hello-world), [Stackblitz](https://stackblitz.com/github/Urigo/graphql-mesh/tree/master/examples/hello-world) or [CodeSandbox](https://codesandbox.io/s/github/Urigo/graphql-mesh/tree/master/examples/hello-world)
13+
1314
> Make sure to fork this template and run `yarn generate` in the terminal.
1415
>
1516
> Please make sure Mesh package versions under `package.json` matches yours.
17+
1618
- [ ] 2. A failing test has been provided
1719
- [ ] 3. A local solution has been provided
1820
- [ ] 4. A pull request is pending review
1921

2022
---
2123

2224
**Describe the bug**
25+
2326
<!-- A clear and concise description of what the bug is. -->
2427

2528
**To Reproduce**
@@ -28,6 +31,7 @@ Steps to reproduce the behavior:
2831
<!-- Adding a codesandbox can help us understand the bug better and speed up things -->
2932

3033
**Expected behavior**
34+
3135
<!-- A clear and concise description of what you expected to happen. -->
3236

3337
**Environment:**
@@ -37,4 +41,5 @@ Steps to reproduce the behavior:
3741
- NodeJS:
3842

3943
**Additional context**
44+
4045
<!-- Add any other context about the problem here. -->
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
---
22
name: Feature Request
33
about: Suggest an idea for the core of this project
4-
54
---
65

76
**Is your feature request related to a problem? Please describe.**
87

98
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
109

1110
**Describe the solution you'd like**
11+
1212
<!-- A clear and concise description of what you want to happen. -->
1313

1414
**Describe alternatives you've considered**
15+
1516
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
1617

1718
**Additional context**
19+
1820
<!-- Add any other context or screenshots about the feature request here. -->

.github/PULL_REQUEST_TEMPLATE.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
🚨 **IMPORTANT: Please do not create a Pull Request without creating an issue first.**
22

3-
*Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.*
3+
_Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request._
44

55
## Description
66

@@ -29,6 +29,7 @@ Please describe the tests that you ran to verify your changes. Provide instructi
2929
- [ ] Test B
3030

3131
**Test Environment**:
32+
3233
- OS:
3334
- `@graphql-mesh/...`:
3435
- NodeJS:

.github/workflows/tests.yml

+4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ jobs:
2222

2323
- name: Install Dependencies using Yarn
2424
run: yarn install --ignore-engines && git checkout yarn.lock
25+
2526
- name: Lint
2627
run: yarn lint
28+
29+
- name: 🧹 Prettier Check
30+
run: yarn prettier:check
2731
typecheck:
2832
name: TypeScript Type Checking
2933
runs-on: ubuntu-latest

.gitignore

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
node_modules
1+
node_modules/
22
temp
3-
dist
3+
dist/
44
out
55
build
66
generated
@@ -13,7 +13,8 @@ package-lock.json
1313
.DS_Store
1414
.mesh
1515
.parcel-cache
16-
/.idea
17-
.next
16+
/.idea/
17+
.next/
1818
/website/api-sidebar.json
1919
/website/docs/api
20+
/.husky/_/

.husky/.gitignore

-1
This file was deleted.

.prettierignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.changeset/*.md
2+
/website/docs/generated-markdown/
3+
.next/
4+
dist/
5+
.mesh/
6+
/.husky/_/

.prettierrc

-14
This file was deleted.

.prettierrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('@theguild/prettier-config');
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
1-
const { ApolloServer, gql } = require("apollo-server");
2-
3-
const typeDefs = gql`
4-
type Query {
5-
me: User
6-
user(id: ID!): User
7-
users: [User]
8-
}
9-
10-
type User {
11-
id: ID!
12-
name: String
13-
username: String
14-
}
15-
`;
16-
17-
const resolvers = {
18-
Query: {
19-
me(root, args, context) {
20-
return context.users[0];
21-
},
22-
users(root, args, context) {
23-
return context.users;
24-
},
25-
user(root, args, context) {
26-
return context.users.find(user => user.id === args.id);
27-
}
28-
}
29-
};
30-
31-
const server = new ApolloServer({
32-
typeDefs,
33-
resolvers,
34-
context: {
35-
users: [
36-
{
37-
id: "1",
38-
name: "Ada Lovelace",
39-
birthDate: "1815-12-10",
40-
username: "@ada"
41-
},
42-
{
43-
id: "2",
44-
name: "Alan Turing",
45-
birthDate: "1912-06-23",
46-
username: "@complete"
47-
}
48-
]
49-
}
50-
});
51-
52-
module.exports = server.listen({ port: 9871 }).then(({ url }) => {
53-
if (!process.env.CI) {
54-
console.log(`🚀 Server ready at ${url}`);
55-
}
56-
return server;
57-
});
1+
const { ApolloServer, gql } = require('apollo-server');
2+
3+
const typeDefs = gql`
4+
type Query {
5+
me: User
6+
user(id: ID!): User
7+
users: [User]
8+
}
9+
10+
type User {
11+
id: ID!
12+
name: String
13+
username: String
14+
}
15+
`;
16+
17+
const resolvers = {
18+
Query: {
19+
me(root, args, context) {
20+
return context.users[0];
21+
},
22+
users(root, args, context) {
23+
return context.users;
24+
},
25+
user(root, args, context) {
26+
return context.users.find(user => user.id === args.id);
27+
},
28+
},
29+
};
30+
31+
const server = new ApolloServer({
32+
typeDefs,
33+
resolvers,
34+
context: {
35+
users: [
36+
{
37+
id: '1',
38+
name: 'Ada Lovelace',
39+
birthDate: '1815-12-10',
40+
username: '@ada',
41+
},
42+
{
43+
id: '2',
44+
name: 'Alan Turing',
45+
birthDate: '1912-06-23',
46+
username: '@complete',
47+
},
48+
],
49+
},
50+
});
51+
52+
module.exports = server.listen({ port: 9871 }).then(({ url }) => {
53+
if (!process.env.CI) {
54+
console.log(`🚀 Server ready at ${url}`);
55+
}
56+
return server;
57+
});
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
const { ApolloServer, gql } = require("apollo-server");
2-
const { buildSubgraphSchema } = require("@apollo/subgraph");
3-
4-
const typeDefs = gql`
5-
extend type Product @key(fields: "upc") {
6-
upc: String! @external
7-
weight: Int @external
8-
price: Int @external
9-
inStock: Boolean
10-
shippingEstimate: Int @requires(fields: "price weight")
11-
}
12-
`;
13-
14-
const resolvers = {
15-
Product: {
16-
__resolveReference(object) {
17-
return {
18-
...object,
19-
...inventory.find(product => product.upc === object.upc)
20-
};
21-
},
22-
shippingEstimate(object) {
23-
// free for expensive items
24-
if (object.price > 1000) return 0;
25-
// estimate is based on weight
26-
return object.weight * 0.5;
27-
}
28-
}
29-
};
30-
31-
const server = new ApolloServer({
32-
schema: buildSubgraphSchema([
33-
{
34-
typeDefs,
35-
resolvers
36-
}
37-
])
38-
});
39-
40-
module.exports = server.listen({ port: 9872 }).then(({ url }) => {
41-
if (!process.env.CI) {
42-
console.log(`🚀 Server ready at ${url}`);
43-
}
44-
return server;
45-
});
46-
47-
const inventory = [
48-
{ upc: "1", inStock: true },
49-
{ upc: "2", inStock: false },
50-
{ upc: "3", inStock: true }
51-
];
1+
const { ApolloServer, gql } = require('apollo-server');
2+
const { buildSubgraphSchema } = require('@apollo/subgraph');
3+
4+
const typeDefs = gql`
5+
extend type Product @key(fields: "upc") {
6+
upc: String! @external
7+
weight: Int @external
8+
price: Int @external
9+
inStock: Boolean
10+
shippingEstimate: Int @requires(fields: "price weight")
11+
}
12+
`;
13+
14+
const resolvers = {
15+
Product: {
16+
__resolveReference(object) {
17+
return {
18+
...object,
19+
...inventory.find(product => product.upc === object.upc),
20+
};
21+
},
22+
shippingEstimate(object) {
23+
// free for expensive items
24+
if (object.price > 1000) return 0;
25+
// estimate is based on weight
26+
return object.weight * 0.5;
27+
},
28+
},
29+
};
30+
31+
const server = new ApolloServer({
32+
schema: buildSubgraphSchema([
33+
{
34+
typeDefs,
35+
resolvers,
36+
},
37+
]),
38+
});
39+
40+
module.exports = server.listen({ port: 9872 }).then(({ url }) => {
41+
if (!process.env.CI) {
42+
console.log(`🚀 Server ready at ${url}`);
43+
}
44+
return server;
45+
});
46+
47+
const inventory = [
48+
{ upc: '1', inStock: true },
49+
{ upc: '2', inStock: false },
50+
{ upc: '3', inStock: true },
51+
];

0 commit comments

Comments
 (0)