From: Lucas Di Pentima Date: Tue, 6 Jul 2021 15:06:52 +0000 (-0300) Subject: 17782: Fixes 'array-callback-return' compile warnings. X-Git-Tag: 2.2.2~29^2~10 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/0ea102c171d9c9e3fae5a0fd1e8e1e5e4a25c4d6 17782: Fixes 'array-callback-return' compile warnings. Reference: https://eslint.org/docs/rules/array-callback-return Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/src/common/config.ts b/src/common/config.ts index 55e99e01..f3d06840 100644 --- a/src/common/config.ts +++ b/src/common/config.ts @@ -142,7 +142,7 @@ const getApiRevision = async (apiUrl: string) => { const removeTrailingSlashes = (config: ClusterConfigJSON): ClusterConfigJSON => { const svcs: any = {}; - Object.keys(config.Services).map((s) => { + Object.keys(config.Services).forEach((s) => { svcs[s] = config.Services[s]; if (svcs[s].hasOwnProperty('ExternalURL')) { svcs[s].ExternalURL = svcs[s].ExternalURL.replace(/\/+$/, ''); diff --git a/src/services/common-service/common-service.ts b/src/services/common-service/common-service.ts index c19c1978..82777342 100644 --- a/src/services/common-service/common-service.ts +++ b/src/services/common-service/common-service.ts @@ -141,7 +141,7 @@ export class CommonService { // Using the POST special case to avoid URI length 414 errors. const formData = new FormData(); formData.append("_method", "GET"); - Object.keys(params).map(key => { + Object.keys(params).forEach(key => { if (params[key] !== undefined) { formData.append(key, params[key]); } diff --git a/src/store/collections-content-address-panel/collections-content-address-middleware-service.ts b/src/store/collections-content-address-panel/collections-content-address-middleware-service.ts index 9a4df10b..983b309a 100644 --- a/src/store/collections-content-address-panel/collections-content-address-middleware-service.ts +++ b/src/store/collections-content-address-panel/collections-content-address-middleware-service.ts @@ -89,7 +89,7 @@ export class CollectionsWithSameContentAddressMiddlewareService extends DataExpl .getFilters(), count: "none" }); - responseUsers.items.map(it => { + responseUsers.items.forEach(it => { api.dispatch(ownerNameActions.SET_OWNER_NAME({ name: it.uuid === userUuid ? 'User: Me' @@ -97,7 +97,7 @@ export class CollectionsWithSameContentAddressMiddlewareService extends DataExpl uuid: it.uuid })); }); - responseGroups.items.map(it => { + responseGroups.items.forEach(it => { api.dispatch(ownerNameActions.SET_OWNER_NAME({ name: `Project: ${it.name}`, uuid: it.uuid })); }); api.dispatch(setBreadcrumbs([{ label: 'Projects', uuid: userUuid }])); diff --git a/src/store/collections/collection-partial-copy-actions.ts b/src/store/collections/collection-partial-copy-actions.ts index 849716eb..49900f2c 100644 --- a/src/store/collections/collection-partial-copy-actions.ts +++ b/src/store/collections/collection-partial-copy-actions.ts @@ -130,7 +130,7 @@ export const copyCollectionPartialToSelectedCollection = ({ collectionUuid }: Co if (fileExistsInSelectedCollection) { return path; } else { - return; + return null; } }); const diffPathToRemove = difference(paths, pathsToRemove); diff --git a/src/store/favorite-panel/favorite-panel-middleware-service.ts b/src/store/favorite-panel/favorite-panel-middleware-service.ts index cb45e68e..f88f7b91 100644 --- a/src/store/favorite-panel/favorite-panel-middleware-service.ts +++ b/src/store/favorite-panel/favorite-panel-middleware-service.ts @@ -88,11 +88,11 @@ export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareServic .getFilters() }); const response = groupItems; - collectionItems.items.map((it: any) => { + collectionItems.items.forEach((it: any) => { response.itemsAvailable++; response.items.push(it); }); - processItems.items.map((it: any) => { + processItems.items.forEach((it: any) => { response.itemsAvailable++; response.items.push(it); }); diff --git a/src/store/public-favorites-panel/public-favorites-middleware-service.ts b/src/store/public-favorites-panel/public-favorites-middleware-service.ts index 04395ca2..dd21a380 100644 --- a/src/store/public-favorites-panel/public-favorites-middleware-service.ts +++ b/src/store/public-favorites-panel/public-favorites-middleware-service.ts @@ -87,11 +87,11 @@ export class PublicFavoritesMiddlewareService extends DataExplorerMiddlewareServ .getFilters() }); const response = groupItems; - collectionItems.items.map((it: any) => { + collectionItems.items.forEach((it: any) => { response.itemsAvailable++; response.items.push(it); }); - processItems.items.map((it: any) => { + processItems.items.forEach((it: any) => { response.itemsAvailable++; response.items.push(it); }); diff --git a/src/store/search-results-panel/search-results-middleware-service.ts b/src/store/search-results-panel/search-results-middleware-service.ts index 563db496..78ba6c38 100644 --- a/src/store/search-results-panel/search-results-middleware-service.ts +++ b/src/store/search-results-panel/search-results-middleware-service.ts @@ -54,7 +54,7 @@ export class SearchResultsMiddlewareService extends DataExplorerMiddlewareServic api.dispatch(setItems(initial)); } - sessions.map(session => { + sessions.forEach(session => { const params = getParams(dataExplorer, searchValue, session.apiRevision); this.services.groupsService.contents('', params, session) .then((response) => { diff --git a/src/views-components/context-menu/actions/download-action.tsx b/src/views-components/context-menu/actions/download-action.tsx index 22f0eb01..352f84bd 100644 --- a/src/views-components/context-menu/actions/download-action.tsx +++ b/src/views-components/context-menu/actions/download-action.tsx @@ -21,27 +21,26 @@ export const DownloadAction = (props: { href?: any, download?: any, onClick?: () return letter !== '/'; }); - filteredFileUrls - .map((href: string) => { - axios.get(href).then(response => response).then(({ data }: any) => { - const splittedByDot = href.split('.'); - if (splittedByDot[splittedByDot.length - 1] !== 'json') { - if (filteredFileUrls.length === id) { - zip.file(download[id - 1], data); - zip.generateAsync({ type: 'blob' }).then((content) => { - FileSaver.saveAs(content, `download-${props.currentCollectionUuid}.zip`); - }); - } else { - zip.file(download[id - 1], data); - zip.generateAsync({ type: 'blob' }); - } + filteredFileUrls.forEach((href: string) => { + axios.get(href).then(response => response).then(({ data }: any) => { + const splittedByDot = href.split('.'); + if (splittedByDot[splittedByDot.length - 1] !== 'json') { + if (filteredFileUrls.length === id) { + zip.file(download[id - 1], data); + zip.generateAsync({ type: 'blob' }).then((content) => { + FileSaver.saveAs(content, `download-${props.currentCollectionUuid}.zip`); + }); } else { - zip.file(download[id - 1], JSON.stringify(data)); + zip.file(download[id - 1], data); zip.generateAsync({ type: 'blob' }); } - id++; - }); + } else { + zip.file(download[id - 1], JSON.stringify(data)); + zip.generateAsync({ type: 'blob' }); + } + id++; }); + }); }; return props.href || props.kind === 'files' diff --git a/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx b/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx index b5f7d5f5..1900dda5 100644 --- a/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx +++ b/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx @@ -187,7 +187,7 @@ const virtualMachinesTable = (props: VirtualMachineProps) => } ; } - return; + return null; } ))} diff --git a/src/views/workbench/fed-login.tsx b/src/views/workbench/fed-login.tsx index 27b52116..14229519 100644 --- a/src/views/workbench/fed-login.tsx +++ b/src/views/workbench/fed-login.tsx @@ -34,11 +34,11 @@ export const FedLogin = connect(mapStateToProps)( {Object.keys(remoteHostsConfig) .map((k) => { if (k === localCluster) { - return; + return null; } if (!remoteHostsConfig[k].workbench2Url) { console.log(`Cluster ${k} does not define workbench2Url. Federated login / cross-site linking to ${k} is unavailable. Tell the admin of ${k} to set Services->Workbench2->ExternalURL in config.yml.`); - return; + return null; } const fedtoken = (remoteHostsConfig[k].loginCluster === localCluster) ? apiToken : getSaltedToken(k, apiToken);