From dcb634cbe3b806292793d7854cd41eaa837b1be6 Mon Sep 17 00:00:00 2001 From: Bastian Schmidt Date: Fri, 12 Jan 2024 18:37:03 +0100 Subject: [PATCH] Fix eslint and drop react-intl * Incorporate eslint for .. in iteration * Drop react-intl as it is included in @theforeman/vendor --- package.json | 3 --- webpack/helper.js | 18 ++++++++---------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index f60942f..9fe1c63 100644 --- a/package.json +++ b/package.json @@ -23,9 +23,6 @@ "peerDependencies": { "@theforeman/vendor": ">= 6.0.0" }, - "dependencies": { - "react-intl": "^2.8.0" - }, "devDependencies": { "@babel/core": "^7.7.0", "@sheerun/mutationobserver-shim": "^0.3.3", diff --git a/webpack/helper.js b/webpack/helper.js index 181c579..d6996b9 100644 --- a/webpack/helper.js +++ b/webpack/helper.js @@ -49,24 +49,22 @@ const areReactElementsEqual = (element1, element2) => { /** * Recursively copies values from the source hash (`src`) to the destination hash (`dest`). + * Only keys that are members of dest are actually copied from src. * * @param {Object} dest - The destination hash to copy values into. * @param {Object} src - The source hash from which values are copied. * @returns {void} - The function modifies the destination hash in place. */ function deepCopy(dest, src) { - // eslint-disable-next-line no-unused-vars - for (const key in dest) { - if (dest.hasOwnProperty(key)) { - if (src.hasOwnProperty(key)) { - if (typeof dest[key] === 'object' && typeof src[key] === 'object') { - deepCopy(dest[key], src[key]); - } else if (dest[key] !== src[key]) { - dest[key] = src[key]; - } + Object.keys(dest).forEach(key => { + if (src.hasOwnProperty(key)) { + if (typeof dest[key] === 'object' && typeof src[key] === 'object') { + deepCopy(dest[key], src[key]); + } else if (dest[key] !== src[key]) { + dest[key] = src[key]; } } - } + }); } /**