Skip to content

Commit

Permalink
jsx-no-target-blank Update documentation with new options links and f…
Browse files Browse the repository at this point in the history
…orms
  • Loading branch information
jaaberg committed Dec 19, 2017
1 parent dbe2f72 commit 712bb6a
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions docs/rules/jsx-no-target-blank.md
Expand Up @@ -26,26 +26,25 @@ var Hello = <a></a>

### Options

There is only one option:

* `preventInForms` - Prevent usage of unsafe `target='_blank'` inside forms

To use, you can specify like the following:

```json
"react/jsx-no-target-blank": [{"preventInForms": true}]
```js
"react/jsx-no-target-blank": [<enabled>, {
"links": <boolean>,
"forms": <boolean>
}]
```

In this configuration, the following are considered errors:
* `links` - Prevent usage of unsafe `target='_blank'` inside links, defaults to `true`
* `forms` - Prevent usage of unsafe `target='_blank'` inside forms, defaults to `false`

When option `forms` is set to `true`, the following is considered an error:

```jsx
var Hello = <form target='_blank' action="http://example.com/"></form>
```

The following are **not** considered errors:
When option `links` is set to `true`, the following is considered an error:

```jsx
var Hello = <form target='_blank' rel='noopener noreferrer' action="http://example.com"></form>
var Hello = <a target='_blank' href="http://example.com/"></form>
```

## When Not To Use It
Expand Down

0 comments on commit 712bb6a

Please sign in to comment.