Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions crates/oxc_linter/src/rules/react/jsx_no_target_blank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ impl JsxNoTargetBlank {
declare_oxc_lint!(
/// ### What it does
/// This rule aims to prevent user generated link hrefs and form actions from creating security vulnerabilities by
/// requiring rel='noreferrer' for external link hrefs and form actions, and optionally any dynamically generated link
/// hrefs and form actions.
/// requiring `rel='noreferrer'` for external link hrefs and form actions, and optionally any dynamically generated
/// link hrefs and form actions.
///
/// ### Why is this bad?
///
/// When creating a JSX element that has an a tag, it is often desired to have the link open in a new tab using the
/// target='_blank' attribute. Using this attribute unaccompanied by rel='noreferrer', however, is a severe security
/// vulnerability (see noreferrer docs and noopener docs for more details) This rules requires that you accompany
/// target='_blank' attributes with rel='noreferrer'.
/// When creating a JSX element that has an `a` tag, it is often desired to have the link open in a new tab using the
/// `target='_blank'` attribute. Using this attribute unaccompanied by `rel='noreferrer'`, however, is a severe security
/// vulnerability (see [`noreferrer` docs] and [`noopener` docs] for more details).
/// This rules requires that you accompany `target='_blank'` attributes with `rel='noreferrer'`.
///
/// ### Example
/// ```jsx
Expand All @@ -114,6 +114,9 @@ declare_oxc_lint!(
/// var Hello = <a target='_blank' href="https://example.com/"></a>
/// var Hello = <a target='_blank' href={dynamicLink}></a>
/// ```
///
/// [`noreferrer` docs]: https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer
/// [`noopener` docs]: https://html.spec.whatwg.org/multipage/links.html#link-type-noopener
JsxNoTargetBlank,
correctness
);
Expand Down