Skip to content

Commit 6c5c3db

Browse files
authored
Merge pull request #165 from maxymshg/add-prettier
Prettier setup
2 parents a0b2f1e + 6327fae commit 6c5c3db

16 files changed

+6327
-163
lines changed

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
target/
2+
node_modules/
3+
**/*.rs.bk
4+
Cargo.lock
5+
.idea

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ rust:
55
- nightly
66
cache: cargo
77
before_script:
8+
- sudo apt-get update
9+
- sudo apt-get install -y nodejs
10+
- npm i -g prettier
811
- if [ "$TRAVIS_RUST_VERSION" = "stable" ]; then (rustup component add rustfmt-preview clippy-preview) fi
912
script:
1013
- if [ "$TRAVIS_RUST_VERSION" = "stable" ]; then (cargo fmt --all -- --check) fi
1114
- if [ "$TRAVIS_RUST_VERSION" = "stable" ]; then (cargo clippy -- -D warnings) fi
15+
- prettier --debug-check -l './**/*.json' './**/*.graphql'
1216
- cargo test --all
1317
- cargo build --manifest-path=./graphql_client/examples/github/Cargo.toml
1418
- cargo build --manifest-path=./graphql_client_cli/Cargo.toml

CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ If you want install to a different toolchain (if for instance your default is se
3333
rustup component add rustfmt-preview clippy-preview --toolchain stable
3434
```
3535

36+
We are using [Prettier](https://prettier.io) to check `.json|.graphql` files. To have it on your local machine you need to install [Node.js](https://nodejs.org) first.
37+
Our build is now using latest LTS version of Node.js. We're using `npm` and global install here:
38+
39+
```bash
40+
npm install --global prettier
41+
```
42+
3643
### Running
3744

3845
Verify you are using the stable channel (output of `rustc --version` does not contain "nightly" or "beta"). Then run fmt, clippy, and test as they are invoked in the `.travis.yml` file.

graphql_client/examples/call_from_js/schema.json

Lines changed: 6161 additions & 1 deletion
Large diffs are not rendered by default.
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
{
2-
"everything": [
3-
{
4-
"__typename": "Person",
5-
"name": "Audrey Lorde",
6-
"birthday": "1934-02-18"
7-
},
8-
{
9-
"__typename": "Dog",
10-
"name": "Laïka",
11-
"isGoodDog": true
12-
},
13-
{
14-
"__typename": "Organization",
15-
"name": "Mozilla",
16-
"industry": "OTHER"
17-
},
18-
{
19-
"__typename": "Dog",
20-
"name": "Norbert",
21-
"isGoodDog": true
22-
}
23-
]
2+
"everything": [
3+
{
4+
"__typename": "Person",
5+
"name": "Audrey Lorde",
6+
"birthday": "1934-02-18"
7+
},
8+
{
9+
"__typename": "Dog",
10+
"name": "Laïka",
11+
"isGoodDog": true
12+
},
13+
{
14+
"__typename": "Organization",
15+
"name": "Mozilla",
16+
"industry": "OTHER"
17+
},
18+
{
19+
"__typename": "Dog",
20+
"name": "Norbert",
21+
"isGoodDog": true
22+
}
23+
]
2424
}
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
{
2-
"everything": [
3-
{
4-
"__typename": "Person",
5-
"name": "Audrey Lorde",
6-
"birthday": "1934-02-18"
7-
},
8-
{
9-
"__typename": "Dog",
10-
"name": "Laïka"
11-
},
12-
{
13-
"__typename": "Organization",
14-
"name": "Mozilla",
15-
"industry": "OTHER"
16-
},
17-
{
18-
"__typename": "Dog",
19-
"name": "Norbert"
20-
}
21-
]
2+
"everything": [
3+
{
4+
"__typename": "Person",
5+
"name": "Audrey Lorde",
6+
"birthday": "1934-02-18"
7+
},
8+
{
9+
"__typename": "Dog",
10+
"name": "Laïka"
11+
},
12+
{
13+
"__typename": "Organization",
14+
"name": "Mozilla",
15+
"industry": "OTHER"
16+
},
17+
{
18+
"__typename": "Dog",
19+
"name": "Norbert"
20+
}
21+
]
2222
}
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
schema {
2-
query: InterfaceQuery
2+
query: InterfaceQuery
33
}
44

55
interface Named {
6-
name: String!
7-
displayName: Boolean!
6+
name: String!
7+
displayName: Boolean!
88
}
99

1010
type Person implements Named {
11-
name: String!
12-
birthday: String
11+
name: String!
12+
birthday: String
1313
}
1414

1515
enum Industry {
16-
CHOCOLATE
17-
OTHER
16+
CHOCOLATE
17+
OTHER
1818
}
1919

2020
type Organization implements Named {
21-
name: String
22-
industry: Industry!
23-
createdAt: String
21+
name: String
22+
industry: Industry!
23+
createdAt: String
2424
}
2525

2626
type Dog implements Named {
27-
name: String!
28-
"""
29-
Always returns true
30-
"""
31-
isGoodDog: Boolean!
27+
name: String!
28+
"""
29+
Always returns true
30+
"""
31+
isGoodDog: Boolean!
3232
}
3333

3434
type InterfaceQuery {
35-
everything: [Named!]
35+
everything: [Named!]
3636
}
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
{
2-
"everything": [
3-
{
4-
"__typename": "Person",
5-
"name": "Audrey Lorde",
6-
"displayName": false,
7-
"birthday": "1934-02-18"
8-
},
9-
{
10-
"__typename": "Dog",
11-
"name": "Laïka",
12-
"displayName": true,
13-
"isGoodDog": true
14-
},
15-
{
16-
"__typename": "Organization",
17-
"name": "Mozilla",
18-
"displayName": false
19-
},
20-
{
21-
"__typename": "Dog",
22-
"name": "Norbert",
23-
"displayName": true,
24-
"isGoodDog": true
25-
}
26-
]
2+
"everything": [
3+
{
4+
"__typename": "Person",
5+
"name": "Audrey Lorde",
6+
"displayName": false,
7+
"birthday": "1934-02-18"
8+
},
9+
{
10+
"__typename": "Dog",
11+
"name": "Laïka",
12+
"displayName": true,
13+
"isGoodDog": true
14+
},
15+
{
16+
"__typename": "Organization",
17+
"name": "Mozilla",
18+
"displayName": false
19+
},
20+
{
21+
"__typename": "Dog",
22+
"name": "Norbert",
23+
"displayName": true,
24+
"isGoodDog": true
25+
}
26+
]
2727
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
query VariablesQuery($msg: String!, $reps: Int) {
2-
echo(message: $msg, repetitions: $reps) {
3-
result
4-
}
2+
echo(message: $msg, repetitions: $reps) {
3+
result
4+
}
55
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
21
schema {
3-
query: ScalarVariablesQuery
2+
query: ScalarVariablesQuery
43
}
54

65
type ScalarVariablesQuery {
7-
echo(message: String!, repetitions: Int): EchoResult
6+
echo(message: String!, repetitions: Int): EchoResult
87
}
98

109
type EchoResult {
11-
result: String!
10+
result: String!
1211
}

0 commit comments

Comments
 (0)