Skip to content

Commit

Permalink
Merge branch 'master' into lukyth/state-in-constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
lukyth committed Oct 3, 2018
2 parents b1024c0 + 8f2663e commit 9063d33
Show file tree
Hide file tree
Showing 76 changed files with 3,329 additions and 2,407 deletions.
2 changes: 1 addition & 1 deletion docs/rules/display-name.md
Expand Up @@ -33,7 +33,7 @@ var Hello = createReactClass({
...
```

### `ignoreTranspilerName`
### `ignoreTranspilerName` (default: `false`)

When `true` the rule will ignore the name set by the transpiler and require a `displayName` property in this case.

Expand Down
19 changes: 12 additions & 7 deletions docs/rules/jsx-no-target-blank.md
Expand Up @@ -8,18 +8,21 @@ This rules requires that you accompany `target='_blank'` attributes with `rel='n

## Rule Details

This rule aims to prevent user generated links from creating security vulerabilities by requiring
This rule aims to prevent user generated links from creating security vulnerabilities by requiring
`rel='noreferrer noopener'` for external links, and optionally any dynamically generated links.

## Rule Options
```json
...
"react/jsx-no-target-blank": [<enabled>, { "enforceDynamicLinks": <enforce> }]
...
```

There are two main options for the rule:

* `{"enforceDynamicLinks": "always"}` enforces the rule if the href is a dynamic link (default)
* `{"enforceDynamicLinks": "never"}` does not enforce the rule if the href is a dynamic link

* enabled: for enabling the rule. 0=off, 1=warn, 2=error. Defaults to 0.
* enforce: optional string, 'always' or 'never'

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

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

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

### never

`{"enforceDynamicLinks": "never"}` does not enforce the rule if the href is a dynamic link

When {"enforceDynamicLinks": "never"} is set, the following patterns are **not** considered errors:

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

## When Not To Use It

If you do not have any external links, you can disable this rule
If you do not have any external links, you can disable this rule
3 changes: 1 addition & 2 deletions lib/rules/boolean-prop-naming.js
Expand Up @@ -4,7 +4,6 @@
*/
'use strict';

const has = require('has');
const Components = require('../util/Components');
const propsUtil = require('../util/props');
const docsUrl = require('../util/docsUrl');
Expand Down Expand Up @@ -248,7 +247,7 @@ module.exports = {
}
}

if (!has(list, component) || (list[component].invalidProps || []).length) {
if (list[component].invalidProps && list[component].invalidProps.length > 0) {
reportInvalidNaming(list[component]);
}
});
Expand Down

0 comments on commit 9063d33

Please sign in to comment.