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

Conversation

@odinho
Copy link
Contributor

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 Jan 15, 2020
@ljharb

This comment has been minimized.

Copy link
Collaborator

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
Collaborator

ljharb left a comment

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>'},

This comment has been minimized.

Copy link
@ljharb

ljharb Jan 16, 2020

Collaborator

this isn't a valid target attribute value; it might even result in a runtime warning from react.

@odinho

This comment has been minimized.

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 :)

@ljharb
ljharb approved these changes Jan 23, 2020
Copy link
Collaborator

ljharb left a comment

Thank you!

@ljharb ljharb merged commit e69b113 into yannickcr:master Jan 23, 2020
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.0005%) to 97.606%
Details
@ljharb ljharb deleted the whereby:odin/fix_braces_on_jsx-no-target-blank branch Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.