no-target-blank
What it does
Section titled “What it does”Reports a link to another site with target="_blank" that does not have both noopener and noreferrer in its rel. A link to a scheme or host and a computed link ({href}, bind:href, :href) count; a relative link does not.
Why it matters
Section titled “Why it matters”The opened page can reach this one through window.opener in old browsers and change its location (a phishing page), and it gets the referrer of the page it came from.
To fix, add rel="noopener noreferrer".
Example
Section titled “Example”... <template v-for="x in xs" :key="x"><li /></template>... <a :href="u" target="_blank">x</a> </div></template>Configuration
Section titled “Configuration”angular: lint: rules: no-target-blank: warn # off (default), warn, errorhtml: lint: rules: no-target-blank: warn # off (default), warn, errorsvelte: lint: rules: no-target-blank: warn # off (default), warn, errorvue: lint: rules: no-target-blank: warn # off (default), warn, errorSuppress one line with sudsy-disable-next-line no-target-blank in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| eslint-plugin-svelte | no-target-blank |
full | |
| eslint-plugin-vue | no-template-target-blank |
full | |
| html-eslint | no-target-blank |
partial | requires noopener as well as noreferrer (eslint-plugin-vue and -svelte do), html-eslint only noreferrer |