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

react/jsx-no-target-blank should allow noreferrer when allowReferrer is true #2924

Closed
edemaine opened this issue Feb 16, 2021 · 1 comment · Fixed by #2925
Closed

react/jsx-no-target-blank should allow noreferrer when allowReferrer is true #2924

edemaine opened this issue Feb 16, 2021 · 1 comment · Fixed by #2925

Comments

@edemaine
Copy link
Contributor

The spec says that noreferrer implies noopener, so it should always suffice to write just rel="noreferrer".

However, if you configure rule react/jsx-no-target-blank to allowReferrer, then links with rel="noreferrer" specified fail, even though it's equivalent to rel="noreferrer noopener".

Confusingly, the error message says Using target="_blank" without rel="noreferrer" is a security risk which makes it particularly tricky to figure out what's going on. (In my case, I forgot that I'd turned on allowReferrer.) I imagine it's not possible to configure the error message depending on the configuration?

Related discussion in #2054.

@ljharb
Copy link
Member

ljharb commented Feb 16, 2021

I think configuring the error message should be trivial; as for allowing noreferrer to exist alone, that was very intentionally disallowed, but was relaxed in #2043.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants