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

[Fix] jsx-no-target-blank: allow rel to be an expression #2544

Merged
merged 1 commit into from Jan 23, 2020
Merged

[Fix] jsx-no-target-blank: allow rel to be an expression #2544

merged 1 commit into from Jan 23, 2020

Conversation

odinho
Copy link
Contributor

@odinho odinho commented Jan 15, 2020

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.

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.
@odinho odinho requested review from yannickcr and ljharb and removed request for yannickcr January 15, 2020 14:13
@ljharb
Copy link
Member

ljharb commented Jan 16, 2020

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?

Copy link
Member

@ljharb ljharb left a 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>'},
Copy link
Member

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.

@odinho
Copy link
Contributor Author

odinho commented Jan 16, 2020

Added you as "write" collaborator.

Updated tests, removed target={null} and added one ' and one ` test.

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?

Ouch. That feels weird. I'm an organization member on that one though. -- But I'll use my private user place next time :)

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Thank you!

@ljharb ljharb merged commit e69b113 into jsx-eslint:master Jan 23, 2020
@ljharb ljharb deleted the odin/fix_braces_on_jsx-no-target-blank branch January 23, 2020 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

jsx-no-target-blank usage with jsx-curly-brace-presence
2 participants