Skip to content

Commit

Permalink
ESLint: enable 'func-names' (#3008)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Mar 31, 2021
1 parent 8352543 commit 9531486
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yml
Expand Up @@ -298,7 +298,7 @@ rules:
capitalized-comments: off # maybe
consistent-this: off
func-name-matching: off
func-names: off
func-names: [error, as-needed] # improve debug experience
func-style: off
id-denylist: off
id-length: off
Expand Down
2 changes: 1 addition & 1 deletion resources/eslint-internal-rules/no-dir-import.js
Expand Up @@ -3,7 +3,7 @@
const fs = require('fs');
const path = require('path');

module.exports = function (context) {
module.exports = function noDirImportRule(context) {
return {
ImportDeclaration: checkImportPath,
ExportNamedDeclaration: checkImportPath,
Expand Down
1 change: 1 addition & 0 deletions src/jsutils/__tests__/inspect-test.js
Expand Up @@ -168,6 +168,7 @@ describe('inspect', () => {
(Foo.prototype: any)[Symbol.toStringTag] = 'Bar';
expect(inspect([[new Foo()]])).to.equal('[[[Bar]]]');

// eslint-disable-next-line func-names
const objectWithoutClassName = new (function () {
// eslint-disable-next-line no-invalid-this
this.foo = 1;
Expand Down
32 changes: 19 additions & 13 deletions src/subscription/__tests__/subscribe-test.js
Expand Up @@ -897,12 +897,14 @@ describe('Subscription Publish Phase', () => {
});

it('should handle error during execution of source event', async () => {
async function* generateEmails() {
yield { email: { subject: 'Hello' } };
yield { email: { subject: 'Goodbye' } };
yield { email: { subject: 'Bonjour' } };
}

const erroringEmailSchema = emailSchemaWithResolvers(
async function* () {
yield { email: { subject: 'Hello' } };
yield { email: { subject: 'Goodbye' } };
yield { email: { subject: 'Bonjour' } };
},
generateEmails,
(event) => {
if (event.email.subject === 'Goodbye') {
throw new Error('Never leave.');
Expand Down Expand Up @@ -975,11 +977,13 @@ describe('Subscription Publish Phase', () => {
});

it('should pass through error thrown in source event stream', async () => {
async function* generateEmails() {
yield { email: { subject: 'Hello' } };
throw new Error('test error');
}

const erroringEmailSchema = emailSchemaWithResolvers(
async function* () {
yield { email: { subject: 'Hello' } };
throw new Error('test error');
},
generateEmails,
(email) => email,
);

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

it('should resolve GraphQL error from source event stream', async () => {
async function* generateEmails() {
yield { email: { subject: 'Hello' } };
throw new GraphQLError('test error');
}

const erroringEmailSchema = emailSchemaWithResolvers(
async function* () {
yield { email: { subject: 'Hello' } };
throw new GraphQLError('test error');
},
generateEmails,
(email) => email,
);

Expand Down

0 comments on commit 9531486

Please sign in to comment.