File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,17 @@ This rule aims to prevent user generated links from creating security vulnerabil
12
12
` rel='noreferrer noopener' ` for external links, and optionally any dynamically generated links.
13
13
14
14
## Rule Options
15
+ ``` json
16
+ ...
17
+ "react/jsx-no-target-blank" : [<enabled>, { "enforceDynamicLinks": <enforce> } ]
18
+ ...
19
+ ```
15
20
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'
21
23
22
24
### always (default)
25
+ ` {"enforceDynamicLinks": "always"} ` enforces the rule if the href is a dynamic link (default)
23
26
24
27
When {"enforceDynamicLinks": "always"} is set, the following patterns are considered errors:
25
28
@@ -40,6 +43,8 @@ var Hello = <a></a>
40
43
41
44
### never
42
45
46
+ ` {"enforceDynamicLinks": "never"} ` does not enforce the rule if the href is a dynamic link
47
+
43
48
When {"enforceDynamicLinks": "never"} is set, the following patterns are ** not** considered errors:
44
49
45
50
``` jsx
@@ -48,4 +53,4 @@ var Hello = <a target='_blank' href={ dynamicLink }></a>
48
53
49
54
## When Not To Use It
50
55
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
You can’t perform that action at this time.
0 commit comments