Navigation Menu

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

[New] jsx-no-target-blank: Improve fixer with option allowReferrer #3167

Merged

Conversation

apepper
Copy link
Contributor

@apepper apepper commented Jan 5, 2022

If you do not support Internet Explorer (any version), Chrome < 49, Opera < 36, Firefox < 52, desktop Safari < 10.1 or iOS Safari < 10.3, you may set allowReferrer to true, keep the HTTP Referer header and only add rel="noopener" to your links.

Source: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md#when-to-override-it

This PR improves the fixer to use rel="noopener" if allowReferrer is set.

@apepper apepper changed the title [Fix] jsx-no-garget-blank: Improve fixer with option allowReferrer [Fix] jsx-no-target-blank: Improve fixer with option allowReferrer Jan 5, 2022
@apepper apepper force-pushed the autocorrect_allowReferrer_with_noopener branch from a2a539d to 180b468 Compare January 5, 2022 13:13
@ljharb ljharb force-pushed the autocorrect_allowReferrer_with_noopener branch from 180b468 to e6d3850 Compare January 24, 2022 17:42
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, looks great!

@ljharb ljharb changed the title [Fix] jsx-no-target-blank: Improve fixer with option allowReferrer [New] jsx-no-target-blank: Improve fixer with option allowReferrer Jan 24, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jan 24, 2022

Codecov Report

Merging #3167 (e6d3850) into master (5f49f51) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3167   +/-   ##
=======================================
  Coverage   97.55%   97.55%           
=======================================
  Files         120      120           
  Lines        8287     8288    +1     
  Branches     2981     2982    +1     
=======================================
+ Hits         8084     8085    +1     
  Misses        203      203           
Impacted Files Coverage Δ
lib/rules/jsx-no-target-blank.js 88.88% <100.00%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f49f51...e6d3850. Read the comment docs.

@ljharb ljharb merged commit e6d3850 into jsx-eslint:master Jan 24, 2022
@apepper apepper deleted the autocorrect_allowReferrer_with_noopener branch January 25, 2022 08:21
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.

None yet

3 participants