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 1
1
# Prevent usage of unsafe target='_ blank' (jsx-no-target-blank)
2
2
3
3
When 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
6
6
security 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' ` .
8
8
9
9
## Rule Details
10
10
11
11
The following patterns are considered errors:
12
12
13
- ``` javascript
13
+ ``` jsx
14
14
var Hello = < a target= ' _blank' >< / a>
15
15
```
16
16
17
17
The following patterns are not considered erros:
18
18
19
- ``` javascript
19
+ ``` jsx
20
20
var Hello = < p target= ' _blank' >< / p>
21
21
var Hello = < a target= ' _blank' rel= ' noopener noreferrer' >< / a>
22
22
var Hello = < a>< / a>
You can’t perform that action at this time.
0 commit comments