Skip to content

Commit

Permalink
Enable 'default-param-last' (#2270)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored Nov 25, 2019
1 parent c4098e1 commit 52157dc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ rules:
consistent-return: off
curly: error
default-case: off
default-param-last: off # TODO
default-param-last: error
dot-notation: off
eqeqeq: [error, smart]
grouped-accessor-pairs: error
Expand Down
38 changes: 21 additions & 17 deletions src/subscription/__tests__/subscribe-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,26 @@ function emailSchemaWithResolvers(subscribeFn, resolveFn) {
});
}

async function createSubscription(pubsub, schema = emailSchema, ast, vars) {
const defaultSubscriptionAST = parse(`
subscription ($priority: Int = 0) {
importantEmail(priority: $priority) {
email {
from
subject
}
inbox {
unread
total
}
}
}
`);

async function createSubscription(
pubsub,
schema = emailSchema,
ast = defaultSubscriptionAST,
) {
const data = {
inbox: {
emails: [
Expand Down Expand Up @@ -106,26 +125,11 @@ async function createSubscription(pubsub, schema = emailSchema, ast, vars) {
});
}

const defaultAST = parse(`
subscription ($priority: Int = 0) {
importantEmail(priority: $priority) {
email {
from
subject
}
inbox {
unread
total
}
}
}
`);

// `subscribe` returns Promise<AsyncIterator | ExecutionResult>
return {
sendImportantEmail,
// $FlowFixMe
subscription: await subscribe(schema, ast || defaultAST, data, null, vars),
subscription: await subscribe(schema, ast, data),
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/validation/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function validate(
documentAST: DocumentNode,
rules?: $ReadOnlyArray<ValidationRule> = specifiedRules,
typeInfo?: TypeInfo = new TypeInfo(schema),
options?: {| maxErrors?: number |},
options?: {| maxErrors?: number |} = { maxErrors: undefined },
): $ReadOnlyArray<GraphQLError> {
devAssert(documentAST, 'Must provide document');
// If the schema used for validation is invalid, throw an error.
Expand Down

0 comments on commit 52157dc

Please sign in to comment.