You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rules/jsx-no-script-url.md
+42-2Lines changed: 42 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,8 +23,14 @@ Examples of **correct** code for this rule:
23
23
<a href={"javascript:"}></a>
24
24
```
25
25
26
+
This rule takes the `linkComponents` setting into account.
27
+
26
28
## Rule Options
27
29
30
+
This rule accepts array option (optional) and object option (optional).
31
+
32
+
### Array option (default `[]`)
33
+
28
34
```json
29
35
{
30
36
"react/jsx-no-script-url": [
@@ -45,11 +51,11 @@ Examples of **correct** code for this rule:
45
51
46
52
Allows you to indicate a specific list of properties used by a custom component to be checked.
47
53
48
-
### name
54
+
####name
49
55
50
56
Component name.
51
57
52
-
### props
58
+
####props
53
59
54
60
List of properties that should be validated.
55
61
@@ -60,3 +66,37 @@ Examples of **incorrect** code for this rule, when configured with the above opt
60
66
<Foo href="javascript:void(0)"></Foo>
61
67
<Foo to="javascript:void(0)"></Foo>
62
68
```
69
+
70
+
### Object option
71
+
72
+
#### includeFromSettings (default `false`)
73
+
74
+
Indicates if the `linkComponents` config in [global shared settings](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/README.md#configuration) should also be taken into account. If enabled, components and properties defined in settings will be added to the list provided in first option (if provided):
75
+
76
+
```json
77
+
{
78
+
"react/jsx-no-script-url": [
79
+
"error",
80
+
[
81
+
{
82
+
"name": "Link",
83
+
"props": ["to"]
84
+
},
85
+
{
86
+
"name": "Foo",
87
+
"props": ["href", "to"]
88
+
}
89
+
],
90
+
{ "includeFromSettings": true }
91
+
]
92
+
}
93
+
```
94
+
95
+
If only global settings should be used for this rule, the array option can be omitted:
96
+
97
+
```jsonc
98
+
{
99
+
// same as ["error", [], { "includeFromSettings": true }]
0 commit comments