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
It is also possible to install ESLint globally rather than locally (using npm install eslint --global). However, this is not recommended, and any plugins or shareable configs that you use must be installed locally in either case.
18
20
19
-
# Configuration
20
-
21
+
## Configuration
21
22
22
23
Use [our preset](#recommended) to get reasonable defaults:
23
24
@@ -109,7 +110,7 @@ Enable the rules that you would like to use.
109
110
}
110
111
```
111
112
112
-
# List of supported rules
113
+
##List of supported rules
113
114
114
115
✔: Enabled in the [`recommended`](#recommended) configuration.\
115
116
🔧: Fixable with [`eslint --fix`](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems).\
@@ -179,7 +180,7 @@ Enable the rules that you would like to use.
179
180
||||[react/void-dom-elements-no-children](docs/rules/void-dom-elements-no-children.md)| Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children |
180
181
<!-- AUTO-GENERATED-CONTENT:END -->
181
182
182
-
## JSX-specific rules
183
+
###JSX-specific rules
183
184
184
185
<!-- AUTO-GENERATED-CONTENT:START (JSX_RULES) -->
185
186
| ✔ | 🔧 | 💡 | Rule | Description |
@@ -225,15 +226,15 @@ Enable the rules that you would like to use.
225
226
|| 🔧 ||[react/jsx-wrap-multilines](docs/rules/jsx-wrap-multilines.md)| Disallow missing parentheses around multiline JSX |
226
227
<!-- AUTO-GENERATED-CONTENT:END -->
227
228
228
-
## Other useful plugins
229
+
###Other useful plugins
229
230
230
231
- Rules of Hooks: [eslint-plugin-react-hooks](https://github.com/facebook/react/tree/master/packages/eslint-plugin-react-hooks)
This plugin exports a `recommended` configuration that enforces React good practices.
239
240
@@ -247,7 +248,7 @@ To enable this configuration use the `extends` property in your `.eslintrc` conf
247
248
248
249
See [`eslint` documentation](https://eslint.org/docs/user-guide/configuring/configuration-files#extending-configuration-files) for more information about extending configuration files.
249
250
250
-
## All
251
+
###All
251
252
252
253
This plugin also exports an `all` configuration that includes every available rule.
253
254
This pairs well with the `eslint:all` rule.
@@ -263,11 +264,10 @@ This pairs well with the `eslint:all` rule.
263
264
264
265
**Note**: These configurations will import `eslint-plugin-react` and enable JSX in [parser options](https://eslint.org/docs/user-guide/configuring/language-options#specifying-parser-options).
265
266
266
-
# License
267
+
##License
267
268
268
269
`eslint-plugin-react` is licensed under the [MIT License](https://opensource.org/licenses/mit-license.php).
Copy file name to clipboardExpand all lines: SECURITY.md
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,6 @@ This is the list of versions of `eslint-plugin-react` which are currently being
9
9
| 7.x |:white_check_mark:|
10
10
| < 7.x |:x:|
11
11
12
-
13
12
## Reporting a Vulnerability
14
13
15
14
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
Copy file name to clipboardExpand all lines: docs/rules/boolean-prop-naming.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,7 @@ var Hello = createReactClass({
36
36
render:function() { return<div />; };
37
37
});
38
38
```
39
+
39
40
```jsx
40
41
type Props = {
41
42
isEnabled: boolean
@@ -94,8 +95,8 @@ The custom message to display upon failure to match the rule. This overrides the
94
95
95
96
If you choose to use a custom message, you have access to two template variables.
96
97
97
-
*`propName` – the name of the prop that does not match the pattern
98
-
*`pattern` – the pattern against which all prop names are tested
98
+
-`propName` – the name of the prop that does not match the pattern
99
+
-`pattern` – the pattern against which all prop names are tested
99
100
100
101
For example, if a prop is named `something`, and if the rule's pattern is set to `"^(is|has)[A-Z]([A-Za-z0-9]?)+"`, you could set the custom message as follows:
101
102
@@ -105,7 +106,7 @@ message: 'It is better if your prop ({{ propName }}) matches this pattern: ({{ p
105
106
106
107
And the failure would look like so:
107
108
108
-
```
109
+
```plaintext
109
110
It is better if your prop (something) matches this pattern: (^is[A-Z]([A-Za-z0-9]?)+)
Copy file name to clipboardExpand all lines: docs/rules/destructuring-assignment.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
🔧 This rule is automatically fixable using the `--fix`[flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
Copy file name to clipboardExpand all lines: docs/rules/iframe-missing-sandbox.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
The sandbox attribute enables an extra set of restrictions for the content in the iframe. Using sandbox attribute is considered a good security practice.
4
4
5
-
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox
5
+
See <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox>
0 commit comments