File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 11# Prevent usage of unsafe target='_ blank' (jsx-no-target-blank)
22
33When creating a JSX element that has an a tag, it is often desired to have
4- the link open in a new tab using the target='_ blank' attribute. Using this
5- attribute unaccompanied by rel='noreferrer noopener', however, is a severe
4+ the link open in a new tab using the ` target='_blank' ` attribute. Using this
5+ attribute unaccompanied by ` rel='noreferrer noopener' ` , however, is a severe
66security vulnerability ([ see here for more details] ( https://mathiasbynens.github.io/rel-noopener ) )
7- This rules requires that you accompany all target='_ blank' attributes with rel='noreferrer noopener'.
7+ This rules requires that you accompany all ` target='_blank' ` attributes with ` rel='noreferrer noopener' ` .
88
99## Rule Details
1010
1111The following patterns are considered errors:
1212
13- ``` javascript
13+ ``` jsx
1414var Hello = < a target= ' _blank' >< / a>
1515```
1616
1717The following patterns are not considered erros:
1818
19- ``` javascript
19+ ``` jsx
2020var Hello = < p target= ' _blank' >< / p>
2121var Hello = < a target= ' _blank' rel= ' noopener noreferrer' >< / a>
2222var Hello = < a>< / a>
You can’t perform that action at this time.
0 commit comments