Skip to content

More fixes to make spellchecker happy #2296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ first ensure the query is syntactically and semantically valid before executing
it, reporting errors otherwise.

```js
var query = '{ boyhowdy }';
var query = '{ BoyHowdy }';

graphql(schema, query).then(result => {
// Prints
// {
// errors: [
// { message: 'Cannot query field boyhowdy on RootQueryType',
// { message: 'Cannot query field BoyHowdy on RootQueryType',
// locations: [ { line: 1, column: 3 } ] }
// ]
// }
Expand Down
16 changes: 8 additions & 8 deletions src/language/printLocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ export function printSourceLocation(

// Special case for minified documents
if (locationLine.length > 120) {
const sublineIndex = Math.floor(columnNum / 80);
const sublineColumnNum = columnNum % 80;
const sublines = [];
const subLineIndex = Math.floor(columnNum / 80);
const subLineColumnNum = columnNum % 80;
const subLines = [];
for (let i = 0; i < locationLine.length; i += 80) {
sublines.push(locationLine.slice(i, i + 80));
subLines.push(locationLine.slice(i, i + 80));
}

return (
locationStr +
printPrefixedLines([
[`${lineNum}`, sublines[0]],
...sublines.slice(1, sublineIndex + 1).map(subline => ['', subline]),
[' ', whitespace(sublineColumnNum - 1) + '^'],
['', sublines[sublineIndex + 1]],
[`${lineNum}`, subLines[0]],
...subLines.slice(1, subLineIndex + 1).map(subLine => ['', subLine]),
[' ', whitespace(subLineColumnNum - 1) + '^'],
['', subLines[subLineIndex + 1]],
])
);
}
Expand Down
24 changes: 12 additions & 12 deletions src/type/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,47 +328,47 @@ export type GraphQLSchemaConfig = {|
function collectImplementations(
types: $ReadOnlyArray<GraphQLNamedType>,
): ObjMap<InterfaceImplementations> {
const implementations = Object.create(null);
const implementationsMap = Object.create(null);

for (const type of types) {
if (isInterfaceType(type)) {
if (implementations[type.name] === undefined) {
implementations[type.name] = { objects: [], interfaces: [] };
if (implementationsMap[type.name] === undefined) {
implementationsMap[type.name] = { objects: [], interfaces: [] };
}

// Store implementations by interface.
for (const iface of type.getInterfaces()) {
if (isInterfaceType(iface)) {
const impls = implementations[iface.name];
if (impls === undefined) {
implementations[iface.name] = {
const implementations = implementationsMap[iface.name];
if (implementations === undefined) {
implementationsMap[iface.name] = {
objects: [],
interfaces: [type],
};
} else {
impls.interfaces.push(type);
implementations.interfaces.push(type);
}
}
}
} else if (isObjectType(type)) {
// Store implementations by objects.
for (const iface of type.getInterfaces()) {
if (isInterfaceType(iface)) {
const impls = implementations[iface.name];
if (impls === undefined) {
implementations[iface.name] = {
const implementations = implementationsMap[iface.name];
if (implementations === undefined) {
implementationsMap[iface.name] = {
objects: [type],
interfaces: [],
};
} else {
impls.objects.push(type);
implementations.objects.push(type);
}
}
}
}
}

return implementations;
return implementationsMap;
}

function typeMapReducer(map: TypeMap, type: ?GraphQLType): TypeMap {
Expand Down
8 changes: 4 additions & 4 deletions src/utilities/__tests__/buildASTSchema-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,16 +649,16 @@ describe('Schema Builder', () => {

it('Unreferenced type implementing referenced interface', () => {
const sdl = dedent`
type Concrete implements Iface {
type Concrete implements Interface {
key: String
}

interface Iface {
interface Interface {
key: String
}

type Query {
iface: Iface
interface: Interface
}
`;
expect(cycleSDL(sdl)).to.equal(sdl);
Expand All @@ -675,7 +675,7 @@ describe('Schema Builder', () => {
}

type Query {
iface: Parent
interfaceField: Parent
}
`;
expect(cycleSDL(sdl)).to.equal(sdl);
Expand Down
32 changes: 16 additions & 16 deletions src/utilities/extendSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,28 +108,28 @@ export function extendSchema(

// Collect the type definitions and extensions found in the document.
const typeDefs = [];
const typeExtsMap = Object.create(null);
const typeExtensionsMap = Object.create(null);

// New directives and types are separate because a directives and types can
// have the same name. For example, a type named "skip".
const directiveDefs: Array<DirectiveDefinitionNode> = [];

let schemaDef: ?SchemaDefinitionNode;
// Schema extensions are collected which may add additional operation types.
const schemaExts: Array<SchemaExtensionNode> = [];
const schemaExtensions: Array<SchemaExtensionNode> = [];

for (const def of documentAST.definitions) {
if (def.kind === Kind.SCHEMA_DEFINITION) {
schemaDef = def;
} else if (def.kind === Kind.SCHEMA_EXTENSION) {
schemaExts.push(def);
schemaExtensions.push(def);
} else if (isTypeDefinitionNode(def)) {
typeDefs.push(def);
} else if (isTypeExtensionNode(def)) {
const extendedTypeName = def.name.value;
const existingTypeExts = typeExtsMap[extendedTypeName];
typeExtsMap[extendedTypeName] = existingTypeExts
? existingTypeExts.concat([def])
const existingTypeExtensions = typeExtensionsMap[extendedTypeName];
typeExtensionsMap[extendedTypeName] = existingTypeExtensions
? existingTypeExtensions.concat([def])
: [def];
} else if (def.kind === Kind.DIRECTIVE_DEFINITION) {
directiveDefs.push(def);
Expand All @@ -139,10 +139,10 @@ export function extendSchema(
// If this document contains no new types, extensions, or directives then
// return the same unmodified GraphQLSchema instance.
if (
Object.keys(typeExtsMap).length === 0 &&
Object.keys(typeExtensionsMap).length === 0 &&
typeDefs.length === 0 &&
directiveDefs.length === 0 &&
schemaExts.length === 0 &&
schemaExtensions.length === 0 &&
!schemaDef
) {
return schema;
Expand Down Expand Up @@ -170,7 +170,7 @@ export function extendSchema(
schemaConfig.subscription && replaceNamedType(schemaConfig.subscription),
// Then, incorporate schema definition and all schema extensions.
...astBuilder.getOperationTypes(
concatMaybeArrays(schemaDef && [schemaDef], schemaExts) || [],
concatMaybeArrays(schemaDef && [schemaDef], schemaExtensions) || [],
),
};

Expand All @@ -185,7 +185,7 @@ export function extendSchema(
astNode: schemaDef || schemaConfig.astNode,
extensionASTNodes: concatMaybeArrays(
schemaConfig.extensionASTNodes,
schemaExts,
schemaExtensions,
),
});

Expand Down Expand Up @@ -248,7 +248,7 @@ export function extendSchema(
type: GraphQLInputObjectType,
): GraphQLInputObjectType {
const config = type.toConfig();
const extensions = typeExtsMap[config.name] || [];
const extensions = typeExtensionsMap[config.name] || [];

return new GraphQLInputObjectType({
...config,
Expand All @@ -269,7 +269,7 @@ export function extendSchema(

function extendEnumType(type: GraphQLEnumType): GraphQLEnumType {
const config = type.toConfig();
const extensions = typeExtsMap[type.name] || [];
const extensions = typeExtensionsMap[type.name] || [];

return new GraphQLEnumType({
...config,
Expand All @@ -287,7 +287,7 @@ export function extendSchema(

function extendScalarType(type: GraphQLScalarType): GraphQLScalarType {
const config = type.toConfig();
const extensions = typeExtsMap[config.name] || [];
const extensions = typeExtensionsMap[config.name] || [];

return new GraphQLScalarType({
...config,
Expand All @@ -300,7 +300,7 @@ export function extendSchema(

function extendObjectType(type: GraphQLObjectType): GraphQLObjectType {
const config = type.toConfig();
const extensions = typeExtsMap[config.name] || [];
const extensions = typeExtensionsMap[config.name] || [];

return new GraphQLObjectType({
...config,
Expand All @@ -324,7 +324,7 @@ export function extendSchema(
type: GraphQLInterfaceType,
): GraphQLInterfaceType {
const config = type.toConfig();
const extensions = typeExtsMap[config.name] || [];
const extensions = typeExtensionsMap[config.name] || [];

return new GraphQLInterfaceType({
...config,
Expand All @@ -346,7 +346,7 @@ export function extendSchema(

function extendUnionType(type: GraphQLUnionType): GraphQLUnionType {
const config = type.toConfig();
const extensions = typeExtsMap[config.name] || [];
const extensions = typeExtensionsMap[config.name] || [];

return new GraphQLUnionType({
...config,
Expand Down
2 changes: 1 addition & 1 deletion src/validation/__tests__/KnownArgumentNames-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('Validate: Known argument names', () => {
it('no args on optional arg', () => {
expectValid(`
fragment noArgOnOptionalArg on Dog {
isHousetrained
isHouseTrained
}
`);
});
Expand Down
12 changes: 6 additions & 6 deletions src/validation/__tests__/ProvidedRequiredArguments-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('Validate: Provided required arguments', () => {
expectValid(`
{
dog {
isHousetrained(unknownArgument: true)
isHouseTrained(unknownArgument: true)
}
}
`);
Expand All @@ -47,7 +47,7 @@ describe('Validate: Provided required arguments', () => {
expectValid(`
{
dog {
isHousetrained(atOtherHomes: true)
isHouseTrained(atOtherHomes: true)
}
}
`);
Expand All @@ -57,7 +57,7 @@ describe('Validate: Provided required arguments', () => {
expectValid(`
{
dog {
isHousetrained
isHouseTrained
}
}
`);
Expand Down Expand Up @@ -123,7 +123,7 @@ describe('Validate: Provided required arguments', () => {
`);
});

it('Multiple reqs on mixedList', () => {
it('Multiple required args on mixedList', () => {
expectValid(`
{
complicatedArgs {
Expand All @@ -133,7 +133,7 @@ describe('Validate: Provided required arguments', () => {
`);
});

it('Multiple reqs and one opt on mixedList', () => {
it('Multiple required and one optional arg on mixedList', () => {
expectValid(`
{
complicatedArgs {
Expand All @@ -143,7 +143,7 @@ describe('Validate: Provided required arguments', () => {
`);
});

it('All reqs and opts on mixedList', () => {
it('All required and optional args on mixedList', () => {
expectValid(`
{
complicatedArgs {
Expand Down
10 changes: 5 additions & 5 deletions src/validation/__tests__/ValuesOfCorrectType-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ describe('Validate: Values of correct type', () => {
expectValid(`
{
dog {
isHousetrained(atOtherHomes: true)
isHouseTrained(atOtherHomes: true)
}
}
`);
Expand All @@ -637,7 +637,7 @@ describe('Validate: Values of correct type', () => {
expectValid(`
{
dog {
isHousetrained
isHouseTrained
}
}
`);
Expand Down Expand Up @@ -693,7 +693,7 @@ describe('Validate: Values of correct type', () => {
`);
});

it('Multiple reqs on mixedList', () => {
it('Multiple required args on mixedList', () => {
expectValid(`
{
complicatedArgs {
Expand All @@ -703,7 +703,7 @@ describe('Validate: Values of correct type', () => {
`);
});

it('Multiple reqs and one opt on mixedList', () => {
it('Multiple required and one optional arg on mixedList', () => {
expectValid(`
{
complicatedArgs {
Expand All @@ -713,7 +713,7 @@ describe('Validate: Values of correct type', () => {
`);
});

it('All reqs and opts on mixedList', () => {
it('All required and optional args on mixedList', () => {
expectValid(`
{
complicatedArgs {
Expand Down
2 changes: 1 addition & 1 deletion src/validation/__tests__/harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const Dog = new GraphQLObjectType({
dogCommand: { type: DogCommand },
},
},
isHousetrained: {
isHouseTrained: {
type: GraphQLBoolean,
args: {
atOtherHomes: {
Expand Down
6 changes: 3 additions & 3 deletions src/validation/__tests__/validation-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Validate: Supports full validation', () => {
furColor
}
... on Dog {
isHousetrained
isHouseTrained
}
}
}
Expand Down Expand Up @@ -58,7 +58,7 @@ describe('Validate: Supports full validation', () => {
furColor
}
... on Dog {
isHousetrained
isHouseTrained
}
}
}
Expand All @@ -70,7 +70,7 @@ describe('Validate: Supports full validation', () => {
expect(errorMessages).to.deep.equal([
'Cannot query field "catOrDog" on type "QueryRoot". Did you mean "catOrDog"?',
'Cannot query field "furColor" on type "Cat". Did you mean "furColor"?',
'Cannot query field "isHousetrained" on type "Dog". Did you mean "isHousetrained"?',
'Cannot query field "isHouseTrained" on type "Dog". Did you mean "isHouseTrained"?',
]);
});
});
Expand Down
Loading