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
19
19
-
# Configuration
20
-
20
+
## Configuration
21
21
22
22
Use [our preset](#recommended) to get reasonable defaults:
23
23
@@ -109,7 +109,7 @@ Enable the rules that you would like to use.
109
109
}
110
110
```
111
111
112
-
# List of supported rules
112
+
##List of supported rules
113
113
114
114
✔: Enabled in the [`recommended`](#recommended) configuration.\
115
115
🔧: Fixable with [`eslint --fix`](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems).\
@@ -179,7 +179,7 @@ Enable the rules that you would like to use.
179
179
||||[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
180
<!-- AUTO-GENERATED-CONTENT:END -->
181
181
182
-
## JSX-specific rules
182
+
###JSX-specific rules
183
183
184
184
<!-- AUTO-GENERATED-CONTENT:START (JSX_RULES) -->
185
185
| ✔ | 🔧 | 💡 | Rule | Description |
@@ -225,15 +225,15 @@ Enable the rules that you would like to use.
225
225
|| 🔧 ||[react/jsx-wrap-multilines](docs/rules/jsx-wrap-multilines.md)| Disallow missing parentheses around multiline JSX |
226
226
<!-- AUTO-GENERATED-CONTENT:END -->
227
227
228
-
## Other useful plugins
228
+
###Other useful plugins
229
229
230
230
- 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
239
@@ -247,7 +247,7 @@ To enable this configuration use the `extends` property in your `.eslintrc` conf
247
247
248
248
See [`eslint` documentation](https://eslint.org/docs/user-guide/configuring/configuration-files#extending-configuration-files) for more information about extending configuration files.
249
249
250
-
## All
250
+
###All
251
251
252
252
This plugin also exports an `all` configuration that includes every available rule.
253
253
This pairs well with the `eslint:all` rule.
@@ -263,11 +263,10 @@ This pairs well with the `eslint:all` rule.
263
263
264
264
**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
265
266
-
# License
266
+
##License
267
267
268
268
`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.
0 commit comments