Skip to content

Commit 12b541b

Browse files
committed
Merge branch 'main' into tsdoc-eslint
2 parents 1419b6a + 40db639 commit 12b541b

32 files changed

+389
-216
lines changed

.eslintrc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,8 @@ overrides:
603603
'@typescript-eslint/no-use-before-define': off
604604
'@typescript-eslint/no-duplicate-imports': off # Superseded by `import/no-duplicates`
605605

606-
# Bellow rules are disabled because coflicts with Prettier, see:
607-
# https://github.com/prettier/eslint-config-prettier/blob/master/%40typescript-eslint.js
606+
# Below rules are disabled because they conflict with Prettier, see:
607+
# https://github.com/prettier/eslint-config-prettier/blob/main/index.js
608608
'@typescript-eslint/object-curly-spacing': off
609609
'@typescript-eslint/quotes': off
610610
'@typescript-eslint/brace-style': off

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
uses: actions/checkout@v2
1212

1313
- name: Setup Node.js
14-
uses: actions/setup-node@v1
14+
uses: actions/setup-node@v2
1515
with:
1616
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
1717

@@ -63,7 +63,7 @@ jobs:
6363
uses: actions/checkout@v2
6464

6565
- name: Setup Node.js
66-
uses: actions/setup-node@v1
66+
uses: actions/setup-node@v2
6767
with:
6868
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
6969

@@ -81,7 +81,7 @@ jobs:
8181
uses: actions/checkout@v2
8282

8383
- name: Setup Node.js
84-
uses: actions/setup-node@v1
84+
uses: actions/setup-node@v2
8585
with:
8686
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
8787

@@ -101,7 +101,7 @@ jobs:
101101
uses: actions/checkout@v2
102102

103103
- name: Setup Node.js
104-
uses: actions/setup-node@v1
104+
uses: actions/setup-node@v2
105105
with:
106106
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
107107

@@ -127,7 +127,7 @@ jobs:
127127
uses: actions/checkout@v2
128128

129129
- name: Setup Node.js
130-
uses: actions/setup-node@v1
130+
uses: actions/setup-node@v2
131131
with:
132132
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
133133

@@ -163,7 +163,7 @@ jobs:
163163
uses: actions/checkout@v2
164164

165165
- name: Setup Node.js v${{ matrix.node_version_to_setup }}
166-
uses: actions/setup-node@v1
166+
uses: actions/setup-node@v2
167167
with:
168168
node-version: ${{ matrix.node_version_to_setup }}
169169

@@ -191,7 +191,7 @@ jobs:
191191
fetch-depth: 2
192192

193193
- name: Setup Node.js
194-
uses: actions/setup-node@v1
194+
uses: actions/setup-node@v2
195195
with:
196196
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
197197

@@ -222,7 +222,7 @@ jobs:
222222
uses: actions/checkout@v2
223223

224224
- name: Setup Node.js
225-
uses: actions/setup-node@v1
225+
uses: actions/setup-node@v2
226226
with:
227227
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
228228

@@ -258,7 +258,7 @@ jobs:
258258
uses: actions/checkout@v2
259259

260260
- name: Setup Node.js
261-
uses: actions/setup-node@v1
261+
uses: actions/setup-node@v2
262262
with:
263263
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
264264

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphql",
3-
"version": "16.0.0-alpha.3",
3+
"version": "16.0.0-alpha.4",
44
"description": "A Query Language and Runtime which can target any service.",
55
"license": "MIT",
66
"private": true,

src/__testUtils__/__tests__/genFuzzStrings-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { describe, it } from 'mocha';
44
import { genFuzzStrings } from '../genFuzzStrings';
55

