Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
2,649 additions
and
1,120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Prevent usage of `javascript:` URLs (react/jsx-no-script-url) | ||
|
||
**In React 16.9** any URLs starting with `javascript:` [scheme](https://wiki.whatwg.org/wiki/URL_schemes#javascript:_URLs) log a warning. | ||
React considers the pattern as a dangerous attack surface, see [details](https://reactjs.org/blog/2019/08/08/react-v16.9.0.html#deprecating-javascript-urls). | ||
**In a future major release**, React will throw an error if it encounters a `javascript:` URL. | ||
|
||
## Rule Details | ||
|
||
The following patterns are considered warnings: | ||
|
||
```jsx | ||
<a href="javascript:"></a> | ||
<a href="javascript:void(0)"></a> | ||
<a href="j\n\n\na\rv\tascript:"></a> | ||
``` | ||
|
||
The following patterns are **not** considered warnings: | ||
|
||
```jsx | ||
<Foo href="javascript:"></Foo> | ||
<a href={"javascript:"}></a> | ||
``` | ||
|
||
## Rule Options | ||
```json | ||
{ | ||
"react/jsx-no-script-url": [ | ||
"error", | ||
[ | ||
{ | ||
"name": "Link", | ||
"props": ["to"] | ||
}, | ||
{ | ||
"name": "Foo", | ||
"props": ["href", "to"] | ||
} | ||
] | ||
] | ||
} | ||
``` | ||
|
||
Allows you to indicate a specific list of properties used by a custom component to be checked. | ||
|
||
### name | ||
Component name. | ||
|
||
### props | ||
List of properties that should be validated. | ||
|
||
The following patterns are considered warnings with the options listed above: | ||
|
||
```jsx | ||
<Link to="javascript:void(0)"></Link> | ||
<Foo href="javascript:void(0)"></Foo> | ||
<Foo to="javascript:void(0)"></Foo> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Prevent adjacent inline elements not separated by whitespace. (no-adjacent-inline-elements) | ||
|
||
Adjacent inline elements not separated by whitespace will bump up against each | ||
other when viewed in an unstyled manner, which usually isn't desirable. | ||
|
||
## Rule Details | ||
|
||
The following patterns are considered warnings: | ||
|
||
```jsx | ||
<div><a></a><a></a></div> | ||
<div><a></a><span></span></div> | ||
|
||
React.createElement("div", undefined, [React.createElement("a"), React.createElement("span")]); | ||
``` | ||
|
||
The following patterns are not considered warnings: | ||
|
||
```jsx | ||
<div><div></div><div></div></div> | ||
<div><a></a> <a></a></div> | ||
|
||
React.createElement("div", undefined, [React.createElement("a"), " ", React.createElement("a")]); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.