diff --git a/__mocks__/fs.js b/__mocks__/node:fs.js similarity index 100% rename from __mocks__/fs.js rename to __mocks__/node:fs.js diff --git a/packages/commander/src/utils/appendRevisionToVersion.ts b/packages/commander/src/utils/appendRevisionToVersion.ts index 1ec5f2c1c329..a11ee0029ff9 100644 --- a/packages/commander/src/utils/appendRevisionToVersion.ts +++ b/packages/commander/src/utils/appendRevisionToVersion.ts @@ -17,7 +17,7 @@ /** * External dependencies */ -import { execSync } from 'child_process'; +import { execSync } from 'node:child_process'; /** * Appends the current revision to the version number for nightly builds. diff --git a/packages/commander/src/utils/copyFiles.ts b/packages/commander/src/utils/copyFiles.ts index d347664ecd03..0f98c578cb1d 100644 --- a/packages/commander/src/utils/copyFiles.ts +++ b/packages/commander/src/utils/copyFiles.ts @@ -17,7 +17,7 @@ /** * External dependencies */ -import { execFileSync } from 'child_process'; +import { execFileSync } from 'node:child_process'; /** * Copies all files minuses ignored ones from source to target directory. diff --git a/packages/commander/src/utils/generateZipFile.ts b/packages/commander/src/utils/generateZipFile.ts index 6aca4c8eecc9..cd514b4337f6 100644 --- a/packages/commander/src/utils/generateZipFile.ts +++ b/packages/commander/src/utils/generateZipFile.ts @@ -18,7 +18,7 @@ * External dependencies */ import { dirname, basename, join } from 'node:path'; -import { execFileSync } from 'child_process'; +import { execFileSync } from 'node:child_process'; import { existsSync, unlinkSync } from 'node:fs'; /** diff --git a/packages/commander/src/utils/test/appendRevisionToVersion.js b/packages/commander/src/utils/test/appendRevisionToVersion.js index 21c65557857f..20e062057849 100644 --- a/packages/commander/src/utils/test/appendRevisionToVersion.js +++ b/packages/commander/src/utils/test/appendRevisionToVersion.js @@ -19,7 +19,7 @@ */ import appendRevisionToVersion from '../appendRevisionToVersion'; -jest.mock('child_process', () => { +jest.mock('node:child_process', () => { return { execSync: () => '1234567', }; diff --git a/packages/commander/src/utils/test/bundlePlugin.js b/packages/commander/src/utils/test/bundlePlugin.js index 2ba2c34e212b..39cc99b62c0f 100644 --- a/packages/commander/src/utils/test/bundlePlugin.js +++ b/packages/commander/src/utils/test/bundlePlugin.js @@ -27,8 +27,8 @@ import generateZipFile from '../generateZipFile'; import getCurrentVersionNumber from '../getCurrentVersionNumber'; import deleteExistingZipFiles from '../deleteExistingZipFiles'; -jest.mock('fs'); -jest.mock('child_process'); +jest.mock('node:fs'); +jest.mock('node:child_process'); jest.mock('../generateZipFile'); jest.mock('../getCurrentVersionNumber'); diff --git a/packages/commander/src/utils/test/copyFiles.js b/packages/commander/src/utils/test/copyFiles.js index 752983b01deb..b9f2ef207031 100644 --- a/packages/commander/src/utils/test/copyFiles.js +++ b/packages/commander/src/utils/test/copyFiles.js @@ -17,14 +17,14 @@ /** * External dependencies */ -import { execFileSync } from 'child_process'; +import { execFileSync } from 'node:child_process'; /** * Internal dependencies */ import copyFiles from '../copyFiles'; -jest.mock('child_process'); +jest.mock('node:child_process'); describe('copyFiles', () => { it('should sync source files to target', () => { diff --git a/packages/commander/src/utils/test/createBuild.js b/packages/commander/src/utils/test/createBuild.js index b2fe7f60aca1..5bd0a7957b02 100644 --- a/packages/commander/src/utils/test/createBuild.js +++ b/packages/commander/src/utils/test/createBuild.js @@ -25,7 +25,7 @@ import { __setMockFiles } from 'node:fs'; import createBuild from '../createBuild'; import copyFiles from '../copyFiles'; -jest.mock('fs'); +jest.mock('node:fs'); jest.mock('../getIgnoredFiles', () => jest.fn(() => ['bar.txt', 'baz/'])); jest.mock('../copyFiles'); diff --git a/packages/commander/src/utils/test/deleteExistingZipFiles.js b/packages/commander/src/utils/test/deleteExistingZipFiles.js index 250572e8cc9c..ea3bf6c29fd8 100644 --- a/packages/commander/src/utils/test/deleteExistingZipFiles.js +++ b/packages/commander/src/utils/test/deleteExistingZipFiles.js @@ -24,7 +24,7 @@ import { __setMockFiles, readdirSync } from 'node:fs'; */ import deleteExistingZipFiles from '../deleteExistingZipFiles'; -jest.mock('fs'); +jest.mock('node:fs'); describe('deleteExistingZipFiles', () => { const MOCK_FILE_INFO = { diff --git a/packages/commander/src/utils/test/generateZipFile.js b/packages/commander/src/utils/test/generateZipFile.js index 65af97647000..cf73ad0698bc 100644 --- a/packages/commander/src/utils/test/generateZipFile.js +++ b/packages/commander/src/utils/test/generateZipFile.js @@ -17,14 +17,14 @@ /** * External dependencies */ -import { execFileSync } from 'child_process'; +import { execFileSync } from 'node:child_process'; /** * Internal dependencies */ import generateZipFile from '../generateZipFile'; -jest.mock('child_process'); +jest.mock('node:child_process'); describe('generateZipFile', () => { it('should ZIP the web-stories directory', () => { diff --git a/packages/commander/src/utils/test/getCurrentVersionNumber.js b/packages/commander/src/utils/test/getCurrentVersionNumber.js index 86293a44b8ba..370fee6792fc 100644 --- a/packages/commander/src/utils/test/getCurrentVersionNumber.js +++ b/packages/commander/src/utils/test/getCurrentVersionNumber.js @@ -24,7 +24,7 @@ import { __setMockFiles } from 'node:fs'; */ import getCurrentVersionNumber from '../getCurrentVersionNumber'; -jest.mock('fs'); +jest.mock('node:fs'); const PLUGIN_FILE_CONTENT = ` { const MOCK_FILE_INFO = { diff --git a/packages/commander/src/utils/test/updateCdnUrl.js b/packages/commander/src/utils/test/updateCdnUrl.js index 58fcf3ff1923..447eb6be5d78 100644 --- a/packages/commander/src/utils/test/updateCdnUrl.js +++ b/packages/commander/src/utils/test/updateCdnUrl.js @@ -24,7 +24,7 @@ import { __setMockFiles, readFileSync } from 'node:fs'; */ import updateCdnUrl from '../updateCdnUrl'; -jest.mock('fs'); +jest.mock('node:fs'); const PLUGIN_FILE_CONTENT = ` jest.fn(() => '1.0.0-alpha+1234567') ); diff --git a/packages/karma-puppeteer-client/src/client.js b/packages/karma-puppeteer-client/src/client.js index 7dad9759762a..e7cdd6c4452a 100644 --- a/packages/karma-puppeteer-client/src/client.js +++ b/packages/karma-puppeteer-client/src/client.js @@ -14,7 +14,8 @@ * limitations under the License. */ -((global) => { +(function (global) { + 'use strict'; function noCleanup() {} @@ -26,7 +27,7 @@ * @return {*} Function result. */ function puppeteerFunction(methodName) { - return () => { + return function () { var args = Array.prototype.slice.call(arguments, 0); var name = '__karma_puppeteer_' + methodName; if (!window[name]) { @@ -48,7 +49,7 @@ */ function withSelector(methodName) { var func = puppeteerFunction(methodName); - return () => { + return function () { var args = Array.prototype.slice.call(arguments, 0); var node = args[0] && args[0].nodeType ? args[0] : null; var cleanup = noCleanup; @@ -56,7 +57,7 @@ var uniqueId = Math.random(); node.setAttribute('karma_puppeteer_id', uniqueId); args[0] = '[karma_puppeteer_id="' + uniqueId + '"]'; - cleanup = () => { + cleanup = function () { node.removeAttribute('karma_puppeteer_id'); }; } diff --git a/packages/story-editor/src/components/checklist/checks/videoOptimization.js b/packages/story-editor/src/components/checklist/checks/videoOptimization.js index ee73aa26e7e2..bd65c893a2a0 100644 --- a/packages/story-editor/src/components/checklist/checks/videoOptimization.js +++ b/packages/story-editor/src/components/checklist/checks/videoOptimization.js @@ -302,6 +302,7 @@ const BulkVideoOptimization = () => { }; const VideoOptimization = () => { + // `isTranscodingEnabled` already checks for `hasUploadMediaAction`. const { isTranscodingEnabled } = useFFmpeg(); return isTranscodingEnabled ? : null; diff --git a/packages/tinymce-button/src/index.js b/packages/tinymce-button/src/index.js index 8ebe25789d73..ea5031fd7cbd 100644 --- a/packages/tinymce-button/src/index.js +++ b/packages/tinymce-button/src/index.js @@ -43,13 +43,14 @@ if (!_.hasOwnProperty('pluck')) { _.pluck = _.map; } -tinymce.PluginManager.add('web_stories', (editor) => { +// eslint-disable-next-line prefer-arrow-callback -- Must not be an arrow function. +tinymce.PluginManager.add('web_stories', function (editor) { editor.addButton('web_stories', { text: __('Web Stories', 'web-stories'), classes: 'web-stories', image: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjA4IiBoZWlnaHQ9IjIwOCIgdmlld0JveD0iMCAwIDIwOCAyMDgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxjaXJjbGUgY3g9IjEwMCIgY3k9IjEwMCIgcj0iMTAwIiBmaWxsPSJibGFjayIvPgo8cGF0aCBkPSJNMTM1LjIgNjIuNDAwNUMxNDAuOTQ0IDYyLjQwMDUgMTQ1LjYgNjcuMDU2NyAxNDUuNiA3Mi44MDA1VjEzNS4yQzE0NS42IDE0MC45NDQgMTQwLjk0NCAxNDUuNiAxMzUuMiAxNDUuNlY2Mi40MDA1WiIgZmlsbD0id2hpdGUiLz4KPHBhdGggZD0iTTU3LjIgNjIuNDAwNUM1Ny4yIDU2LjY1NjcgNjEuODU2MiA1Mi4wMDA1IDY3LjYgNTIuMDAwNUgxMTQuNEMxMjAuMTQ0IDUyLjAwMDUgMTI0LjggNTYuNjU2NyAxMjQuOCA2Mi40MDA1VjE0NS42QzEyNC44IDE1MS4zNDQgMTIwLjE0NCAxNTYgMTE0LjQgMTU2SDY3LjZDNjEuODU2MiAxNTYgNTcuMiAxNTEuMzQ0IDU3LjIgMTQ1LjZWNjIuNDAwNVoiIGZpbGw9IndoaXRlIi8+CjxwYXRoIGQ9Ik0xNTYgNzIuODAwNUMxNjAuMzA4IDcyLjgwMDUgMTYzLjggNzYuMjkyNyAxNjMuOCA4MC42MDA1VjEyNy40QzE2My44IDEzMS43MDggMTYwLjMwOCAxMzUuMiAxNTYgMTM1LjJWNzIuODAwNVoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPg==', - onClick: () => { + onClick: function () { dispatch(store).setEditor(editor); dispatch(store).toggleModal(true); },