Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint: enable 'func-names' #3008

Merged
merged 1 commit into from Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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