Skip to content

Commit 63345de

Browse files
committed
fix git status
1 parent 668f3dc commit 63345de

File tree

4 files changed

+34
-31
lines changed

4 files changed

+34
-31
lines changed

src/execution/__tests__/semantic-nullability-test.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import { expect } from 'chai';
22
import { describe, it } from 'mocha';
3+
4+
import { GraphQLError } from '../../error/GraphQLError';
5+
6+
import type { ExecutableDefinitionNode, FieldNode } from '../../language/ast';
37
import { parse } from '../../language/parser';
8+
49
import { GraphQLNonNull, GraphQLObjectType, GraphQLSemanticNonNull, GraphQLSemanticNullable } from '../../type/definition';
5-
import { execute } from '../execute';
6-
import { GraphQLSchema } from '../../type/schema';
710
import { GraphQLString } from '../../type/scalars';
8-
import { ExecutableDefinitionNode, FieldNode } from '../../language';
9-
import { GraphQLError } from '../../error/GraphQLError';
11+
import { GraphQLSchema } from '../../type/schema';
12+
13+
import { execute } from '../execute';
1014

1115
describe('Execute: Handles Semantic Nullability', () => {
1216
const DeepDataType = new GraphQLObjectType({
@@ -45,8 +49,8 @@ describe('Execute: Handles Semantic Nullability', () => {
4549
rootValue: data,
4650
});
4751

48-
let executable = document.definitions?.values().next().value as ExecutableDefinitionNode;
49-
let selectionSet = executable.selectionSet.selections.values().next().value;
52+
const executable = document.definitions?.values().next().value as ExecutableDefinitionNode;
53+
const selectionSet = executable.selectionSet.selections.values().next().value;
5054

5155
expect(result).to.deep.equal({
5256
data: {
@@ -68,7 +72,7 @@ describe('Execute: Handles Semantic Nullability', () => {
6872
const data = {
6973
a: () => 'Apple',
7074
b: () => { throw new Error(
71-
`Something went wrong`,
75+
'Something went wrong',
7276
); },
7377
c: () => 'Cookie'
7478
};
@@ -79,8 +83,8 @@ describe('Execute: Handles Semantic Nullability', () => {
7983
}
8084
`);
8185

82-
let executable = document.definitions?.values().next().value as ExecutableDefinitionNode;
83-
let selectionSet = executable.selectionSet.selections.values().next().value;
86+
const executable = document.definitions?.values().next().value as ExecutableDefinitionNode;
87+
const selectionSet = executable.selectionSet.selections.values().next().value;
8488

8589
const result = await execute({
8690
schema: new GraphQLSchema({ query: DataType }),
@@ -131,9 +135,9 @@ describe('Execute: Handles Semantic Nullability', () => {
131135
rootValue: data,
132136
});
133137

134-
let executable = document.definitions?.values().next().value as ExecutableDefinitionNode;
135-
let dSelectionSet = executable.selectionSet.selections.values().next().value as FieldNode;
136-
let fSelectionSet = dSelectionSet.selectionSet?.selections.values().next().value;
138+
const executable = document.definitions?.values().next().value as ExecutableDefinitionNode;
139+
const dSelectionSet = executable.selectionSet.selections.values().next().value as FieldNode;
140+
const fSelectionSet = dSelectionSet.selectionSet?.selections.values().next().value;
137141

138142
expect(result).to.deep.equal({
139143
data: {

src/language/__tests__/parser-test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { Kind } from '../kinds';
1111
import { parse, parseConstValue, parseType, parseValue } from '../parser';
1212
import { Source } from '../source';
1313
import { TokenKind } from '../tokenKind';
14-
import { Console } from 'console';
1514

1615
function expectSyntaxError(text: string) {
1716
return expectToThrowJSON(() => parse(text));

src/language/parser.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,9 @@ export class Parser {
254254
*/
255255
parseDefinition(): DefinitionNode {
256256
// TODO: I don't know what isConst represents. Every other callsite has it false
257-
let directives = this.parseDirectives(false);
258-
for (let directive of directives) {
259-
if (directive.name.value == "SemanticNullability") {
257+
const directives = this.parseDirectives(false);
258+
for (const directive of directives) {
259+
if (directive.name.value === 'SemanticNullability') {
260260
this._options.useSemanticNullability = true;
261261
}
262262
}
@@ -779,22 +779,22 @@ export class Parser {
779779
kind: Kind.SEMANTIC_NULLABLE_TYPE,
780780
type,
781781
});
782-
} else {
783-
return this.node<SemanticNonNullTypeNode>(start, {
784-
kind: Kind.SEMANTIC_NON_NULL_TYPE,
785-
type,
786-
});
787782
}
788-
} else {
789-
if (this.expectOptionalToken(TokenKind.BANG)) {
790-
return this.node<NonNullTypeNode>(start, {
791-
kind: Kind.NON_NULL_TYPE,
792-
type,
793-
});
794-
}
795-
796-
return type;
783+
784+
return this.node<SemanticNonNullTypeNode>(start, {
785+
kind: Kind.SEMANTIC_NON_NULL_TYPE,
786+
type,
787+
});
788+
}
789+
790+
if (this.expectOptionalToken(TokenKind.BANG)) {
791+
return this.node<NonNullTypeNode>(start, {
792+
kind: Kind.NON_NULL_TYPE,
793+
type,
794+
});
797795
}
796+
797+
return type;
798798
}
799799

800800
/**

src/language/printer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface PrintOptions {
1717
* Converts an AST into a string, using one set of reasonable
1818
* formatting rules.
1919
*/
20-
export function print(ast: ASTNode, options: PrintOptions = {}): string {
20+
export function print(ast: ASTNode): string {
2121
return visit(ast, printDocASTReducer);
2222
}
2323

0 commit comments

Comments
 (0)