From 3cedc0c9c33a64c9d1705a827874139734767f6b Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Tue, 19 Apr 2022 23:40:34 +0300 Subject: [PATCH] ESLint: disallow using node globals in src/tests --- .eslintrc.yml | 11 ++++++++++- src/jsutils/instanceOf.ts | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index c2afab0ac0..3baa8f151b 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,7 +1,6 @@ parserOptions: sourceType: script env: - node: true es2022: true reportUnusedDisableDirectives: true plugins: @@ -663,12 +662,16 @@ overrides: import/no-restricted-paths: off import/no-extraneous-dependencies: [error, { devDependencies: true }] - files: 'integrationTests/*' + env: + node: true rules: node/no-sync: off node/no-unpublished-require: [error, { allowModules: ['mocha'] }] import/no-extraneous-dependencies: [error, { devDependencies: true }] import/no-nodejs-modules: off - files: 'integrationTests/*/**' + env: + node: true rules: node/no-sync: off node/no-missing-require: [error, { allowModules: ['graphql'] }] @@ -676,6 +679,8 @@ overrides: import/no-nodejs-modules: off no-console: off - files: 'benchmark/**' + env: + node: true rules: internal-rules/only-ascii: [error, { allowEmoji: true }] node/no-sync: off @@ -685,6 +690,8 @@ overrides: no-console: off no-await-in-loop: off - files: 'resources/**' + env: + node: true rules: internal-rules/only-ascii: [error, { allowEmoji: true }] node/no-unpublished-require: off @@ -702,6 +709,8 @@ overrides: node/no-unpublished-import: off import/no-default-export: off - files: 'website/**' + env: + node: true plugins: - 'react' extends: diff --git a/src/jsutils/instanceOf.ts b/src/jsutils/instanceOf.ts index 3f24a77006..a4456c679d 100644 --- a/src/jsutils/instanceOf.ts +++ b/src/jsutils/instanceOf.ts @@ -7,8 +7,9 @@ import { inspect } from './inspect'; * See: https://webpack.js.org/guides/production/ */ export const instanceOf: (value: unknown, constructor: Constructor) => boolean = - /* c8 ignore next 5 */ + /* c8 ignore next 6 */ // FIXME: https://github.com/graphql/graphql-js/issues/2317 + // eslint-disable-next-line no-undef process.env.NODE_ENV === 'production' ? function instanceOf(value: unknown, constructor: Constructor): boolean { return value instanceof constructor;