DEV: enforces link-rel-noopener linting rule (#8936)

* DEV: enforces link-rel-noopener linting rule

* oops

* better syntax
This commit is contained in:
Joffrey JAFFEUX 2020-03-06 17:35:18 +01:00 committed by GitHub
parent 91682408e0
commit a24f51278a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 30 additions and 23 deletions

View File

@ -6,6 +6,7 @@ module.exports = {
"self-closing-void-elements": true,
"table-groups": true,
"style-concatenation": true,
"no-invalid-interactive": true
"no-invalid-interactive": true,
"link-rel-noopener": true
}
};

View File

@ -5,7 +5,7 @@
<h1>{{i18n 'admin.badges.badge_intro.title'}}</h1>
<div class="external-resources">
{{#each badgeIntroLinks as |link|}}
<a href={{link.href}} class="external-link" target="_blank">
<a href={{link.href}} class="external-link" target="_blank" rel="noopener">
{{d-icon link.icon}}
<span>{{I18n link.text}}</span>
</a>

View File

@ -2,20 +2,22 @@
<div class='wrapper'>
<h2>{{i18n 'admin.customize.theme.edit_css_html'}} {{#link-to showRouteName model.id replace=true}}{{model.name}}{{/link-to}}</h2>
{{admin-theme-editor
theme=model
editRouteName=editRouteName
{{admin-theme-editor
theme=model
editRouteName=editRouteName
currentTargetName=currentTargetName
fieldName=fieldName
fieldAdded=(action 'fieldAdded')
maximized=maximized
onlyOverriddenChanged=(action 'onlyOverriddenChanged')
}}
<div class='admin-footer'>
<div class='status-actions'>
{{#unless model.changed}}
<a class='preview-link' href={{previewUrl}} target='_blank' title="{{i18n 'admin.customize.explain_preview'}}">{{i18n 'admin.customize.preview'}}</a>
<a class='preview-link' href={{previewUrl}} rel="noopener" target='_blank' title="{{i18n 'admin.customize.explain_preview'}}">
{{i18n 'admin.customize.preview'}}
</a>
{{/unless}}
</div>

View File

@ -7,7 +7,7 @@
</div>
<div class="external-resources">
{{#each externalResources as |resource|}}
<a href={{resource.link}} class="external-link" target="_blank">
<a href={{resource.link}} class="external-link" rel="noopener" target="_blank">
{{d-icon resource.icon}}
{{I18n resource.key}}
</a>

View File

@ -206,7 +206,7 @@
<ul class='removable-list'>
{{#each model.uploads as |upload|}}
<li>
<span class='col'>${{upload.name}}: <a href={{upload.url}} target='_blank'>{{upload.filename}}</a></span>
<span class='col'>${{upload.name}}: <a href={{upload.url}} rel="noopener" target='_blank'>{{upload.filename}}</a></span>
<span class='col'>
{{d-button action=(action "removeUpload") actionParam=upload class="second btn-default btn-default cancel-edit" icon="times"}}
</span>
@ -241,8 +241,8 @@
</div>
{{/if}}
<a href='{{previewUrl}}' title="{{i18n 'admin.customize.explain_preview'}}" target='_blank' class='btn btn-default'>{{d-icon 'desktop'}}{{i18n 'admin.customize.theme.preview'}}</a>
<a class="btn btn-default export" target="_blank" href={{downloadUrl}}>{{d-icon "download"}} {{i18n 'admin.export_json.button_text'}}</a>
<a href='{{previewUrl}}' title="{{i18n 'admin.customize.explain_preview'}}" rel="noopener" target='_blank' class='btn btn-default'>{{d-icon 'desktop'}}{{i18n 'admin.customize.theme.preview'}}</a>
<a class="btn btn-default export" rel="noopener" target="_blank" href={{downloadUrl}}>{{d-icon "download"}} {{i18n 'admin.export_json.button_text'}}</a>
{{d-button action=(action "switchType") label="admin.customize.theme.convert" icon=convertIcon class="btn-default btn-normal" title=convertTooltip}}

View File

@ -11,7 +11,7 @@
{{#each themes as |theme|}}
<div class="popular-theme-item">
<div class="popular-theme-name">
<a href="{{theme.meta_url}}" target="_blank">
<a href="{{theme.meta_url}}" rel="noopener" target="_blank">
{{#if theme.component}}
{{d-icon 'puzzle-piece' title='admin.customize.theme.component'}}
{{/if}}
@ -33,7 +33,7 @@
action=(action "installThemeFromList" theme.value)}}
{{#if theme.preview}}
<a href="{{theme.preview}}" target="_blank">{{d-icon "desktop"}} {{I18n "admin.customize.theme.preview"}}</a>
<a href="{{theme.preview}}" rel="noopener" target="_blank">{{d-icon "desktop"}} {{I18n "admin.customize.theme.preview"}}</a>
{{/if}}
{{/if}}
</div>

View File

@ -2,7 +2,7 @@
<div class="popular-theme-name">
{{theme.name}}
{{#if theme.preview}}
<a href="{{theme.preview}}" title="Preview" target="_blank">{{d-icon "far-eye"}}</a>
<a href="{{theme.preview}}" title="Preview" rel="noopener" target="_blank">{{d-icon "far-eye"}}</a>
{{/if}}
</div>
<div class="popular-theme-buttons">

View File

@ -27,7 +27,7 @@
<td class="plugin-name">
{{#if plugin.url}}
<a href={{plugin.url}} target="_blank">{{plugin.name}}</a>
<a href={{plugin.url}} rel="noopener" target="_blank">{{plugin.name}}</a>
{{else}}
{{plugin.name}}
{{/if}}

View File

@ -8,7 +8,7 @@
<h3>{{dash-if-empty versionCheck.installed_version}}</h3>
{{#if versionCheck.gitLink}}
<div class="sha-link">
(<a href={{versionCheck.gitLink}} target="_blank">{{versionCheck.shortSha}}</a>)
(<a href={{versionCheck.gitLink}} rel="noopener" target="_blank">{{versionCheck.shortSha}}</a>)
</div>
{{/if}}
</div>

View File

@ -8,6 +8,7 @@
<a download="backup_codes.txt"
class="btn no-text btn-icon backup-codes-download-btn"
rel="noopener"
target="_blank"
href="data:application/octet-stream;charset=utf-8;base64,{{base64BackupCode}}">
{{d-icon "download"}}

View File

@ -25,7 +25,7 @@
<dt>{{i18n "ip_lookup.location"}}</dt>
<dd>
{{#if location.location}}
<a href="https://maps.google.com/maps?q={{unbound location.latitude}},{{unbound location.longitude}}" target="_blank">
<a href="https://maps.google.com/maps?q={{unbound location.latitude}},{{unbound location.longitude}}" rel="noopener" target="_blank">
{{location.location}}
</a>
{{else}}

View File

@ -160,7 +160,8 @@
<span class='website-name'>
{{d-icon "globe"}}
{{#if linkWebsite}}
<a href="{{user.website}}" rel={{unless removeNoFollow 'nofollow ugc noopener'}}
{{!-- template-lint-disable --}}
<a href="{{user.website}}" rel="noopener {{unless removeNoFollow 'nofollow ugc'}}"
target="_blank">{{user.website_name}}</a>
{{else}}
<span title={{user.website}}>{{user.website_name}}</span>

View File

@ -12,7 +12,7 @@
<td class="topic-title">
<div class='combined-title'>
{{topic-status topic=rt}}
<a href={{rt.relative_url}} target="_blank">{{replace-emoji rt.fancy_title}}</a>
<a href={{rt.relative_url}} rel="noopener" target="_blank">{{replace-emoji rt.fancy_title}}</a>
</div>
</td>
<td class="reviewable-count">

View File

@ -17,7 +17,7 @@
{{d-button icon="plus" action=(route-action "showInvite") label="user.invited.create"}}
{{#if canBulkInvite}}
{{csv-uploader uploading=uploading}}
<a href="https://meta.discourse.org/t/sending-bulk-user-invites/16468" target="_blank" style="color:black;">{{d-icon "question-circle"}}</a>
<a href="https://meta.discourse.org/t/sending-bulk-user-invites/16468" rel="noopener" target="_blank" style="color:black;">{{d-icon "question-circle"}}</a>
{{/if}}
{{#if showBulkActionButtons}}
{{#if rescindedAll}}

View File

@ -110,7 +110,8 @@
<div class="user-profile-website">
{{d-icon "globe"}}
{{#if linkWebsite}}
<a href={{model.website}} rel={{unless removeNoFollow 'nofollow ugc noopener'}} target="_blank">{{model.website_name}}</a>
{{!-- template-lint-disable --}}
<a href={{model.website}} rel="noopener {{unless removeNoFollow 'nofollow ugc'}}" target="_blank">{{model.website_name}}</a>
{{else}}
<span title={{model.website}}>{{model.website_name}}</span>
{{/if}}

View File

@ -77,10 +77,11 @@
<ul>
{{#each model.links as |link|}}
<li>
{{!-- template-lint-disable --}}
<a class='domain'
href='{{unbound link.url}}'
title='{{unbound link.title}}'
rel='{{unless user.removeNoFollow 'nofollow ugc noopener'}}'
rel='noopener {{unless user.removeNoFollow 'nofollow ugc'}}'
target='_blank'>
{{shorten-url link.url}}
</a>

View File

@ -1,5 +1,5 @@
{{#each popular_components as |theme|}}
<a class="popular-theme-item" href="{{theme.meta_url}}" target="_blank">
<a class="popular-theme-item" href="{{theme.meta_url}}" rel="noopener" target="_blank">
{{theme.name}}
</a>
{{/each}}