66
function expectFuzzStrings(options: {
7-
allowedChars: Array<string>;
7+
allowedChars: ReadonlyArray<string>;
88
maxLength: number;
99
}) {
1010
return expect([...genFuzzStrings(options)]);

src/__testUtils__/genFuzzStrings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Generator that produces all possible combinations of allowed characters.
33
*/
44
export function* genFuzzStrings(options: {
5-
allowedChars: Array<string>;
5+
allowedChars: ReadonlyArray<string>;
66
maxLength: number;
77
}): Generator<string, void, void> {
88
const { allowedChars, maxLength } = options;

src/__testUtils__/kitchenSinkQuery.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ mutation likeStory @onMutation {
2828
}
2929
}
3030
31-
subscription StoryLikeSubscription($input: StoryLikeSubscribeInput)
31+
subscription StoryLikeSubscription(
32+
$input: StoryLikeSubscribeInput @onVariableDefinition
33+
)
3234
@onSubscription {
3335
storyLikeSubscribe(input: $input) {
3436
story {

src/__tests__/starWarsData.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@
55
export interface Character {
66
id: string;
77
name: string;
8-
friends: Array<string>;
9-
appearsIn: Array<number>;
8+
friends: ReadonlyArray<string>;
9+
appearsIn: ReadonlyArray<number>;
1010
}
1111

1212
export interface Human {
1313
type: 'Human';
1414
id: string;
1515
name: string;
16-
friends: Array<string>;
17-
appearsIn: Array<number>;
16+
friends: ReadonlyArray<string>;
17+
appearsIn: ReadonlyArray<number>;
1818
homePlanet?: string;
1919
}
2020

2121
export interface Droid {
2222
type: 'Droid';
2323
id: string;
2424
name: string;
25-
friends: Array<string>;
26-
appearsIn: Array<number>;
25+
friends: ReadonlyArray<string>;
26+
appearsIn: ReadonlyArray<number>;
2727
primaryFunction: string;
2828
}
2929

src/execution/__tests__/lists-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('Execute: Accepts any iterable as list value', () => {
3737
});
3838

3939
it('Accepts function arguments as a List value', () => {
40-
function getArgs(..._args: Array<string>) {
40+
function getArgs(..._args: ReadonlyArray<string>) {
4141
return arguments;
4242
}
4343
const listField = getArgs('one', 'two');

src/execution/__tests__/union-interface-test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Dog {
1919
barks: boolean;
2020
mother?: Dog;
2121
father?: Dog;
22-
progeny: Array<Dog>;
22+
progeny: ReadonlyArray<Dog>;
2323

2424
constructor(name: string, barks: boolean) {
2525
this.name = name;
@@ -33,7 +33,7 @@ class Cat {
3333
meows: boolean;
3434
mother?: Cat;
3535
father?: Cat;
36-
progeny: Array<Cat>;
36+
progeny: ReadonlyArray<Cat>;
3737

3838
constructor(name: string, meows: boolean) {
3939
this.name = name;
@@ -44,13 +44,13 @@ class Cat {
4444

4545
class Person {
4646
name: string;
47-
pets?: Array<Dog | Cat>;
48-
friends?: Array<Dog | Cat | Person>;
47+
pets?: ReadonlyArray<Dog | Cat>;
48+
friends?: ReadonlyArray<Dog | Cat | Person>;
4949

5050
constructor(
5151
name: string,
52-
pets?: Array<Dog | Cat>,
53-
friends?: Array<Dog | Cat | Person>,
52+
pets?: ReadonlyArray<Dog | Cat>,
53+
friends?: ReadonlyArray<Dog | Cat | Person>,
5454
) {
5555
this.name = name;
5656
this.pets = pets;

src/execution/execute.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ function executeFieldsSerially(
375375
parentType: GraphQLObjectType,
376376
sourceValue: unknown,
377377
path: Path | undefined,
378-
fields: Map<string, Array<FieldNode>>,
378+
fields: Map<string, ReadonlyArray<FieldNode>>,
379379
): PromiseOrValue<ObjMap<unknown>> {
380380
return promiseReduce(
381381
fields.entries(),
@@ -413,7 +413,7 @@ function executeFields(
413413
parentType: GraphQLObjectType,
414414
sourceValue: unknown,
415415
path: Path | undefined,
416-
fields: Map<string, Array<FieldNode>>,
416+
fields: Map<string, ReadonlyArray<FieldNode>>,
417417
): PromiseOrValue<ObjMap<unknown>> {
418418
const results = Object.create(null);
419419
let containsPromise = false;
@@ -463,7 +463,7 @@ export function collectFields(
463463
selectionSet: SelectionSetNode,
464464
fields: Map<string, Array<FieldNode>>,
465465
visitedFragmentNames: Set<string>,
466-
): Map<string, Array<FieldNode>> {
466+
): Map<string, ReadonlyArray<FieldNode>> {
467467
for (const selection of selectionSet.selections) {
468468
switch (selection.kind) {
469469
case Kind.FIELD: {
@@ -1075,7 +1075,7 @@ function _collectSubfields(
10751075
exeContext: ExecutionContext,
10761076
returnType: GraphQLObjectType,
10771077
fieldNodes: ReadonlyArray<FieldNode>,
1078-
): Map<string, Array<FieldNode>> {
1078+
): Map<string, ReadonlyArray<FieldNode>> {
10791079
let subFieldNodes = new Map();
10801080
const visitedFragmentNames = new Set<string>();
10811081
for (const node of fieldNodes) {

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export type {
139139
GraphQLNamedType,
140140
GraphQLNamedInputType,
141141
GraphQLNamedOutputType,
142-
ThunkArray,
142+
ThunkReadonlyArray,
143143
ThunkObjMap,
144144
GraphQLSchemaConfig,
145145
GraphQLSchemaExtensions,

src/jsutils/__tests__/suggestionList-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { describe, it } from 'mocha';
33

44
import { suggestionList } from '../suggestionList';
55

6-
function expectSuggestions(input: string, options: Array<string>) {
6+
function expectSuggestions(input: string, options: ReadonlyArray<string>) {
77
return expect(suggestionList(input, options));
88
}
99

src/jsutils/inspect.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export function inspect(value: unknown): string {
88
return formatValue(value, []);
99
}
1010

11-
function formatValue(value: unknown, seenValues: Array<unknown>): string {
11+
function formatValue(
12+
value: unknown,
13+
seenValues: ReadonlyArray<unknown>,
14+
): string {
1215
switch (typeof value) {
1316
case 'string':
1417
return JSON.stringify(value);
@@ -23,7 +26,7 @@ function formatValue(value: unknown, seenValues: Array<unknown>): string {
2326

2427
function formatObjectValue(
2528
value: object | null,
26-
previouslySeenValues: Array<unknown>,
29+
previouslySeenValues: ReadonlyArray<unknown>,
2730
): string {
2831
if (value === null) {
2932
return 'null';
@@ -55,7 +58,10 @@ function isJSONable(value: any): value is { toJSON: () => unknown } {
5558
return typeof value.toJSON === 'function';
5659
}
5760

58-
function formatObject(object: object, seenValues: Array<unknown>): string {
61+
function formatObject(
62+
object: object,
63+
seenValues: ReadonlyArray<unknown>,
64+
): string {
5965
const entries = Object.entries(object);
6066
if (entries.length === 0) {
6167
return '{}';
@@ -72,8 +78,8 @@ function formatObject(object: object, seenValues: Array<unknown>): string {
7278
}
7379

7480
function formatArray(
75-
array: Array<unknown>,
76-
seenValues: Array<unknown>,
81+
array: ReadonlyArray<unknown>,
82+
seenValues: ReadonlyArray<unknown>,
7783
): string {
7884
if (array.length === 0) {
7985
return '[]';

src/language/__tests__/blockString-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
printBlockString,
88
} from '../blockString';
99

10-
function joinLines(...args: Array<string>) {
10+
function joinLines(...args: ReadonlyArray<string>) {
1111
return args.join('\n');
1212
}
1313

src/language/__tests__/printer-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ describe('Printer: Query document', () => {
182182
}
183183
}
184184
185-
subscription StoryLikeSubscription($input: StoryLikeSubscribeInput) @onSubscription {
185+
subscription StoryLikeSubscription($input: StoryLikeSubscribeInput @onVariableDefinition) @onSubscription {
186186
storyLikeSubscribe(input: $input) {
187187
story {
188188
likers {

src/language/__tests__/visitor-test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,10 @@ describe('Visitor', () => {
747747
['enter', 'Name', 'name', 'NamedType'],
748748
['leave', 'Name', 'name', 'NamedType'],
749749
['leave', 'NamedType', 'type', 'VariableDefinition'],
750+
['enter', 'Directive', 0, undefined],
751+
['enter', 'Name', 'name', 'Directive'],
752+
['leave', 'Name', 'name', 'Directive'],
753+
['leave', 'Directive', 0, undefined],
750754
['leave', 'VariableDefinition', 0, undefined],
751755
['enter', 'Directive', 0, undefined],
752756
['enter', 'Name', 'name', 'Directive'],

src/type/__tests__/validation-test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function withModifiers<T extends GraphQLNamedType>(
7979
];
8080
}
8181

82-
const outputTypes: Array<GraphQLOutputType> = [
82+
const outputTypes: ReadonlyArray<GraphQLOutputType> = [
8383
...withModifiers(GraphQLString),
8484
...withModifiers(SomeScalarType),
8585
...withModifiers(SomeEnumType),
@@ -88,18 +88,18 @@ const outputTypes: Array<GraphQLOutputType> = [
8888
...withModifiers(SomeInterfaceType),
8989
];
9090

91-
const notOutputTypes: Array<GraphQLInputType> = [
91+
const notOutputTypes: ReadonlyArray<GraphQLInputType> = [
9292
...withModifiers(SomeInputObjectType),
9393
];
9494

95-
const inputTypes: Array<GraphQLInputType> = [
95+
const inputTypes: ReadonlyArray<GraphQLInputType> = [
9696
...withModifiers(GraphQLString),
9797
...withModifiers(SomeScalarType),
9898
...withModifiers(SomeEnumType),
9999
...withModifiers(SomeInputObjectType),
100100
];
101101

102-
const notInputTypes: Array<GraphQLOutputType> = [
102+
const notInputTypes: ReadonlyArray<GraphQLOutputType> = [
103103
...withModifiers(SomeObjectType),
104104
...withModifiers(SomeUnionType),
105105
...withModifiers(SomeInterfaceType),

0 commit comments

Comments
 (0)