17782: Fixes 'react/jsx-no-target-blank' compile warnings.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 6 Jul 2021 15:29:01 +0000 (12:29 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 6 Jul 2021 15:29:01 +0000 (12:29 -0300)
Reference:
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md

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

src/components/details-attribute/details-attribute.tsx
src/views-components/context-menu/actions/file-viewer-action.tsx
src/views-components/main-app-bar/help-menu.tsx
src/views-components/repositories-sample-git-dialog/repositories-sample-git-dialog.tsx
src/views-components/webdav-s3-dialog/webdav-s3-dialog.tsx
src/views/virtual-machine-panel/virtual-machine-user-panel.tsx

index 7b2b119ba9782926340cdc7445faf940b5077378..e52c487d6bbe33967e4786c54eb0655e947173b2 100644 (file)
@@ -95,10 +95,10 @@ export const DetailsAttribute = connect(mapStateToProps)(withStyles(styles)(
                 if (linkUrl[0] === '/') {
                     valueNode = <Link to={linkUrl} className={classes.link}>{uuid}</Link>;
                 } else {
-                    valueNode = <a href={linkUrl} className={classes.link} target='_blank'>{uuid}</a>;
+                    valueNode = <a href={linkUrl} className={classes.link} target='_blank' rel="noopener noreferrer">{uuid}</a>;
                 }
             } else if (link) {
-                valueNode = <a href={link} className={classes.link} target='_blank'>{value}</a>;
+                valueNode = <a href={link} className={classes.link} target='_blank' rel="noopener noreferrer">{value}</a>;
             } else {
                 valueNode = value;
             }
index bc3d0bd60af22380149c75e8a1b422cfb8fa50d7..5d98ab6e131bf3ad7716f4a49e5d6a30467265cf 100644 (file)
@@ -12,6 +12,7 @@ export const FileViewerAction = (props: any) => {
             style={{ textDecoration: 'none' }}
             href={props.href}
             target="_blank"
+            rel="noopener noreferrer"
             onClick={props.onClick}>
             <ListItem button>
                 <ListItemIcon>
index 55e0424bf2b6fa2fd0ca9de0c8cfedd521d3583b..af76e4f127daa760b849eb884b26545c5844adf6 100644 (file)
@@ -72,7 +72,7 @@ export const HelpMenu = compose(
                 {
                     links.map(link =>
                         <MenuItem key={link.title}>
-                            <a href={link.link} target="_blank" className={classes.link}>
+                            <a href={link.link} target="_blank" rel="noopener noreferrer" className={classes.link}>
                                 <ImportContactsIcon className={classes.icon} />
                                 <Typography className={classes.linkTitle}>{link.title}</Typography>
                             </a>
index 704f13f23d42b463f5e75d5eb916b5a470852fd5..854f3f4f68173a710317ee23f772f07b8b117ab5 100644 (file)
@@ -54,8 +54,8 @@ export const RepositoriesSampleGitDialog = compose(
                         lines={[snippetText(props.data.uuidPrefix)]} />
                     <Typography variant='body1' className={props.classes.spacing}>
                         See also:
-                        <div><a href="https://doc.arvados.org/user/getting_started/ssh-access-unix.html" className={props.classes.link} target="_blank">SSH access</a></div>
-                        <div><a href="https://doc.arvados.org/user/tutorials/tutorial-firstscript.html" className={props.classes.link} target="_blank">Writing a Crunch Script</a></div>
+                        <div><a href="https://doc.arvados.org/user/getting_started/ssh-access-unix.html" className={props.classes.link} target="_blank" rel="noopener noreferrer">SSH access</a></div>
+                        <div><a href="https://doc.arvados.org/user/tutorials/tutorial-firstscript.html" className={props.classes.link} target="_blank" rel="noopener noreferrer">Writing a Crunch Script</a></div>
                     </Typography>
                 </DialogContent>
                 <DialogActions>
index 181e6e28a27a8ba60c84bf5316ae32702c551bb4..39c1068ecff013992f5e6b4a224b041d0c15eb00 100644 (file)
@@ -161,7 +161,7 @@ export const WebDavS3InfoDialog = compose(
 
                     <DetailsAttribute
                         label='Internet address'
-                        value={<a href={winDav.toString()} target="_blank">{winDav.toString()}</a>}
+                        value={<a href={winDav.toString()} target="_blank" rel="noopener noreferrer">{winDav.toString()}</a>}
                         copyValue={winDav.toString()} />
 
                     <DetailsAttribute
@@ -191,7 +191,7 @@ export const WebDavS3InfoDialog = compose(
                 <TabPanel index={0} value={activeTab}>
                     <DetailsAttribute
                         label='Server'
-                        value={<a href={cyberDavStr} target="_blank">{cyberDavStr}</a>}
+                        value={<a href={cyberDavStr} target="_blank" rel="noopener noreferrer">{cyberDavStr}</a>}
                         copyValue={cyberDavStr} />
 
                     <DetailsAttribute
index 1900dda546a40874b0804a83a9e6ef8fd44e52c1..10be5d63442348a8e4b40e25f060bab1f4bf2153 100644 (file)
@@ -134,7 +134,7 @@ const CardContentWithVirtualMachines = (props: VirtualMachineProps) =>
                         {virtualMachineSendRequest(props)}
                     </div>
                     <div className={props.classes.icon}>
-                        <a href="https://doc.arvados.org/user/getting_started/vm-login-with-webshell.html" target="_blank" className={props.classes.linkIcon}>
+                        <a href="https://doc.arvados.org/user/getting_started/vm-login-with-webshell.html" target="_blank" rel="noopener noreferrer" className={props.classes.linkIcon}>
                             <Tooltip title="Access VM using webshell">
                                 <HelpIcon />
                             </Tooltip>
@@ -181,7 +181,7 @@ const virtualMachinesTable = (props: VirtualMachineProps) =>
                                 {command}
                             </TableCell>
                             {props.webShell !== "" && <TableCell>
-                                <a href={`${props.webShell}${it.href}/webshell/${username}`} target="_blank" className={props.classes.link}>
+                                <a href={`${props.webShell}${it.href}/webshell/${username}`} target="_blank" rel="noopener noreferrer" className={props.classes.link}>
                                     Log in as {username}
                                 </a>
                             </TableCell>}