Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(incomplete) new failing test, <a target="_blank noopener"> #3457

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions tests/lib/rules/jsx-no-target-blank.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ ruleTester.run('jsx-no-target-blank', rule, {
output: '<a target="_blank" rel="no referrer noreferrer" href="https://example.com/7"></a>',
errors: defaultErrors,
},
{
code: '<a href="https://example.com/7a-run-on" target="_blank rel=noopener"></a>',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think i could see a general rule for "on an html element, is there an attribute value that has an = sign in it where the LHS of the = sign is a valid attribute" - which would cover this case. that would share some knowledge with the no-unknown-property rule, and would likely be able to offer suggestions but NOT autofix. Is that something you're interested in building?

output: '<a target="_blank noopener" href="https://example.com/7a-run-on"></a>',
errors: [{ messageId: 'noTargetBlankIntendedIneffective' }],
},
{
code: '<a target="_BLANK" href="https://example.com/8"></a>',
output: '<a target="_BLANK" href="https://example.com/8" rel="noreferrer"></a>',
Expand Down