From 5db4dc509e4a21743e9519ea0656658ea95348e2 Mon Sep 17 00:00:00 2001 From: ehmicky Date: Thu, 10 Dec 2020 18:04:21 +0100 Subject: [PATCH] Remove `lodash.flatten` --- .eslintrc.js | 1 - package.json | 1 - src/deploy/util.js | 4 ++-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index bb30819..d604829 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -28,7 +28,6 @@ module.exports = { 'promise/prefer-await-to-callbacks': 0, 'promise/prefer-await-to-then': 0, 'unicorn/filename-case': 0, - 'you-dont-need-lodash-underscore/flatten': 0, }, overrides: [...overrides], } diff --git a/package.json b/package.json index d9e0657..c069696 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,6 @@ "from2-array": "0.0.4", "hasha": "^5.0.0", "lodash.camelcase": "^4.3.0", - "lodash.flatten": "^4.4.0", "lodash.get": "^4.4.2", "lodash.set": "^4.3.2", "micro-api-client": "^3.3.0", diff --git a/src/deploy/util.js b/src/deploy/util.js index adff491..d30fbfc 100644 --- a/src/deploy/util.js +++ b/src/deploy/util.js @@ -1,6 +1,5 @@ const path = require('path') -const flatten = require('lodash.flatten') const pWaitFor = require('p-wait-for') // Default filter when scanning for files @@ -106,7 +105,8 @@ const waitForDeploy = async (api, deployId, siteId, timeout) => { // Transform the fileShaMap and fnShaMap into a generic shaMap that file-uploader.js can use const getUploadList = (required, shaMap) => { if (!required || !shaMap) return [] - return flatten(required.map((sha) => shaMap[sha])) + // TODO: use `Array.flatMap()` instead once we remove support for Node <11.0.0 + return [].concat(...required.map((sha) => shaMap[sha])) } module.exports = {