Skip to content

Commit 52157dc

Browse files
Enable 'default-param-last' (#2270)
1 parent c4098e1 commit 52157dc

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

.eslintrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ rules:
110110
consistent-return: off
111111
curly: error
112112
default-case: off
113-
default-param-last: off # TODO
113+
default-param-last: error
114114
dot-notation: off
115115
eqeqeq: [error, smart]
116116
grouped-accessor-pairs: error

src/subscription/__tests__/subscribe-test.js

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,26 @@ function emailSchemaWithResolvers(subscribeFn, resolveFn) {
7878
});
7979
}
8080

81-
async function createSubscription(pubsub, schema = emailSchema, ast, vars) {
81+
const defaultSubscriptionAST = parse(`
82+
subscription ($priority: Int = 0) {
83+
importantEmail(priority: $priority) {
84+
email {
85+
from
86+
subject
87+
}
88+
inbox {
89+
unread
90+
total
91+
}
92+
}
93+
}
94+
`);
95+
96+
async function createSubscription(
97+
pubsub,
98+
schema = emailSchema,
99+
ast = defaultSubscriptionAST,
100+
) {
82101
const data = {
83102
inbox: {
84103
emails: [
@@ -106,26 +125,11 @@ async function createSubscription(pubsub, schema = emailSchema, ast, vars) {
106125
});
107126
}
108127

109-
const defaultAST = parse(`
110-
subscription ($priority: Int = 0) {
111-
importantEmail(priority: $priority) {
112-
email {
113-
from
114-
subject
115-
}
116-
inbox {
117-
unread
118-
total
119-
}
120-
}
121-
}
122-
`);
123-
124128
// `subscribe` returns Promise<AsyncIterator | ExecutionResult>
125129
return {
126130
sendImportantEmail,
127131
// $FlowFixMe
128-
subscription: await subscribe(schema, ast || defaultAST, data, null, vars),
132+
subscription: await subscribe(schema, ast, data),
129133
};
130134
}
131135

src/validation/validate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function validate(
4141
documentAST: DocumentNode,
4242
rules?: $ReadOnlyArray<ValidationRule> = specifiedRules,
4343
typeInfo?: TypeInfo = new TypeInfo(schema),
44-
options?: {| maxErrors?: number |},
44+
options?: {| maxErrors?: number |} = { maxErrors: undefined },
4545
): $ReadOnlyArray<GraphQLError> {
4646
devAssert(documentAST, 'Must provide document');
4747
// If the schema used for validation is invalid, throw an error.

0 commit comments

Comments
 (0)