From 0c4c63b5a5aec45042d76fc6befa436c2bf9f8a2 Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Fri, 12 Jan 2024 08:22:37 +0100 Subject: [PATCH] backport https://github.com/preactjs/preact/pull/3844 --- compat/src/index.js | 2 +- debug/src/debug.js | 2 +- test/polyfills.js | 24 ++++++++++++------------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/compat/src/index.js b/compat/src/index.js index 587dcd6c4e..9c10c18215 100644 --- a/compat/src/index.js +++ b/compat/src/index.js @@ -116,7 +116,7 @@ const StrictMode = Fragment; * @template Arg * @template Result * @param {(arg: Arg) => Result} callback function that runs before the flush - * @param {Arg} [arg] Optional arugment that can be passed to the callback + * @param {Arg} [arg] Optional argument that can be passed to the callback * @returns */ const flushSync = (callback, arg) => callback(arg); diff --git a/debug/src/debug.js b/debug/src/debug.js index a845f75d7e..9b1e42146e 100644 --- a/debug/src/debug.js +++ b/debug/src/debug.js @@ -70,7 +70,7 @@ export function initDebug() { try { oldCatchError(error, vnode, oldVNode); - // when an error was handled by an ErrorBoundary we will nontheless emit an error + // when an error was handled by an ErrorBoundary we will nonetheless emit an error // event on the window object. This is to make up for react compatibility in dev mode // and thus make the Next.js dev overlay work. if (typeof error.then != 'function') { diff --git a/test/polyfills.js b/test/polyfills.js index 54c4e87426..64e2ff355c 100644 --- a/test/polyfills.js +++ b/test/polyfills.js @@ -18,7 +18,7 @@ if (!function f() {}.name) { chai.use((chai, util) => { const Assertion = chai.Assertion; - Assertion.addMethod('equalNode', function(expectedNode, message) { + Assertion.addMethod('equalNode', function (expectedNode, message) { const obj = this._obj; message = message || 'equalNode'; @@ -52,7 +52,7 @@ chai.use((chai, util) => { // // The following code overwrites karma's internal logging feature to -// support a much prettier and humand readable represantation of +// support a much prettier and humand readable representation of // console logs in our terminal. This includes indentation, coloring // and support for Map and Set objects. // @@ -76,7 +76,7 @@ patchConsole('info'); * @returns {[string]} */ function serializeConsoleArgs(args) { - const flat = args.map(arg => serialize(arg, 'flat', 0, new Set())); + const flat = args.map((arg) => serialize(arg, 'flat', 0, new Set())); // We don't have access to the users terminal width, so we'll try to // format everything into one line if possible and assume a terminal // width of 80 chars @@ -84,7 +84,7 @@ function serializeConsoleArgs(args) { return [flat.join(', ')]; } - const serialized = args.map(arg => serialize(arg, 'default', 0, new Set())); + const serialized = args.map((arg) => serialize(arg, 'default', 0, new Set())); return ['\n' + serialized.join(',\n') + '\n']; } @@ -113,17 +113,17 @@ function serialize(value, mode, indent, seen) { return kl.bold('null'); } else if (Array.isArray(value)) { seen.add(value); - const values = value.map(v => serialize(v, mode, indent + 1, seen)); + const values = value.map((v) => serialize(v, mode, indent + 1, seen)); if (mode === 'flat') { return `[ ${values.join(', ')} ]`; } const space = applyIndent(indent); - const pretty = values.map(v => applyIndent(indent + 1) + v).join(',\n'); + const pretty = values.map((v) => applyIndent(indent + 1) + v).join(',\n'); return `[\n${pretty}\n${space}]`; } else if (value instanceof Set) { const values = []; - value.forEach(v => { + value.forEach((v) => { values.push(serialize(v, mode, indent, seen)); }); @@ -131,7 +131,7 @@ function serialize(value, mode, indent, seen) { return `Set(${value.size}) { ${values.join(', ')} }`; } - const pretty = values.map(v => applyIndent(indent + 1) + v).join(',\n'); + const pretty = values.map((v) => applyIndent(indent + 1) + v).join(',\n'); return `Set(${value.size}) {\n${pretty}\n${applyIndent(indent)}}`; } else if (value instanceof Map) { const values = []; @@ -143,12 +143,12 @@ function serialize(value, mode, indent, seen) { }); if (mode === 'flat') { - const pretty = values.map(v => `${v[0]} => ${v[1]}`).join(', '); + const pretty = values.map((v) => `${v[0]} => ${v[1]}`).join(', '); return `Map(${value.size}) { ${pretty} }`; } const pretty = values - .map(v => { + .map((v) => { return applyIndent(indent + 1) + `${v[0]} => ${v[1]}`; }) .join(', '); @@ -184,7 +184,7 @@ function serialize(value, mode, indent, seen) { seen.add(value); - const props = Object.keys(value).map(key => { + const props = Object.keys(value).map((key) => { const v = serialize(value[key], mode, indent + 1, seen); return `${key}: ${v}`; }); @@ -196,7 +196,7 @@ function serialize(value, mode, indent, seen) { return `{ ${pretty} }`; } - const pretty = props.map(p => applyIndent(indent + 1) + p).join(',\n'); + const pretty = props.map((p) => applyIndent(indent + 1) + p).join(',\n'); return `{\n${pretty}\n${applyIndent(indent)}}`; }