diff --git a/.eslintrc.js b/.eslintrc.js
index 6947aab62c61..f5136f16899d 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -30,7 +30,6 @@ module.exports = {
'@typescript-eslint/prefer-ts-expect-error': 'error',
// Since we do `export =`. Remove for Jest 27
'import/default': 'off',
- 'import/order': 'error',
'no-dupe-class-members': 'off',
'no-unused-vars': 'off',
// TODO: turn these on at some point
@@ -42,7 +41,6 @@ module.exports = {
files: [
'e2e/babel-plugin-jest-hoist/__tests__/typescript.test.ts',
'e2e/coverage-remapping/covered.ts',
- 'packages/expect/src/jestMatchersObject.ts',
'packages/expect/src/matchers.ts',
'packages/expect/src/print.ts',
'packages/expect/src/toThrowMatchers.ts',
@@ -52,25 +50,19 @@ module.exports = {
'packages/jest-core/src/TestScheduler.ts',
'packages/jest-core/src/collectHandles.ts',
'packages/jest-core/src/plugins/update_snapshots_interactive.ts',
- 'packages/jest-environment/src/index.ts',
'packages/jest-fake-timers/src/legacyFakeTimers.ts',
'packages/jest-haste-map/src/index.ts',
'packages/jest-haste-map/src/lib/FSEventsWatcher.ts',
- 'packages/jest-jasmine2/src/errorOnPrivate.ts',
'packages/jest-jasmine2/src/jasmine/SpyStrategy.ts',
'packages/jest-jasmine2/src/jasmine/Suite.ts',
'packages/jest-leak-detector/src/index.ts',
'packages/jest-matcher-utils/src/index.ts',
'packages/jest-mock/src/__tests__/index.test.ts',
'packages/jest-mock/src/index.ts',
- 'packages/jest-resolve/src/isBuiltinModule.ts',
'packages/jest-snapshot/src/index.ts',
'packages/jest-snapshot/src/printSnapshot.ts',
'packages/jest-snapshot/src/types.ts',
- 'packages/jest-types/src/Global.ts',
- 'packages/jest-util/src/ErrorWithStack.ts',
'packages/jest-util/src/convertDescriptorToString.ts',
- 'packages/jest-validate/src/types.ts',
'packages/jest-worker/src/Farm.ts',
'packages/jest-worker/src/index.ts',
'packages/pretty-format/src/index.ts',
@@ -102,46 +94,46 @@ module.exports = {
{
files: ['*.md'],
rules: {
- 'arrow-body-style': 0,
- 'consistent-return': 0,
- 'flowtype/require-valid-file-annotation': 0,
- 'import/no-extraneous-dependencies': 0,
- 'import/no-unresolved': 0,
- 'jest/no-focused-tests': 0,
- 'jest/no-identical-title': 0,
- 'jest/valid-expect': 0,
- 'no-undef': 0,
- 'no-unused-vars': 0,
- 'prettier/prettier': 0,
- 'react/jsx-no-undef': 0,
- 'react/react-in-jsx-scope': 0,
- 'sort-keys': 0,
+ 'arrow-body-style': 'off',
+ 'consistent-return': 'off',
+ 'flowtype/require-valid-file-annotation': 'off',
+ 'import/no-extraneous-dependencies': 'off',
+ 'import/no-unresolved': 'off',
+ 'jest/no-focused-tests': 'off',
+ 'jest/no-identical-title': 'off',
+ 'jest/valid-expect': 'off',
+ 'no-undef': 'off',
+ 'no-unused-vars': 'off',
+ 'prettier/prettier': 'off',
+ 'react/jsx-no-undef': 'off',
+ 'react/react-in-jsx-scope': 'off',
+ 'sort-keys': 'off',
},
},
{
files: ['examples/**/*'],
rules: {
- 'babel/func-params-comma-dangle': 0,
- 'import/no-unresolved': [2, {ignore: ['^react-native$']}],
- 'import/order': 0,
+ 'babel/func-params-comma-dangle': 'off',
+ 'import/no-unresolved': ['error', {ignore: ['^react-native$']}],
+ 'import/order': 'off',
},
},
{
files: ['scripts/**/*', 'e2e/**/*'],
rules: {
- 'babel/func-params-comma-dangle': 0,
+ 'babel/func-params-comma-dangle': 'off',
},
},
{
files: 'packages/jest-types/**/*',
rules: {
- 'import/no-extraneous-dependencies': 0,
+ 'import/no-extraneous-dependencies': 'off',
},
},
{
files: 'packages/**/*.ts',
rules: {
- '@typescript-eslint/explicit-module-boundary-types': 2,
+ '@typescript-eslint/explicit-module-boundary-types': 'error',
},
},
{
@@ -153,7 +145,7 @@ module.exports = {
'**/vendor/**/*',
],
rules: {
- '@typescript-eslint/explicit-module-boundary-types': 0,
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
},
},
{
@@ -163,8 +155,8 @@ module.exports = {
'**/vendor/**/*',
],
rules: {
- 'eslint-comments/disable-enable-pair': 0,
- 'eslint-comments/no-unlimited-disable': 0,
+ 'eslint-comments/disable-enable-pair': 'off',
+ 'eslint-comments/no-unlimited-disable': 'off',
},
},
{
@@ -186,30 +178,30 @@ module.exports = {
'**/pretty-format/perf/**',
],
rules: {
- 'import/no-extraneous-dependencies': 0,
+ 'import/no-extraneous-dependencies': 'off',
},
},
{
files: ['test-types/*.test.ts'],
rules: {
- 'jest/no-focused-tests': 0,
- 'jest/no-identical-title': 0,
- 'jest/valid-expect': 0,
+ 'jest/no-focused-tests': 'off',
+ 'jest/no-identical-title': 'off',
+ 'jest/valid-expect': 'off',
},
},
],
parser: 'babel-eslint',
plugins: ['markdown', 'import', 'prettier', 'eslint-comments'],
rules: {
- 'arrow-body-style': 2,
- 'eslint-comments/disable-enable-pair': [2, {allowWholeFile: true}],
- 'eslint-comments/no-unused-disable': 2,
- 'flowtype/boolean-style': 2,
- 'flowtype/no-primitive-constructor-types': 2,
- 'flowtype/require-valid-file-annotation': 2,
- 'import/no-duplicates': 2,
+ 'arrow-body-style': 'error',
+ 'eslint-comments/disable-enable-pair': ['error', {allowWholeFile: true}],
+ 'eslint-comments/no-unused-disable': 'error',
+ 'flowtype/boolean-style': 'error',
+ 'flowtype/no-primitive-constructor-types': 'error',
+ 'flowtype/require-valid-file-annotation': 'error',
+ 'import/no-duplicates': 'error',
'import/no-extraneous-dependencies': [
- 2,
+ 'error',
{
devDependencies: [
'/test-types/**',
@@ -222,21 +214,19 @@ module.exports = {
],
},
],
- 'import/no-unresolved': [2, {ignore: ['fsevents']}],
- // This has to be disabled until all type and module imports are combined
- // https://github.com/benmosher/eslint-plugin-import/issues/645
- 'import/order': 0,
- 'no-console': 0,
+ 'import/no-unresolved': ['error', {ignore: ['fsevents']}],
+ 'import/order': 'error',
+ 'no-console': 'off',
'no-restricted-imports': [
- 2,
+ 'error',
{
message: 'Please use graceful-fs instead.',
name: 'fs',
},
],
- 'no-unused-vars': 2,
- 'prettier/prettier': 2,
- 'sort-imports': [2, {ignoreDeclarationSort: true}],
+ 'no-unused-vars': 'error',
+ 'prettier/prettier': 'error',
+ 'sort-imports': ['error', {ignoreDeclarationSort: true}],
},
settings: {
'import/ignore': ['react-native'],
diff --git a/docs/Puppeteer.md b/docs/Puppeteer.md
index 73f4c48e42d7..b5934c0ad8de 100644
--- a/docs/Puppeteer.md
+++ b/docs/Puppeteer.md
@@ -55,11 +55,11 @@ Here's an example of the GlobalSetup script
```js
// setup.js
-const puppeteer = require('puppeteer');
-const mkdirp = require('mkdirp');
const path = require('path');
const fs = require('fs');
const os = require('os');
+const mkdirp = require('mkdirp');
+const puppeteer = require('puppeteer');
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
@@ -79,11 +79,11 @@ Then we need a custom Test Environment for puppeteer
```js
// puppeteer_environment.js
-const NodeEnvironment = require('jest-environment-node');
const fs = require('fs');
const path = require('path');
-const puppeteer = require('puppeteer');
const os = require('os');
+const puppeteer = require('puppeteer');
+const NodeEnvironment = require('jest-environment-node');
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
@@ -123,8 +123,8 @@ Finally, we can close the puppeteer instance and clean-up the file
```js
// teardown.js
const os = require('os');
-const rimraf = require('rimraf');
const path = require('path');
+const rimraf = require('rimraf');
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
module.exports = async function () {
diff --git a/docs/SnapshotTesting.md b/docs/SnapshotTesting.md
index 87e3709bbea5..2b7ecedc2f07 100644
--- a/docs/SnapshotTesting.md
+++ b/docs/SnapshotTesting.md
@@ -13,8 +13,8 @@ A similar approach can be taken when it comes to testing your React components.
```javascript
import React from 'react';
-import Link from '../Link.react';
import renderer from 'react-test-renderer';
+import Link from '../Link.react';
it('renders correctly', () => {
const tree = renderer
diff --git a/docs/TutorialReact.md b/docs/TutorialReact.md
index e572da0058f9..482da1e1f017 100644
--- a/docs/TutorialReact.md
+++ b/docs/TutorialReact.md
@@ -109,8 +109,8 @@ Now let's use React's test renderer and Jest's snapshot feature to interact with
```javascript
// Link.react.test.js
import React from 'react';
-import Link from '../Link.react';
import renderer from 'react-test-renderer';
+import Link from '../Link.react';
test('Link changes the class when hovered', () => {
const component = renderer.create(
diff --git a/docs/TutorialReactNative.md b/docs/TutorialReactNative.md
index 9b84c28d34e2..9c7f20ae6d40 100644
--- a/docs/TutorialReactNative.md
+++ b/docs/TutorialReactNative.md
@@ -72,9 +72,8 @@ Now let's use React's test renderer and Jest's snapshot feature to interact with
```javascript
// __tests__/Intro-test.js
import React from 'react';
-import Intro from '../Intro';
-
import renderer from 'react-test-renderer';
+import Intro from '../Intro';
test('renders correctly', () => {
const tree = renderer.create().toJSON();
diff --git a/e2e/global-setup-custom-transform/setup.js b/e2e/global-setup-custom-transform/setup.js
index b17b8d38fd51..015de4de23b8 100644
--- a/e2e/global-setup-custom-transform/setup.js
+++ b/e2e/global-setup-custom-transform/setup.js
@@ -6,9 +6,9 @@
*/
const crypto = require('crypto');
const fs = require('fs');
-const {createDirectory} = require('jest-util');
const os = require('os');
const path = require('path');
+const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-setup-custom-transform');
diff --git a/e2e/global-setup-node-modules/setup.js b/e2e/global-setup-node-modules/setup.js
index c77d928eb161..ed270c025ae6 100644
--- a/e2e/global-setup-node-modules/setup.js
+++ b/e2e/global-setup-node-modules/setup.js
@@ -7,9 +7,9 @@
import example from './node_modules/example';
const crypto = require('crypto');
const fs = require('fs');
-const {createDirectory} = require('jest-util');
const os = require('os');
const path = require('path');
+const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-setup-node-modules');
diff --git a/e2e/global-setup/project-1/setup.js b/e2e/global-setup/project-1/setup.js
index 3c32a63ccd14..eacf05134ec2 100644
--- a/e2e/global-setup/project-1/setup.js
+++ b/e2e/global-setup/project-1/setup.js
@@ -6,9 +6,9 @@
*/
const crypto = require('crypto');
const fs = require('fs');
-const {createDirectory} = require('jest-util');
const os = require('os');
const path = require('path');
+const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-setup-project-1');
diff --git a/e2e/global-setup/project-2/setup.js b/e2e/global-setup/project-2/setup.js
index 1477774a2643..8636ed82835a 100644
--- a/e2e/global-setup/project-2/setup.js
+++ b/e2e/global-setup/project-2/setup.js
@@ -6,9 +6,9 @@
*/
const crypto = require('crypto');
const fs = require('fs');
-const {createDirectory} = require('jest-util');
const os = require('os');
const path = require('path');
+const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-setup-project-2');
diff --git a/e2e/global-setup/setup.js b/e2e/global-setup/setup.js
index 43f07b5d26a8..57ebbc8b0891 100644
--- a/e2e/global-setup/setup.js
+++ b/e2e/global-setup/setup.js
@@ -6,9 +6,9 @@
*/
const crypto = require('crypto');
const fs = require('fs');
-const {createDirectory} = require('jest-util');
const os = require('os');
const path = require('path');
+const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-setup');
diff --git a/e2e/global-teardown/project-1/teardown.js b/e2e/global-teardown/project-1/teardown.js
index 19482fdf686c..d41d0f0758a6 100644
--- a/e2e/global-teardown/project-1/teardown.js
+++ b/e2e/global-teardown/project-1/teardown.js
@@ -6,9 +6,9 @@
*/
const crypto = require('crypto');
const fs = require('fs');
-const {createDirectory} = require('jest-util');
const os = require('os');
const path = require('path');
+const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-teardown-project-1');
diff --git a/e2e/global-teardown/project-2/teardown.js b/e2e/global-teardown/project-2/teardown.js
index f428e8b417a9..f4584519ac05 100644
--- a/e2e/global-teardown/project-2/teardown.js
+++ b/e2e/global-teardown/project-2/teardown.js
@@ -6,9 +6,9 @@
*/
const crypto = require('crypto');
const fs = require('fs');
-const {createDirectory} = require('jest-util');
const os = require('os');
const path = require('path');
+const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-teardown-project-2');
diff --git a/e2e/global-teardown/teardown.js b/e2e/global-teardown/teardown.js
index db5d6c7d3ffb..7f1bb2cce04c 100644
--- a/e2e/global-teardown/teardown.js
+++ b/e2e/global-teardown/teardown.js
@@ -6,9 +6,9 @@
*/
const crypto = require('crypto');
const fs = require('fs');
-const {createDirectory} = require('jest-util');
const os = require('os');
const path = require('path');
+const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-teardown');
diff --git a/packages/expect/src/__tests__/matchers.test.js b/packages/expect/src/__tests__/matchers.test.js
index 43222223756f..6030060a8bba 100644
--- a/packages/expect/src/__tests__/matchers.test.js
+++ b/packages/expect/src/__tests__/matchers.test.js
@@ -7,9 +7,9 @@
const {stringify} = require('jest-matcher-utils');
const {alignedAnsiStyleSerializer} = require('@jest/test-utils');
-const jestExpect = require('../');
const Immutable = require('immutable');
const chalk = require('chalk');
+const jestExpect = require('../');
const chalkEnabled = chalk.enabled;
expect.addSnapshotSerializer(alignedAnsiStyleSerializer);
diff --git a/packages/jest-core/src/__tests__/watch.test.js b/packages/jest-core/src/__tests__/watch.test.js
index 06a6dd31f8f6..0ad258ad2c77 100644
--- a/packages/jest-core/src/__tests__/watch.test.js
+++ b/packages/jest-core/src/__tests__/watch.test.js
@@ -7,8 +7,8 @@
*/
import chalk from 'chalk';
-import TestWatcher from '../TestWatcher';
import {JestHook, KEYS} from 'jest-watcher';
+import TestWatcher from '../TestWatcher';
const runJestMock = jest.fn();
const watchPluginPath = `${__dirname}/__fixtures__/watch_plugin`;
diff --git a/packages/jest-environment/src/index.ts b/packages/jest-environment/src/index.ts
index d24df7924c85..3a28550df5e4 100644
--- a/packages/jest-environment/src/index.ts
+++ b/packages/jest-environment/src/index.ts
@@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/
-/* eslint-disable local/ban-types-eventually */
-
import type {Context, Script} from 'vm';
import type {Circus, Config, Global} from '@jest/types';
import jestMock = require('jest-mock');
@@ -64,7 +62,7 @@ export interface Jest {
*
* @deprecated Use `expect.extend` instead
*/
- addMatchers(matchers: Record): void;
+ addMatchers(matchers: Record): void;
/**
* Advances all timers by the needed milliseconds so that only the next timeouts/intervals will run.
* Optionally, you can provide steps, so it will run steps amount of next timeouts/intervals.
@@ -143,7 +141,9 @@ export interface Jest {
/**
* Determines if the given function is a mocked function.
*/
- isMockFunction(fn: Function): fn is ReturnType;
+ isMockFunction(
+ fn: (...args: Array) => unknown,
+ ): fn is ReturnType;
/**
* Mocks a module with an auto-mocked version when it is being required.
*/
diff --git a/packages/jest-jasmine2/src/errorOnPrivate.ts b/packages/jest-jasmine2/src/errorOnPrivate.ts
index 6d72925f50d6..654b1893950d 100644
--- a/packages/jest-jasmine2/src/errorOnPrivate.ts
+++ b/packages/jest-jasmine2/src/errorOnPrivate.ts
@@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/
-/* eslint-disable local/ban-types-eventually */
-
import type {Global} from '@jest/types';
import {ErrorWithStack} from 'jest-util';
import type {Jasmine} from './types';
@@ -78,6 +76,9 @@ export function installErrorOnPrivate(global: Global.Global): void {
});
}
-function throwAtFunction(message: string, fn: Function) {
+function throwAtFunction(
+ message: string,
+ fn: (...args: Array) => unknown,
+) {
throw new ErrorWithStack(message, fn);
}
diff --git a/packages/jest-reporters/src/__tests__/generateEmptyCoverage.test.js b/packages/jest-reporters/src/__tests__/generateEmptyCoverage.test.js
index fc8a081c4aaf..08f0e0958183 100644
--- a/packages/jest-reporters/src/__tests__/generateEmptyCoverage.test.js
+++ b/packages/jest-reporters/src/__tests__/generateEmptyCoverage.test.js
@@ -5,13 +5,13 @@
* LICENSE file in the root directory of this source tree.
*/
+import path from 'path';
+import os from 'os';
import {shouldInstrument} from '@jest/transform';
import istanbulCoverage from 'istanbul-lib-coverage';
import libSourceMaps from 'istanbul-lib-source-maps';
import generateEmptyCoverage from '../generateEmptyCoverage';
-import path from 'path';
-import os from 'os';
import {makeGlobalConfig, makeProjectConfig} from '../../../../TestUtils';
jest.mock('@jest/transform', () => ({
diff --git a/packages/jest-resolve/src/isBuiltinModule.ts b/packages/jest-resolve/src/isBuiltinModule.ts
index 56a89c9f593a..1bac7fefdc84 100644
--- a/packages/jest-resolve/src/isBuiltinModule.ts
+++ b/packages/jest-resolve/src/isBuiltinModule.ts
@@ -5,12 +5,12 @@
* LICENSE file in the root directory of this source tree.
*/
-/* eslint-disable local/ban-types-eventually */
-
import module = require('module');
// "private" api
-declare const process: NodeJS.Process & {binding(type: string): {}};
+declare const process: NodeJS.Process & {
+ binding(type: string): Record;
+};
const EXPERIMENTAL_MODULES = ['worker_threads'];
diff --git a/packages/jest-runtime/src/index.ts b/packages/jest-runtime/src/index.ts
index 6c0fd5bfc80b..52b11bcad44e 100644
--- a/packages/jest-runtime/src/index.ts
+++ b/packages/jest-runtime/src/index.ts
@@ -1700,7 +1700,7 @@ class Runtime {
beforeAll: this._environment.global.beforeAll,
beforeEach: this._environment.global.beforeEach,
describe: this._environment.global.describe,
- expect: this._environment.global.expect,
+ expect: this._environment.global.expect as any,
fdescribe: this._environment.global.fdescribe,
fit: this._environment.global.fit,
it: this._environment.global.it,
diff --git a/packages/jest-types/src/Global.ts b/packages/jest-types/src/Global.ts
index 6bcfb708b652..411e61191d23 100644
--- a/packages/jest-types/src/Global.ts
+++ b/packages/jest-types/src/Global.ts
@@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/
-/* eslint-disable local/ban-types-eventually */
-
import type {CoverageMapData} from 'istanbul-lib-coverage';
export type DoneFn = (reason?: string | Error) => void;
@@ -36,7 +34,10 @@ export type EachTestFn = (
) => ReturnType;
// TODO: Get rid of this at some point
-type Jasmine = {_DEFAULT_TIMEOUT_INTERVAL?: number; addMatchers: Function};
+type Jasmine = {
+ _DEFAULT_TIMEOUT_INTERVAL?: number;
+ addMatchers: (matchers: Record) => void;
+};
type Each =
| ((
@@ -61,7 +62,7 @@ export interface ItBase {
export interface It extends ItBase {
only: ItBase;
skip: ItBase;
- todo: (testName: TestName, ...rest: Array) => void;
+ todo: (testName: TestName) => void;
}
export interface ItConcurrentBase {
@@ -116,5 +117,5 @@ export interface Global
extends GlobalAdditions,
// TODO: Maybe add `| Window` in the future?
Omit {
- [extras: string]: any;
+ [extras: string]: unknown;
}
diff --git a/packages/jest-util/src/ErrorWithStack.ts b/packages/jest-util/src/ErrorWithStack.ts
index 20508980d17f..cbdcf7fa8058 100644
--- a/packages/jest-util/src/ErrorWithStack.ts
+++ b/packages/jest-util/src/ErrorWithStack.ts
@@ -5,10 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/
-/* eslint-disable local/ban-types-eventually */
-
export default class ErrorWithStack extends Error {
- constructor(message: string | undefined, callsite: Function) {
+ constructor(
+ message: string | undefined,
+ callsite: (...args: Array) => unknown,
+ ) {
super(message);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, callsite);
diff --git a/packages/jest-worker/src/__performance_tests__/test.js b/packages/jest-worker/src/__performance_tests__/test.js
index 23b5fd1c585f..3a688eae05e4 100644
--- a/packages/jest-worker/src/__performance_tests__/test.js
+++ b/packages/jest-worker/src/__performance_tests__/test.js
@@ -7,9 +7,9 @@
'use strict';
+const assert = require('assert');
// eslint-disable-next-line import/no-extraneous-dependencies
const workerFarm = require('worker-farm');
-const assert = require('assert');
const JestWorker = require('../../build').default;
// Typical tests: node --expose-gc test.js empty 100000
diff --git a/packages/jest-worker/src/workers/__tests__/ChildProcessWorker.test.js b/packages/jest-worker/src/workers/__tests__/ChildProcessWorker.test.js
index ec4b589ba638..d76989f98cff 100644
--- a/packages/jest-worker/src/workers/__tests__/ChildProcessWorker.test.js
+++ b/packages/jest-worker/src/workers/__tests__/ChildProcessWorker.test.js
@@ -6,9 +6,9 @@
*/
import EventEmitter from 'events';
+import {PassThrough} from 'stream';
import supportsColor from 'supports-color';
import getStream from 'get-stream';
-import {PassThrough} from 'stream';
import {
CHILD_MESSAGE_CALL,
diff --git a/scripts/build.js b/scripts/build.js
index 3cef49870f80..25e4ddebb9bb 100644
--- a/scripts/build.js
+++ b/scripts/build.js
@@ -28,6 +28,7 @@ const babel = require('@babel/core');
const chalk = require('chalk');
const micromatch = require('micromatch');
const prettier = require('prettier');
+const transformOptions = require('../babel.config.js');
const {getPackages, adjustToTerminalWidth, OK} = require('./buildUtils');
const SRC_DIR = 'src';
@@ -39,8 +40,6 @@ const PACKAGES_DIR = path.resolve(__dirname, '../packages');
const INLINE_REQUIRE_EXCLUDE_LIST = /packages\/expect|(jest-(circus|diff|get-type|jasmine2|matcher-utils|message-util|regex-util|snapshot))|pretty-format\//;
-const transformOptions = require('../babel.config.js');
-
const prettierConfig = prettier.resolveConfig.sync(__filename);
prettierConfig.trailingComma = 'none';
prettierConfig.parser = 'babel';
diff --git a/scripts/watch.js b/scripts/watch.js
index 9bdb873a537e..ced260327fee 100644
--- a/scripts/watch.js
+++ b/scripts/watch.js
@@ -10,9 +10,9 @@
*/
const fs = require('fs');
-const chokidar = require('chokidar');
const {execSync} = require('child_process');
const path = require('path');
+const chokidar = require('chokidar');
const chalk = require('chalk');
const {PACKAGES_DIR, getPackages} = require('./buildUtils');
diff --git a/website/fetchSupporters.js b/website/fetchSupporters.js
index 717fd45a91f2..55726264931d 100644
--- a/website/fetchSupporters.js
+++ b/website/fetchSupporters.js
@@ -9,8 +9,8 @@
const fs = require('fs');
const {promisify} = require('util');
-const {request} = require('graphql-request');
const path = require('path');
+const {request} = require('graphql-request');
const graphqlQuery = `
{
diff --git a/website/versioned_docs/version-22.x/SnapshotTesting.md b/website/versioned_docs/version-22.x/SnapshotTesting.md
index c74ddef26620..fca5cb46550f 100644
--- a/website/versioned_docs/version-22.x/SnapshotTesting.md
+++ b/website/versioned_docs/version-22.x/SnapshotTesting.md
@@ -14,8 +14,8 @@ A similar approach can be taken when it comes to testing your React components.
```javascript
import React from 'react';
-import Link from '../Link.react';
import renderer from 'react-test-renderer';
+import Link from '../Link.react';
it('renders correctly', () => {
const tree = renderer
diff --git a/website/versioned_docs/version-22.x/TutorialReact.md b/website/versioned_docs/version-22.x/TutorialReact.md
index fc444ea166bf..1a0b9b779bab 100644
--- a/website/versioned_docs/version-22.x/TutorialReact.md
+++ b/website/versioned_docs/version-22.x/TutorialReact.md
@@ -104,8 +104,8 @@ Now let's use React's test renderer and Jest's snapshot feature to interact with
```javascript
// Link.react.test.js
import React from 'react';
-import Link from '../Link.react';
import renderer from 'react-test-renderer';
+import Link from '../Link.react';
test('Link changes the class when hovered', () => {
const component = renderer.create(
diff --git a/website/versioned_docs/version-22.x/TutorialReactNative.md b/website/versioned_docs/version-22.x/TutorialReactNative.md
index 8f459f11b278..07768de532bd 100644
--- a/website/versioned_docs/version-22.x/TutorialReactNative.md
+++ b/website/versioned_docs/version-22.x/TutorialReactNative.md
@@ -73,9 +73,8 @@ Now let's use React's test renderer and Jest's snapshot feature to interact with
```javascript
// __tests__/Intro-test.js
import React from 'react';
-import Intro from '../Intro';
-
import renderer from 'react-test-renderer';
+import Intro from '../Intro';
test('renders correctly', () => {
const tree = renderer.create().toJSON();
diff --git a/website/versioned_docs/version-23.x/Puppeteer.md b/website/versioned_docs/version-23.x/Puppeteer.md
index feb39463c6a0..560932092fa8 100644
--- a/website/versioned_docs/version-23.x/Puppeteer.md
+++ b/website/versioned_docs/version-23.x/Puppeteer.md
@@ -56,11 +56,11 @@ Here's an example of the GlobalSetup script
```js
// setup.js
-const puppeteer = require('puppeteer');
-const mkdirp = require('mkdirp');
const path = require('path');
const fs = require('fs');
const os = require('os');
+const mkdirp = require('mkdirp');
+const puppeteer = require('puppeteer');
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
@@ -80,11 +80,11 @@ Then we need a custom Test Environment for puppeteer
```js
// puppeteer_environment.js
-const NodeEnvironment = require('jest-environment-node');
const fs = require('fs');
const path = require('path');
-const puppeteer = require('puppeteer');
const os = require('os');
+const puppeteer = require('puppeteer');
+const NodeEnvironment = require('jest-environment-node');
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
@@ -122,8 +122,8 @@ Finally we can close the puppeteer instance and clean-up the file
```js
// teardown.js
const os = require('os');
-const rimraf = require('rimraf');
const path = require('path');
+const rimraf = require('rimraf');
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
module.exports = async function () {
diff --git a/website/versioned_docs/version-23.x/SnapshotTesting.md b/website/versioned_docs/version-23.x/SnapshotTesting.md
index a0c4234b8cfc..1422a157b309 100644
--- a/website/versioned_docs/version-23.x/SnapshotTesting.md
+++ b/website/versioned_docs/version-23.x/SnapshotTesting.md
@@ -14,8 +14,8 @@ A similar approach can be taken when it comes to testing your React components.
```javascript
import React from 'react';
-import Link from '../Link.react';
import renderer from 'react-test-renderer';
+import Link from '../Link.react';
it('renders correctly', () => {
const tree = renderer
diff --git a/website/versioned_docs/version-23.x/TutorialReact.md b/website/versioned_docs/version-23.x/TutorialReact.md
index bb4815ec688c..cc137e64ce34 100644
--- a/website/versioned_docs/version-23.x/TutorialReact.md
+++ b/website/versioned_docs/version-23.x/TutorialReact.md
@@ -110,8 +110,8 @@ Now let's use React's test renderer and Jest's snapshot feature to interact with
```javascript
// Link.react.test.js
import React from 'react';
-import Link from '../Link.react';
import renderer from 'react-test-renderer';
+import Link from '../Link.react';
test('Link changes the class when hovered', () => {
const component = renderer.create(
diff --git a/website/versioned_docs/version-24.x/Puppeteer.md b/website/versioned_docs/version-24.x/Puppeteer.md
index 87a7260592e9..497f4feae42e 100644
--- a/website/versioned_docs/version-24.x/Puppeteer.md
+++ b/website/versioned_docs/version-24.x/Puppeteer.md
@@ -56,11 +56,11 @@ Here's an example of the GlobalSetup script
```js
// setup.js
-const puppeteer = require('puppeteer');
-const mkdirp = require('mkdirp');
const path = require('path');
const fs = require('fs');
const os = require('os');
+const mkdirp = require('mkdirp');
+const puppeteer = require('puppeteer');
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
@@ -80,11 +80,11 @@ Then we need a custom Test Environment for puppeteer
```js
// puppeteer_environment.js
-const NodeEnvironment = require('jest-environment-node');
const fs = require('fs');
const path = require('path');
-const puppeteer = require('puppeteer');
const os = require('os');
+const puppeteer = require('puppeteer');
+const NodeEnvironment = require('jest-environment-node');
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
@@ -124,8 +124,8 @@ Finally we can close the puppeteer instance and clean-up the file
```js
// teardown.js
const os = require('os');
-const rimraf = require('rimraf');
const path = require('path');
+const rimraf = require('rimraf');
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
module.exports = async function () {
diff --git a/website/versioned_docs/version-24.x/SnapshotTesting.md b/website/versioned_docs/version-24.x/SnapshotTesting.md
index b7637319e99e..941b1d1d3ed4 100644
--- a/website/versioned_docs/version-24.x/SnapshotTesting.md
+++ b/website/versioned_docs/version-24.x/SnapshotTesting.md
@@ -14,8 +14,8 @@ A similar approach can be taken when it comes to testing your React components.
```javascript
import React from 'react';
-import Link from '../Link.react';
import renderer from 'react-test-renderer';
+import Link from '../Link.react';
it('renders correctly', () => {
const tree = renderer
diff --git a/website/versioned_docs/version-24.x/TutorialReact.md b/website/versioned_docs/version-24.x/TutorialReact.md
index ba7b64cc5ec7..897e96a4b010 100644
--- a/website/versioned_docs/version-24.x/TutorialReact.md
+++ b/website/versioned_docs/version-24.x/TutorialReact.md
@@ -110,8 +110,8 @@ Now let's use React's test renderer and Jest's snapshot feature to interact with
```javascript
// Link.react.test.js
import React from 'react';
-import Link from '../Link.react';
import renderer from 'react-test-renderer';
+import Link from '../Link.react';
test('Link changes the class when hovered', () => {
const component = renderer.create(
diff --git a/website/versioned_docs/version-24.x/TutorialReactNative.md b/website/versioned_docs/version-24.x/TutorialReactNative.md
index e259972a85b9..7f0f1eabcb4d 100644
--- a/website/versioned_docs/version-24.x/TutorialReactNative.md
+++ b/website/versioned_docs/version-24.x/TutorialReactNative.md
@@ -73,9 +73,8 @@ Now let's use React's test renderer and Jest's snapshot feature to interact with
```javascript
// __tests__/Intro-test.js
import React from 'react';
-import Intro from '../Intro';
-
import renderer from 'react-test-renderer';
+import Intro from '../Intro';
test('renders correctly', () => {
const tree = renderer.create().toJSON();
diff --git a/website/versioned_docs/version-25.x/TutorialReact.md b/website/versioned_docs/version-25.x/TutorialReact.md
index e671f8e21bb3..9aea075967f9 100644
--- a/website/versioned_docs/version-25.x/TutorialReact.md
+++ b/website/versioned_docs/version-25.x/TutorialReact.md
@@ -110,8 +110,8 @@ Now let's use React's test renderer and Jest's snapshot feature to interact with
```javascript
// Link.react.test.js
import React from 'react';
-import Link from '../Link.react';
import renderer from 'react-test-renderer';
+import Link from '../Link.react';
test('Link changes the class when hovered', () => {
const component = renderer.create(
diff --git a/website/versioned_docs/version-25.x/TutorialReactNative.md b/website/versioned_docs/version-25.x/TutorialReactNative.md
index 458bf1e7778a..3feb6d23a810 100644
--- a/website/versioned_docs/version-25.x/TutorialReactNative.md
+++ b/website/versioned_docs/version-25.x/TutorialReactNative.md
@@ -73,9 +73,8 @@ Now let's use React's test renderer and Jest's snapshot feature to interact with
```javascript
// __tests__/Intro-test.js
import React from 'react';
-import Intro from '../Intro';
-
import renderer from 'react-test-renderer';
+import Intro from '../Intro';
test('renders correctly', () => {
const tree = renderer.create().toJSON();
diff --git a/website/versioned_docs/version-26.2/Puppeteer.md b/website/versioned_docs/version-26.2/Puppeteer.md
index b8dbffd3f4aa..d66259bca8c2 100644
--- a/website/versioned_docs/version-26.2/Puppeteer.md
+++ b/website/versioned_docs/version-26.2/Puppeteer.md
@@ -56,11 +56,11 @@ Here's an example of the GlobalSetup script
```js
// setup.js
-const puppeteer = require('puppeteer');
-const mkdirp = require('mkdirp');
const path = require('path');
const fs = require('fs');
const os = require('os');
+const mkdirp = require('mkdirp');
+const puppeteer = require('puppeteer');
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
@@ -80,11 +80,11 @@ Then we need a custom Test Environment for puppeteer
```js
// puppeteer_environment.js
-const NodeEnvironment = require('jest-environment-node');
const fs = require('fs');
const path = require('path');
-const puppeteer = require('puppeteer');
const os = require('os');
+const puppeteer = require('puppeteer');
+const NodeEnvironment = require('jest-environment-node');
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
@@ -124,8 +124,8 @@ Finally, we can close the puppeteer instance and clean-up the file
```js
// teardown.js
const os = require('os');
-const rimraf = require('rimraf');
const path = require('path');
+const rimraf = require('rimraf');
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
module.exports = async function () {
diff --git a/website/versioned_docs/version-26.2/SnapshotTesting.md b/website/versioned_docs/version-26.2/SnapshotTesting.md
index 555846b1521c..960a65bcb9f1 100644
--- a/website/versioned_docs/version-26.2/SnapshotTesting.md
+++ b/website/versioned_docs/version-26.2/SnapshotTesting.md
@@ -14,8 +14,8 @@ A similar approach can be taken when it comes to testing your React components.
```javascript
import React from 'react';
-import Link from '../Link.react';
import renderer from 'react-test-renderer';
+import Link from '../Link.react';
it('renders correctly', () => {
const tree = renderer
diff --git a/website/versioned_docs/version-26.2/TutorialReact.md b/website/versioned_docs/version-26.2/TutorialReact.md
index 6d40ce990dc7..170029193299 100644
--- a/website/versioned_docs/version-26.2/TutorialReact.md
+++ b/website/versioned_docs/version-26.2/TutorialReact.md
@@ -110,8 +110,8 @@ Now let's use React's test renderer and Jest's snapshot feature to interact with
```javascript
// Link.react.test.js
import React from 'react';
-import Link from '../Link.react';
import renderer from 'react-test-renderer';
+import Link from '../Link.react';
test('Link changes the class when hovered', () => {
const component = renderer.create(
diff --git a/website/versioned_docs/version-26.2/TutorialReactNative.md b/website/versioned_docs/version-26.2/TutorialReactNative.md
index d44d9aadde9f..8d0311543089 100644
--- a/website/versioned_docs/version-26.2/TutorialReactNative.md
+++ b/website/versioned_docs/version-26.2/TutorialReactNative.md
@@ -73,9 +73,8 @@ Now let's use React's test renderer and Jest's snapshot feature to interact with
```javascript
// __tests__/Intro-test.js
import React from 'react';
-import Intro from '../Intro';
-
import renderer from 'react-test-renderer';
+import Intro from '../Intro';
test('renders correctly', () => {
const tree = renderer.create().toJSON();
diff --git a/website/versioned_docs/version-26.4/SnapshotTesting.md b/website/versioned_docs/version-26.4/SnapshotTesting.md
index 776b3524e1bd..d09445461744 100644
--- a/website/versioned_docs/version-26.4/SnapshotTesting.md
+++ b/website/versioned_docs/version-26.4/SnapshotTesting.md
@@ -14,8 +14,8 @@ A similar approach can be taken when it comes to testing your React components.
```javascript
import React from 'react';
-import Link from '../Link.react';
import renderer from 'react-test-renderer';
+import Link from '../Link.react';
it('renders correctly', () => {
const tree = renderer
diff --git a/yarn.lock b/yarn.lock
index 01dac351ef57..e52658b4be4b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7934,13 +7934,13 @@ __metadata:
linkType: hard
"eslint-plugin-jest@npm:^24.0.0":
- version: 24.0.0
- resolution: "eslint-plugin-jest@npm:24.0.0"
+ version: 24.0.1
+ resolution: "eslint-plugin-jest@npm:24.0.1"
dependencies:
"@typescript-eslint/experimental-utils": ^4.0.1
peerDependencies:
eslint: ">=5"
- checksum: 5a210350b3e6c9da9ab536c6868e0eb8547e8e879168ac105241dd6df64883da1befd1c97eb75fedb1d54b57ec6bbb5f4f29e3b7a0d5ae35b0757e7346d5e62e
+ checksum: bebdd671949e3fbe537eea8ff5b485827d1c3e024bd22bb44f338502a5c5e0f520adc5d60454d7882ccd24cae9e76f8bb51dfb43596545631e2943c44e02d30f
languageName: node
linkType: hard
@@ -8031,12 +8031,12 @@ __metadata:
linkType: hard
"eslint-scope@npm:^5.0.0, eslint-scope@npm:^5.1.0":
- version: 5.1.0
- resolution: "eslint-scope@npm:5.1.0"
+ version: 5.1.1
+ resolution: "eslint-scope@npm:5.1.1"
dependencies:
- esrecurse: ^4.1.0
+ esrecurse: ^4.3.0
estraverse: ^4.1.1
- checksum: 4a0e97979a855d09c4bb3a3f4f945cefaf8f6638a6a8f49472cefb0cf64982ab7ed1683a1e63d20ce1bcb01f94c133dc7a5bdf03b28eb945999f50f08878a2b4
+ checksum: 79465cf5082f4216176f6d49c7d088de89ee890f912eb87b831f23ee9a5e17ed0f3f2ab6108fb8fefa0474ba5ebeaa9bdefbe49ba704bd879b73f2445e23ee10
languageName: node
linkType: hard
@@ -8064,8 +8064,8 @@ __metadata:
linkType: hard
"eslint@npm:^7.7.0":
- version: 7.8.1
- resolution: "eslint@npm:7.8.1"
+ version: 7.9.0
+ resolution: "eslint@npm:7.9.0"
dependencies:
"@babel/code-frame": ^7.0.0
"@eslint/eslintrc": ^0.1.3
@@ -8106,7 +8106,7 @@ __metadata:
v8-compile-cache: ^2.0.3
bin:
eslint: bin/eslint.js
- checksum: 0168d826ab2ae1fd04b9da8e457268f37d3ce7d0d83cc8a5cc659c8091673a112c356a6261ab178964291e7babd6ff4cf1011a15c70eb4f03a493ed5681206f9
+ checksum: 295fe8c442b9e9cc677fa03c88a873ad74c1d06620f4600745de83e5d4d10d53898cd1e15276e3420c976f00469d1ea8bbc5a4157c1f198753cece98f8903f5c
languageName: node
linkType: hard
@@ -8140,7 +8140,7 @@ __metadata:
languageName: node
linkType: hard
-"esrecurse@npm:^4.1.0":
+"esrecurse@npm:^4.3.0":
version: 4.3.0
resolution: "esrecurse@npm:4.3.0"
dependencies: