17782: Fixes 'array-callback-return' compile warnings.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 6 Jul 2021 15:06:52 +0000 (12:06 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 6 Jul 2021 15:06:52 +0000 (12:06 -0300)
Reference: https://eslint.org/docs/rules/array-callback-return

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

src/common/config.ts
src/services/common-service/common-service.ts
src/store/collections-content-address-panel/collections-content-address-middleware-service.ts
src/store/collections/collection-partial-copy-actions.ts
src/store/favorite-panel/favorite-panel-middleware-service.ts
src/store/public-favorites-panel/public-favorites-middleware-service.ts
src/store/search-results-panel/search-results-middleware-service.ts
src/views-components/context-menu/actions/download-action.tsx
src/views/virtual-machine-panel/virtual-machine-user-panel.tsx
src/views/workbench/fed-login.tsx

index 55e99e010451646c236d18c9c487b26aca72a1ef..f3d06840497968eba7388a523d05621038d07ff8 100644 (file)
@@ -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(/\/+$/, '');
index c19c19784bee4096011c29b834cfb4780db92200..82777342b3b9931412ecacdac8290d240cf7fdc4 100644 (file)
@@ -141,7 +141,7 @@ export class CommonService<T> {
             // 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]);
                 }
index 9a4df10b83552564035673367506556f245a3ff5..983b309aa4543f1edf0c8d5a903ffc48b552411b 100644 (file)
@@ -89,7 +89,7 @@ export class CollectionsWithSameContentAddressMiddlewareService extends DataExpl
                         .getFilters(),
                     count: "none"
                 });
-                responseUsers.items.map(it => {
+                responseUsers.items.forEach(it => {
                     api.dispatch<any>(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<any>(ownerNameActions.SET_OWNER_NAME({ name: `Project: ${it.name}`, uuid: it.uuid }));
                 });
                 api.dispatch<any>(setBreadcrumbs([{ label: 'Projects', uuid: userUuid }]));
index 849716eb5b55f15e803d0be28633b49b8a6c3af5..49900f2c288d80d739f5d11f131f9cd17a88dba2 100644 (file)
@@ -130,7 +130,7 @@ export const copyCollectionPartialToSelectedCollection = ({ collectionUuid }: Co
                     if (fileExistsInSelectedCollection) {
                         return path;
                     } else {
-                        return;
+                        return null;
                     }
                 });
                 const diffPathToRemove = difference(paths, pathsToRemove);
index cb45e68ef7865ae8448f27403c4445e4d271a5c2..f88f7b914d3ace2a5bd1e7fe75b77ebbe8fd89ba 100644 (file)
@@ -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);
                 });
index 04395ca22c26d91ea3f3b562d6104a3cf4a00d48..dd21a38026642c3cf576c957d6b98559d2a9a302 100644 (file)
@@ -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);
                 });
index 563db4964d3a3cca347383ea3704b909da425dbb..78ba6c38bf130b2b34ab067d80e893f6edbb4135 100644 (file)
@@ -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) => {
index 22f0eb0153d2d5035d49c0d52b0d56fe8996c913..352f84bd58049863f5b7e5ab55b46afcaf86b250 100644 (file)
@@ -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'
index b5f7d5f55f57b9a5ae1d8e06e6b739a805689e44..1900dda546a40874b0804a83a9e6ef8fd44e52c1 100644 (file)
@@ -187,7 +187,7 @@ const virtualMachinesTable = (props: VirtualMachineProps) =>
                             </TableCell>}
                         </TableRow>;
                     }
-                    return;
+                    return null;
                 }
                 ))}
         </TableBody>
index 27b52116739ea2edbfd6445e7517c193bf7cd49c..142295197fba68192c1597e0267f0315ff8b3970 100644 (file)
@@ -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);