@@ -8,18 +8,21 @@ This rules requires that you accompany `target='_blank'` attributes with `rel='n
88
99## Rule Details
1010
11- This rule aims to prevent user generated links from creating security vulerabilities by requiring
11+ This rule aims to prevent user generated links from creating security vulnerabilities by requiring
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
2427When {"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+
4348When {"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