Skip to content

Commit dd322b5

Browse files
committed
tree-wide: use noopener instead of noreferrer for target="_blank"
This will allow us to see when users click links to the pybricks.com website from the app.
1 parent 7277ddb commit dd322b5

File tree

7 files changed

+12
-6
lines changed

7 files changed

+12
-6
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module.exports = {
2727
'sort-imports': ['error', { ignoreDeclarationSort: true }],
2828
'import/order': ['error', { alphabetize: { order: 'asc' } }],
2929
'react-hooks/exhaustive-deps': 'error',
30+
'react/jsx-no-target-blank': ['error', { allowReferrer: true }],
3031
},
3132
settings: {
3233
react: { version: 'detect' },

src/alerts/UnexpectedErrorAlert.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const UnexpectedErrorAlert: React.VoidFunctionComponent<UnexpectedErrorAlertProp
6767
'is:issue',
6868
)}+${encodeURIComponent(error.message)}`}
6969
target="_blank"
70+
rel="noopener"
7071
>
7172
{i18n.translate('reportBug')}
7273
</AnchorButton>

src/ble/alerts/NoHub.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const NoHub: React.VoidFunctionComponent<NoHubProps> = ({ onFlashFirmware }) =>
2828
icon="help"
2929
href={pybricksBluetoothTroubleshootingUrl}
3030
target="_blank"
31+
rel="noopener"
3132
>
3233
{i18n.translate('noHub.troubleshootButton')}
3334
<ExternalLinkIcon />

src/firmware/alerts/NoDfuHub.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const NoDfuHub: React.VoidFunctionComponent<NoDfuHubProps> = ({
3838
icon="help"
3939
href={pybricksUsbLinuxUdevRulesUrl}
4040
target="_blank"
41+
rel="noopener"
4142
>
4243
{i18n.translate('noDfuHub.configureUdevRulesButton')}
4344
<ExternalLinkIcon />
@@ -47,6 +48,7 @@ const NoDfuHub: React.VoidFunctionComponent<NoDfuHubProps> = ({
4748
icon="help"
4849
href={pybricksUsbDfuTroubleshootingUrl}
4950
target="_blank"
51+
rel="noopener"
5052
>
5153
{i18n.translate('noDfuHub.troubleshootButton')}
5254
<ExternalLinkIcon />

src/firmware/bootloaderInstructions/BootloaderInstructions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ const BootloaderInstructions: React.VoidFunctionComponent<
348348
<a
349349
href={pybricksUsbLinuxUdevRulesUrl}
350350
target="_blank"
351-
rel="noreferrer"
351+
rel="noopener"
352352
>
353353
{i18n.translate('warning.linux.learnMore')}
354354
</a>

src/notifications/sagas.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,12 @@ function mapIcon(level: Level): IconName | undefined {
7575
* Converts a URL to an action that can be passed to `ToasterInstance.show()`.
7676
* @param helpUrl A URL.
7777
*/
78-
function helpAction(helpUrl: string): ActionProps & LinkProps {
78+
function helpAction(helpUrl: string): ActionProps & LinkProps & { rel: string } {
7979
return {
8080
icon: 'help',
8181
href: helpUrl,
8282
target: '_blank',
83+
rel: 'noopener',
8384
};
8485
}
8586

src/sponsor/SponsorDialog.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const SponsorDialog: React.VoidFunctionComponent = () => {
3838
<a
3939
href={pybricksTeamUrl}
4040
target="_blank"
41-
rel="noreferrer"
41+
rel="noopener"
4242
>
4343
{i18n.translate('whoAreWe.team.team')}
4444
</a>
@@ -74,7 +74,7 @@ const SponsorDialog: React.VoidFunctionComponent = () => {
7474
fill={true}
7575
href="https://github.com/sponsors/pybricks"
7676
target="_blank"
77-
rel="noreferrer"
77+
rel="noopener"
7878
>
7979
GitHub Sponsors
8080
<ExternalLinkIcon />
@@ -86,7 +86,7 @@ const SponsorDialog: React.VoidFunctionComponent = () => {
8686
fill={true}
8787
href="https://www.patreon.com/pybricks"
8888
target="_blank"
89-
rel="noreferrer"
89+
rel="noopener"
9090
>
9191
Patreon
9292
<ExternalLinkIcon />
@@ -98,7 +98,7 @@ const SponsorDialog: React.VoidFunctionComponent = () => {
9898
fill={true}
9999
href="https://paypal.me/pybricks"
100100
target="_blank"
101-
rel="noreferrer"
101+
rel="noopener"
102102
>
103103
Paypal
104104
<ExternalLinkIcon />

0 commit comments

Comments
 (0)