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
[Fix] jsx-no-target-blank
: allow rel to be an expression
#2544
[Fix] jsx-no-target-blank
: allow rel to be an expression
#2544
Conversation
Previously this would be an error, since the rel wasn't read: <a target={"_blank"} href={"//"} rel={"noopener noreferrer"}> Now this works, so you can enable this rule together with `jsx-curly-brace-presence`. Fixes #2508.
Since you made this PR from a fork that isn't your own, I'm unable to force push to it (due to a github bug that they're unlikely to fix because so few people do this); would you mind adding me to https://github.com/whereby/eslint-plugin-react so i can? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, can you add tests using single quotes as well as backticks?
@@ -35,18 +35,23 @@ ruleTester.run('jsx-no-target-blank', rule, { | |||
{code: '<a href="foobar"></a>'}, | |||
{code: '<a randomTag></a>'}, | |||
{code: '<a target />'}, | |||
{code: '<a target={null}></a>'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't a valid target
attribute value; it might even result in a runtime warning from react.
Added you as "write" collaborator. Updated tests, removed
Ouch. That feels weird. I'm an organization member on that one though. -- But I'll use my private user place next time :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Previously this would be an error, since the rel wasn't read:
Now this works, so you can enable this rule together with
jsx-curly-brace-presence
.Fixes #2508.