Skip to content
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

Improve naming 'err => error' and 'arr => array' #3073

Merged
merged 1 commit into from May 10, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/utilities/lexicographicSortSchema.js
Expand Up @@ -104,8 +104,8 @@ export function lexicographicSortSchema(schema: GraphQLSchema): GraphQLSchema {
}));
}

function sortTypes<T: GraphQLNamedType>(arr: $ReadOnlyArray<T>): Array<T> {
return sortByName(arr).map(replaceNamedType);
function sortTypes<T: GraphQLNamedType>(array: $ReadOnlyArray<T>): Array<T> {
return sortByName(array).map(replaceNamedType);
}

function sortNamedType(type: GraphQLNamedType): GraphQLNamedType {
Expand Down
6 changes: 3 additions & 3 deletions src/validation/ValidationContext.d.ts
Expand Up @@ -35,7 +35,7 @@ interface VariableUsage {
* validation rule.
*/
export class ASTValidationContext {
constructor(ast: DocumentNode, onError: (err: GraphQLError) => void);
constructor(ast: DocumentNode, onError: (error: GraphQLError) => void);

reportError(error: GraphQLError): undefined;

Expand All @@ -54,7 +54,7 @@ export class SDLValidationContext extends ASTValidationContext {
constructor(
ast: DocumentNode,
schema: Maybe<GraphQLSchema>,
onError: (err: GraphQLError) => void,
onError: (error: GraphQLError) => void,
);

getSchema(): Maybe<GraphQLSchema>;
Expand All @@ -67,7 +67,7 @@ export class ValidationContext extends ASTValidationContext {
schema: GraphQLSchema,
ast: DocumentNode,
typeInfo: TypeInfo,
onError: (err: GraphQLError) => void,
onError: (error: GraphQLError) => void,
);

getSchema(): GraphQLSchema;
Expand Down
8 changes: 4 additions & 4 deletions src/validation/ValidationContext.js
Expand Up @@ -42,15 +42,15 @@ type VariableUsage = {|
*/
export class ASTValidationContext {
_ast: DocumentNode;
_onError: (err: GraphQLError) => void;
_onError: (error: GraphQLError) => void;
_fragments: ?ObjMap<FragmentDefinitionNode>;
_fragmentSpreads: Map<SelectionSetNode, $ReadOnlyArray<FragmentSpreadNode>>;
_recursivelyReferencedFragments: Map<
OperationDefinitionNode,
$ReadOnlyArray<FragmentDefinitionNode>,
>;

constructor(ast: DocumentNode, onError: (err: GraphQLError) => void) {
constructor(ast: DocumentNode, onError: (error: GraphQLError) => void) {
this._ast = ast;
this._fragments = undefined;
this._fragmentSpreads = new Map();
Expand Down Expand Up @@ -136,7 +136,7 @@ export class SDLValidationContext extends ASTValidationContext {
constructor(
ast: DocumentNode,
schema: ?GraphQLSchema,
onError: (err: GraphQLError) => void,
onError: (error: GraphQLError) => void,
) {
super(ast, onError);
this._schema = schema;
Expand All @@ -162,7 +162,7 @@ export class ValidationContext extends ASTValidationContext {
schema: GraphQLSchema,
ast: DocumentNode,
typeInfo: TypeInfo,
onError: (err: GraphQLError) => void,
onError: (error: GraphQLError) => void,
) {
super(ast, onError);
this._schema = schema;
Expand Down
2 changes: 1 addition & 1 deletion src/validation/__tests__/validation-test.js
Expand Up @@ -71,7 +71,7 @@ describe('Validate: Supports full validation', () => {
`);

const errors = validate(testSchema, doc, undefined, undefined, typeInfo);
const errorMessages = errors.map((err) => err.message);
const errorMessages = errors.map((error) => error.message);

expect(errorMessages).to.deep.equal([
'Cannot query field "catOrDog" on type "QueryRoot". Did you mean "catOrDog"?',
Expand Down