Skip to content

Commit 9531486

Browse files
ESLint: enable 'func-names' (#3008)
1 parent 8352543 commit 9531486

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed

.eslintrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ rules:
298298
capitalized-comments: off # maybe
299299
consistent-this: off
300300
func-name-matching: off
301-
func-names: off
301+
func-names: [error, as-needed] # improve debug experience
302302
func-style: off
303303
id-denylist: off
304304
id-length: off

resources/eslint-internal-rules/no-dir-import.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const fs = require('fs');
44
const path = require('path');
55

6-
module.exports = function (context) {
6+
module.exports = function noDirImportRule(context) {
77
return {
88
ImportDeclaration: checkImportPath,
99
ExportNamedDeclaration: checkImportPath,

src/jsutils/__tests__/inspect-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ describe('inspect', () => {
168168
(Foo.prototype: any)[Symbol.toStringTag] = 'Bar';
169169
expect(inspect([[new Foo()]])).to.equal('[[[Bar]]]');
170170

171+
// eslint-disable-next-line func-names
171172
const objectWithoutClassName = new (function () {
172173
// eslint-disable-next-line no-invalid-this
173174
this.foo = 1;

src/subscription/__tests__/subscribe-test.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -897,12 +897,14 @@ describe('Subscription Publish Phase', () => {
897897
});
898898

899899
it('should handle error during execution of source event', async () => {
900+
async function* generateEmails() {
901+
yield { email: { subject: 'Hello' } };
902+
yield { email: { subject: 'Goodbye' } };
903+
yield { email: { subject: 'Bonjour' } };
904+
}
905+
900906
const erroringEmailSchema = emailSchemaWithResolvers(
901-
async function* () {
902-
yield { email: { subject: 'Hello' } };
903-
yield { email: { subject: 'Goodbye' } };
904-
yield { email: { subject: 'Bonjour' } };
905-
},
907+
generateEmails,
906908
(event) => {
907909
if (event.email.subject === 'Goodbye') {
908910
throw new Error('Never leave.');
@@ -975,11 +977,13 @@ describe('Subscription Publish Phase', () => {
975977
});
976978

977979
it('should pass through error thrown in source event stream', async () => {
980+
async function* generateEmails() {
981+
yield { email: { subject: 'Hello' } };
982+
throw new Error('test error');
983+
}
984+
978985
const erroringEmailSchema = emailSchemaWithResolvers(
979-
async function* () {
980-
yield { email: { subject: 'Hello' } };
981-
throw new Error('test error');
982-
},
986+
generateEmails,
983987
(email) => email,
984988
);
985989

@@ -1029,11 +1033,13 @@ describe('Subscription Publish Phase', () => {
10291033
});
10301034

10311035
it('should resolve GraphQL error from source event stream', async () => {
1036+
async function* generateEmails() {
1037+
yield { email: { subject: 'Hello' } };
1038+
throw new GraphQLError('test error');
1039+
}
1040+
10321041
const erroringEmailSchema = emailSchemaWithResolvers(
1033-
async function* () {
1034-
yield { email: { subject: 'Hello' } };
1035-
throw new GraphQLError('test error');
1036-
},
1042+
generateEmails,
10371043
(email) => email,
10381044
);
10391045

0 commit comments

Comments
 (0)