Skip to content

Commit 3e2e566

Browse files
committed
Various fixes to docs (#4256)
1 parent 0cfaafc commit 3e2e566

17 files changed

+174
-117
lines changed

cspell.yml

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ ignorePaths:
55
# Excluded from spelling check
66
- cspell.yml
77
- package.json
8+
- package-lock.json
9+
- tsconfig.json
810
- benchmark/github-schema.graphql
911
- benchmark/github-schema.json
12+
- website/icons
13+
- website/css
1014
overrides:
11-
- filename: '**/docs-old/APIReference-*.md'
12-
ignoreRegExpList: ['/href="[^"]*"/']
13-
words:
14-
- sublinks
15-
- instanceof
1615
- filename: 'website/**'
1716
dictionaries:
1817
- fullstack
@@ -36,6 +35,8 @@ words:
3635
- graphiql
3736
- uncoerce
3837
- uncoerced
38+
- sublinks
39+
- instanceof
3940

4041
# Different names used inside tests
4142
- Skywalker
@@ -45,14 +46,68 @@ words:
4546
- Artoo
4647
- Threepio
4748
- Odie
49+
- Odie's
4850
- Damerau
4951
- Alderaan
5052
- Tatooine
5153
- astromech
5254

5355
# TODO: contribute upstream
5456
- deno
55-
- hashbang
57+
- codecov
58+
59+
# Website tech
60+
- Nextra
61+
- headlessui
62+
- Fastify
63+
- tailwindcss
64+
- svgr
65+
- ruru
66+
67+
# used as href anchors
68+
- graphqlerror
69+
- syntaxerror
70+
- formaterror
71+
- graphqlschema
72+
- graphqlscalartype
73+
- graphqlobjecttype
74+
- graphqlinterfacetype
75+
- graphqluniontype
76+
- graphqlenumtype
77+
- graphqlinputobjecttype
78+
- graphqllist
79+
- graphqlnonnull
80+
- graphqlint
81+
- graphqlfloat
82+
- graphqlstring
83+
- graphqlboolean
84+
- graphqlid
85+
- getlocation
86+
- isinputtype
87+
- isoutputtype
88+
- isleaftype
89+
- iscompositetype
90+
- isabstracttype
91+
- getnullabletype
92+
- getnamedtype
93+
- introspectionquery
94+
- buildclientschema
95+
- buildschema
96+
- printschema
97+
- printintrospectionschema
98+
- buildastschema
99+
- typefromast
100+
- astfromvalue
101+
- typeinfo
102+
- isvalidjsvalue
103+
- isvalidliteralvalue
104+
- specifiedrules
105+
- Wordmark
106+
- codeofconduct
107+
- graphqlconf
108+
109+
# website words
110+
- runtimes
56111

57112
# TODO: remove bellow words
58113
- QLID # GraphQLID

website/css/globals.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ footer {
4848

4949
&:hover {
5050
mask-position: 100%;
51-
transition: mask-position 1s ease, -webkit-mask-position 1s ease;
51+
transition:
52+
mask-position 1s ease,
53+
-webkit-mask-position 1s ease;
5254
}
5355
}
5456

website/pages/authentication-and-express-middleware.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ To use middleware with a GraphQL resolver, just use the middleware like you woul
1010
For example, let's say we wanted our server to log the IP address of every request, and we also want to write an API that returns the IP address of the caller. We can do the former with middleware, and the latter by accessing the `request` object in a resolver. Here's server code that implements this:
1111

1212
```js
13-
var express = require('express');
14-
var { createHandler } = require('graphql-http/lib/use/express');
15-
var { buildSchema } = require('graphql');
13+
const express = require('express');
14+
const { createHandler } = require('graphql-http/lib/use/express');
15+
const { buildSchema } = require('graphql');
1616

17-
var schema = buildSchema(`
17+
const schema = buildSchema(`
1818
type Query {
1919
ip: String
2020
}
@@ -25,13 +25,13 @@ function loggingMiddleware(req, res, next) {
2525
next();
2626
}
2727

28-
var root = {
28+
const root = {
2929
ip(args, context) {
3030
return context.ip;
3131
},
3232
};
3333

34-
var app = express();
34+
const app = express();
3535
app.use(loggingMiddleware);
3636
app.all(
3737
'/graphql',

website/pages/basic-types.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ To use a list type, surround the type in square brackets, so `[Int]` is a list o
1313
Each of these types maps straightforwardly to JavaScript, so you can just return plain old JavaScript objects in APIs that return these types. Here's an example that shows how to use some of these basic types:
1414

1515
```js
16-
var express = require('express');
17-
var { createHandler } = require('graphql-http/lib/use/express');
18-
var { buildSchema } = require('graphql');
16+
const express = require('express');
17+
const { createHandler } = require('graphql-http/lib/use/express');
18+
const { buildSchema } = require('graphql');
1919

2020
// Construct a schema, using GraphQL schema language
21-
var schema = buildSchema(`
21+
const schema = buildSchema(`
2222
type Query {
2323
quoteOfTheDay: String
2424
random: Float!
@@ -27,7 +27,7 @@ var schema = buildSchema(`
2727
`);
2828

2929
// The root provides a resolver function for each API endpoint
30-
var root = {
30+
const root = {
3131
quoteOfTheDay() {
3232
return Math.random() < 0.5 ? 'Take it easy' : 'Salvation lies within';
3333
},
@@ -39,7 +39,7 @@ var root = {
3939
},
4040
};
4141

42-
var app = express();
42+
const app = express();
4343
app.all(
4444
'/graphql',
4545
createHandler({

website/pages/constructing-types.mdx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ When you are using the `GraphQLSchema` constructor to create a schema, instead o
99
For example, let's say we are building a simple API that lets you fetch user data for a few hardcoded users based on an id. Using `buildSchema` we could write a server with:
1010

1111
```js
12-
var express = require('express');
13-
var { createHandler } = require('graphql-http/lib/use/express');
14-
var { buildSchema } = require('graphql');
12+
const express = require('express');
13+
const { createHandler } = require('graphql-http/lib/use/express');
14+
const { buildSchema } = require('graphql');
1515

16-
var schema = buildSchema(`
16+
const schema = buildSchema(`
1717
type User {
1818
id: String
1919
name: String
@@ -25,7 +25,7 @@ var schema = buildSchema(`
2525
`);
2626

2727
// Maps id to User object
28-
var fakeDatabase = {
28+
const fakeDatabase = {
2929
a: {
3030
id: 'a',
3131
name: 'alice',
@@ -36,13 +36,13 @@ var fakeDatabase = {
3636
},
3737
};
3838

39-
var root = {
39+
const root = {
4040
user({ id }) {
4141
return fakeDatabase[id];
4242
},
4343
};
4444

45-
var app = express();
45+
const app = express();
4646
app.all(
4747
'/graphql',
4848
createHandler({
@@ -57,12 +57,12 @@ console.log('Running a GraphQL API server at localhost:4000/graphql');
5757
We can implement this same API without using GraphQL schema language:
5858

5959
```js
60-
var express = require('express');
61-
var { createHandler } = require('graphql-http/lib/use/express');
62-
var graphql = require('graphql');
60+
const express = require('express');
61+
const { createHandler } = require('graphql-http/lib/use/express');
62+
const graphql = require('graphql');
6363

6464
// Maps id to User object
65-
var fakeDatabase = {
65+
const fakeDatabase = {
6666
a: {
6767
id: 'a',
6868
name: 'alice',
@@ -74,7 +74,7 @@ var fakeDatabase = {
7474
};
7575

7676
// Define the User type
77-
var userType = new graphql.GraphQLObjectType({
77+
const userType = new graphql.GraphQLObjectType({
7878
name: 'User',
7979
fields: {
8080
id: { type: graphql.GraphQLString },
@@ -83,7 +83,7 @@ var userType = new graphql.GraphQLObjectType({
8383
});
8484

8585
// Define the Query type
86-
var queryType = new graphql.GraphQLObjectType({
86+
const queryType = new graphql.GraphQLObjectType({
8787
name: 'Query',
8888
fields: {
8989
user: {
@@ -99,9 +99,9 @@ var queryType = new graphql.GraphQLObjectType({
9999
},
100100
});
101101

102-
var schema = new graphql.GraphQLSchema({ query: queryType });
102+
const schema = new graphql.GraphQLSchema({ query: queryType });
103103

104-
var app = express();
104+
const app = express();
105105
app.all(
106106
'/graphql',
107107
createHandler({

website/pages/error.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ GraphQL errors. You can import either from the `graphql/error` module, or from t
1111

1212
```js
1313
import { GraphQLError } from 'graphql'; // ES6
14-
var { GraphQLError } = require('graphql'); // CommonJS
14+
const { GraphQLError } = require('graphql'); // CommonJS
1515
```
1616

1717
## Overview

website/pages/execution.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fulfilling a GraphQL request. You can import either from the `graphql/execution`
1111

1212
```js
1313
import { execute } from 'graphql'; // ES6
14-
var { execute } = require('graphql'); // CommonJS
14+
const { execute } = require('graphql'); // CommonJS
1515
```
1616

1717
## Overview

website/pages/going-to-production.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Enabling Defer & Stream
2+
title: Going to Production
33
---
44

55
The `@defer` and `@stream` directives are not enabled by default. In order to use these directives, you must add them to your GraphQL Schema and use the `experimentalExecuteIncrementally` function instead of `execute`.

website/pages/graphql.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ of GraphQL type systems and servers.
1111

1212
```js
1313
import { graphql } from 'graphql'; // ES6
14-
var { graphql } = require('graphql'); // CommonJS
14+
const { graphql } = require('graphql'); // CommonJS
1515
```
1616

1717
## Overview
@@ -95,27 +95,27 @@ var { graphql } = require('graphql'); // CommonJS
9595
<ul className="apiIndex">
9696
<li>
9797
<a href="../type/#graphqlint">
98-
`var GraphQLInt` A scalar type representing integers.
98+
`const GraphQLInt` A scalar type representing integers.
9999
</a>
100100
</li>
101101
<li>
102102
<a href="../type/#graphqlfloat">
103-
`var GraphQLFloat` A scalar type representing floats.
103+
`const GraphQLFloat` A scalar type representing floats.
104104
</a>
105105
</li>
106106
<li>
107107
<a href="../type/#graphqlstring">
108-
`var GraphQLString` A scalar type representing strings.
108+
`const GraphQLString` A scalar type representing strings.
109109
</a>
110110
</li>
111111
<li>
112112
<a href="../type/#graphqlboolean">
113-
`var GraphQLBoolean` A scalar type representing booleans.
113+
`const GraphQLBoolean` A scalar type representing booleans.
114114
</a>
115115
</li>
116116
<li>
117117
<a href="../type/#graphqlid">
118-
`var GraphQLID` A scalar type representing IDs.
118+
`const GraphQLID` A scalar type representing IDs.
119119
</a>
120120
</li>
121121
</ul>

website/pages/language.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The `graphql/language` module is responsible for parsing and operating on the Gr
1010

1111
```js
1212
import { Source } from 'graphql'; // ES6
13-
var { Source } = require('graphql'); // CommonJS
13+
const { Source } = require('graphql'); // CommonJS
1414
```
1515

1616
## Overview
@@ -56,7 +56,7 @@ var { Source } = require('graphql'); // CommonJS
5656
</li>
5757
<li>
5858
<a href="#kind">
59-
`var Kind` Represents the various kinds of parsed AST nodes.
59+
`const Kind` Represents the various kinds of parsed AST nodes.
6060
</a>
6161
</li>
6262
</ul>
@@ -72,7 +72,7 @@ var { Source } = require('graphql'); // CommonJS
7272
</li>
7373
<li>
7474
<a href="#break">
75-
`var BREAK` A token to allow breaking out of the visitor.
75+
`const BREAK` A token to allow breaking out of the visitor.
7676
</a>
7777
</li>
7878
</ul>
@@ -198,7 +198,7 @@ a new version of the AST with the changes applied will be returned from the
198198
visit function.
199199

200200
```js
201-
var editedAST = visit(ast, {
201+
const editedAST = visit(ast, {
202202
enter(node, key, parent, path, ancestors) {
203203
// @return
204204
// undefined: no action

0 commit comments

Comments
 (0)