diff --git a/.eslintrc.js b/.eslintrc.js index d062c8460b038..f1680954b17f2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -94,6 +94,7 @@ module.exports = { 'stubFalse', 'stubTrue', 'sum', + 'sumBy', ], message: 'This Lodash method is not recommended. Please use native functionality instead. If using `memoize`, please use `memize` instead.', diff --git a/packages/block-library/src/columns/utils.js b/packages/block-library/src/columns/utils.js index 1d3c0bc5238b9..b75a7ad77bba1 100644 --- a/packages/block-library/src/columns/utils.js +++ b/packages/block-library/src/columns/utils.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { sumBy, merge, mapValues } from 'lodash'; +import { merge, mapValues } from 'lodash'; /** * Returns a column width attribute value rounded to standard precision. @@ -44,8 +44,10 @@ export function getTotalColumnsWidth( blocks, totalBlockCount = blocks.length ) { - return sumBy( blocks, ( block ) => - getEffectiveColumnWidth( block, totalBlockCount ) + return blocks.reduce( + ( sum, block ) => + sum + getEffectiveColumnWidth( block, totalBlockCount ), + 0 ); }