Skip to content

Commit 78d5f83

Browse files
Improve naming 'err => error' and 'arr => array' (#3073)
1 parent 3cfb2be commit 78d5f83

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/utilities/lexicographicSortSchema.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ export function lexicographicSortSchema(schema: GraphQLSchema): GraphQLSchema {
104104
}));
105105
}
106106

107-
function sortTypes<T: GraphQLNamedType>(arr: $ReadOnlyArray<T>): Array<T> {
108-
return sortByName(arr).map(replaceNamedType);
107+
function sortTypes<T: GraphQLNamedType>(array: $ReadOnlyArray<T>): Array<T> {
108+
return sortByName(array).map(replaceNamedType);
109109
}
110110

111111
function sortNamedType(type: GraphQLNamedType): GraphQLNamedType {

src/validation/ValidationContext.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface VariableUsage {
3535
* validation rule.
3636
*/
3737
export class ASTValidationContext {
38-
constructor(ast: DocumentNode, onError: (err: GraphQLError) => void);
38+
constructor(ast: DocumentNode, onError: (error: GraphQLError) => void);
3939

4040
reportError(error: GraphQLError): undefined;
4141

@@ -54,7 +54,7 @@ export class SDLValidationContext extends ASTValidationContext {
5454
constructor(
5555
ast: DocumentNode,
5656
schema: Maybe<GraphQLSchema>,
57-
onError: (err: GraphQLError) => void,
57+
onError: (error: GraphQLError) => void,
5858
);
5959

6060
getSchema(): Maybe<GraphQLSchema>;
@@ -67,7 +67,7 @@ export class ValidationContext extends ASTValidationContext {
6767
schema: GraphQLSchema,
6868
ast: DocumentNode,
6969
typeInfo: TypeInfo,
70-
onError: (err: GraphQLError) => void,
70+
onError: (error: GraphQLError) => void,
7171
);
7272

7373
getSchema(): GraphQLSchema;

src/validation/ValidationContext.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ type VariableUsage = {|
4242
*/
4343
export class ASTValidationContext {
4444
_ast: DocumentNode;
45-
_onError: (err: GraphQLError) => void;
45+
_onError: (error: GraphQLError) => void;
4646
_fragments: ?ObjMap<FragmentDefinitionNode>;
4747
_fragmentSpreads: Map<SelectionSetNode, $ReadOnlyArray<FragmentSpreadNode>>;
4848
_recursivelyReferencedFragments: Map<
4949
OperationDefinitionNode,
5050
$ReadOnlyArray<FragmentDefinitionNode>,
5151
>;
5252

53-
constructor(ast: DocumentNode, onError: (err: GraphQLError) => void) {
53+
constructor(ast: DocumentNode, onError: (error: GraphQLError) => void) {
5454
this._ast = ast;
5555
this._fragments = undefined;
5656
this._fragmentSpreads = new Map();
@@ -136,7 +136,7 @@ export class SDLValidationContext extends ASTValidationContext {
136136
constructor(
137137
ast: DocumentNode,
138138
schema: ?GraphQLSchema,
139-
onError: (err: GraphQLError) => void,
139+
onError: (error: GraphQLError) => void,
140140
) {
141141
super(ast, onError);
142142
this._schema = schema;
@@ -162,7 +162,7 @@ export class ValidationContext extends ASTValidationContext {
162162
schema: GraphQLSchema,
163163
ast: DocumentNode,
164164
typeInfo: TypeInfo,
165-
onError: (err: GraphQLError) => void,
165+
onError: (error: GraphQLError) => void,
166166
) {
167167
super(ast, onError);
168168
this._schema = schema;

src/validation/__tests__/validation-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('Validate: Supports full validation', () => {
7171
`);
7272

7373
const errors = validate(testSchema, doc, undefined, undefined, typeInfo);
74-
const errorMessages = errors.map((err) => err.message);
74+
const errorMessages = errors.map((error) => error.message);
7575

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

0 commit comments

Comments
 (0)