Skip to content

Commit eb69dc5

Browse files
authored
Merge pull request #1988 from atomcorp/master
Add full example in react/jsx-no-target-blank
2 parents a93080e + ac78b51 commit eb69dc5

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

docs/rules/jsx-no-target-blank.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ This rule aims to prevent user generated links from creating security vulnerabil
1212
`rel='noreferrer noopener'` for external links, and optionally any dynamically generated links.
1313

1414
## Rule Options
15+
```json
16+
...
17+
"react/jsx-no-target-blank": [<enabled>, { "enforceDynamicLinks": <enforce> }]
18+
...
19+
```
1520

16-
There are two main options for the rule:
17-
18-
* `{"enforceDynamicLinks": "always"}` enforces the rule if the href is a dynamic link (default)
19-
* `{"enforceDynamicLinks": "never"}` does not enforce the rule if the href is a dynamic link
20-
21+
* enabled: for enabling the rule. 0=off, 1=warn, 2=error. Defaults to 0.
22+
* enforce: optional string, 'always' or 'never'
2123

2224
### always (default)
25+
`{"enforceDynamicLinks": "always"}` enforces the rule if the href is a dynamic link (default)
2326

2427
When {"enforceDynamicLinks": "always"} is set, the following patterns are considered errors:
2528

@@ -40,6 +43,8 @@ var Hello = <a></a>
4043

4144
### never
4245

46+
`{"enforceDynamicLinks": "never"}` does not enforce the rule if the href is a dynamic link
47+
4348
When {"enforceDynamicLinks": "never"} is set, the following patterns are **not** considered errors:
4449

4550
```jsx
@@ -48,4 +53,4 @@ var Hello = <a target='_blank' href={ dynamicLink }></a>
4853

4954
## When Not To Use It
5055

51-
If you do not have any external links, you can disable this rule
56+
If you do not have any external links, you can disable this rule

0 commit comments

Comments
 (0)