8000 Remove CJS from docs (#4400) · sarahxsanders/graphql-js@dd53d99 · GitHub
[go: up one dir, main page]

Skip to content

Commit dd53d99

Browse files
authored
Remove CJS from docs (graphql#4400)
1 parent 3f5858b commit dd53d99

21 files changed

+107
-115
lines changed

website/pages/api-v16/error.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ The `graphql/error` module is responsible for creating and formatting
1010
GraphQL errors. You can import either from the `graphql/error` module, or from the root `graphql` module. For example:
1111

1212
```js
13-
import { GraphQLError } from 'graphql'; // ES6
14-
const { GraphQLError } = require('graphql'); // CommonJS
13+
import { GraphQLError } from 'graphql';
1514
```
1615

1716
## Overview

website/pages/api-v16/execution.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ The `graphql/execution` module is responsible for the execution phase of
1010
fulfilling a GraphQL request. You can import either from the `graphql/execution` module, or from the root `graphql` module. For example:
1111

1212
```js
13-
import { execute } from 'graphql'; // ES6
14-
const { execute } = require('graphql'); // CommonJS
13+
import { execute } from 'graphql';
1514
```
1615

1716
## Overview

website/pages/api-v16/graphql-http.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ The [official `graphql-http` package](https://github.com/graphql/graphql-http) p
1111
## Express
1212

1313
```js
14-
import { createHandler } from 'graphql-http/lib/use/express'; // ES6
15-
const { createHandler } = require('graphql-http/lib/use/express'); // CommonJS
14+
import { createHandler } from 'graphql-http/lib/use/express';
1615
```
1716

1817
### createHandler

website/pages/api-v16/graphql.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ The `graphql` module exports a core subset of GraphQL functionality for creation
1010
of GraphQL type systems and servers.
1111

1212
```js
13-
import { graphql } from 'graphql'; // ES6
14-
const { graphql } = require('graphql'); // CommonJS
13+
import { graphql } from 'graphql';
1514
```
1615

1716
## Overview

website/pages/api-v16/language.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ title: graphql/language
99
The `graphql/language` module is responsible for parsing and operating on the GraphQL language. You can import either from the `graphql/language` module, or from the root `graphql` module. For example:
1010

1111
```js
12-
import { Source } from 'graphql'; // ES6
13-
const { Source } = require('graphql'); // CommonJS
12+
import { Source } from 'graphql';
1413
```
1514

1615
## Overview

website/pages/api-v16/type.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ title: graphql/type
99
The `graphql/type` module is responsible for defining GraphQL types and schema. You can import either from the `graphql/type` module, or from the root `graphql` module. For example:
1010

1111
```js
12-
import { GraphQLSchema } from 'graphql'; // ES6
13-
const { GraphQLSchema } = require('graphql'); // CommonJS
12+
import { GraphQLSchema } from 'graphql';
1413
```
1514

1615
## Overview

website/pages/api-v16/utilities.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ The `graphql/utilities` module contains common useful computations to use with
1010
the GraphQL language and type objects. You can import either from the `graphql/utilities` module, or from the root `graphql` module. For example:
1111

1212
```js
13-
import { introspectionQuery } from 'graphql'; // ES6
14-
const { introspectionQuery } = require('graphql'); // CommonJS
13+
import { introspectionQuery } from 'graphql';
1514
```
1615

1716
## Overview

website/pages/api-v16/validation.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ The `graphql/validation` module fulfills the Validation phase of fulfilling a
1010
GraphQL result. You can import either from the `graphql/validation` module, or from the root `graphql` module. For example:
1111

1212
```js
13-
import { validate } from 'graphql/validation'; // ES6
14-
const { validate } = require('graphql/validation'); // CommonJS
13+
import { validate } from 'graphql/validation';
1514
```
1615

1716
## Overview

website/pages/docs/abstract-types.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ concrete type a given value corresponds to.
3636
The following example defines a `ContentItem` interface for a publishing platform:
3737

3838
```js
39-
const { GraphQLInterfaceType, GraphQLString, GraphQLNonNull } = require('graphql');
39+
import { GraphQLInterfaceType, GraphQLString, GraphQLNonNull } from 'graphql';
4040

4141
const ContentItemInterface = new GraphQLInterfaceType({
4242
name: 'ContentItem',
@@ -69,7 +69,7 @@ The following example implements the `Article` and `PodcastEpisode` types that
6969
conform to the `ContentItem` interface:
7070

7171
```js
72-
const { GraphQLObjectType, GraphQLString, GraphQLNonNull } = require('graphql');
72+
import { GraphQLObjectType, GraphQLString, GraphQLNonNull } from 'graphql';
7373

7474
const ArticleType = new GraphQLObjectType({
7575
name: 'Article',
@@ -114,7 +114,7 @@ A union requires:
114114
The following example defines a `SearchResult` union:
115115

116116
```js
117-
const { GraphQLUnionType } = require('graphql');
117+
import { GraphQLUnionType } from 'graphql';
118118

119119
const SearchResultType = new GraphQLUnionType({
120120
name: 'SearchResult',
@@ -134,7 +134,7 @@ const SearchResultType = new GraphQLUnionType({
134134
});
135135
```
136136

137-
Unlike interfaces, unions dont declare any fields of their own. Clients use inline fragments
137+
Unlike interfaces, unions don't declare any fields of their own. Clients use inline fragments
138138
to query fields from the concrete types.
139139

140140
## Resolving abstract types at runtime

website/pages/docs/advanced-custom-scalars.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ schema, follow these best practices.
99

1010
### Document expected formats and validation
1111

12-
Provide a clear description of the scalars accepted input and output formats. For example, a
12+
Provide a clear description of the scalar's accepted input and output formats. For example, a
1313
`DateTime` scalar should explain that it expects [ISO-8601](https://www.iso.org/iso-8601-date-and-time-format.html) strings ending with `Z`.
1414

1515
Clear descriptions help clients understand valid input and reduce mistakes.
@@ -100,8 +100,8 @@ describe('DateTime scalar', () => {
100100
Integrate the scalar into a schema and run real GraphQL queries to validate end-to-end behavior.
101101

102102
```js
103-
const { graphql, GraphQLSchema, GraphQLObjectType } = require('graphql');
104-
const { DateTimeResolver as DateTime } = require('graphql-scalars');
103+
import { graphql, GraphQLSchema, GraphQLObjectType } from 'graphql';
104+
import { DateTimeResolver as DateTime } from 'graphql-scalars';
105105

106106
const Query = new GraphQLObjectType({
107107
name: 'Query',
@@ -184,13 +184,13 @@ scalars for DateTime, EmailAddress, URL, UUID, and many others.
184184
### Example: Handling email validation
185185

186186
Handling email validation correctly requires dealing with Unicode, quoted local parts, and
187-
domain validation. Rather than writing your own regex, its better to use a library scalar
187+
domain validation. Rather than writing your own regex, it's better to use a library scalar
188188
that's already validated against standards.
189189

190190
If you need domain-specific behavior, you can wrap an existing scalar with custom rules:
191191

192192
```js
193-
const { EmailAddressResolver } = require('graphql-scalars');
193+
import { EmailAddressResolver } from 'graphql-scalars';
194194

195195
const StrictEmailAddress = new GraphQLScalarType({
196196
...EmailAddressResolver,

0 commit comments

Comments
 (0)
0