Skip to content

Commit e632628

Browse files
briandipalmaljharb
authored andcommitted
[Docs] improve readme
Removed ESLint 1.x config information as it's probably used by very, very few people. Restructured config section to focus on quick set-up with defaults over more time consuming individual rule selection. No need to specify the plugin configuration as it works without it so it seems to be noise?
1 parent e5e4536 commit e632628

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

README.md

+20-15
Original file line numberDiff line numberDiff line change
@@ -21,45 +21,50 @@ $ npm install eslint-plugin-react --save-dev
2121

2222
# Configuration
2323

24-
Add `plugins` section and specify ESLint-plugin-React as a plugin.
24+
Use [our preset](#recommended) to get reasonable defaults:
2525

2626
```json
27-
{
28-
"plugins": [
29-
"react"
27+
"extends": [
28+
"eslint:recommended",
29+
"plugin:react/recommended"
3030
]
31-
}
3231
```
3332

34-
You can also specify some settings that will be shared across all the plugin rules.
33+
You should also specify settings that will be shared across all the plugin rules.
3534

3635
```json5
3736
{
3837
"settings": {
3938
"react": {
40-
"createClass": "createReactClass", // Regex for Component Factory to use, default to "createReactClass"
39+
"createClass": "createReactClass", // Regex for Component Factory to use,
40+
// default to "createReactClass"
4141
"pragma": "React", // Pragma to use, default to "React"
4242
"version": "15.0", // React version, default to the latest React stable release
4343
"flowVersion": "0.53" // Flow version
4444
},
45-
"propWrapperFunctions": [ "forbidExtraProps" ] // The names of any functions used to wrap the propTypes object, such as `forbidExtraProps`. If this isn't set, any propTypes wrapped in a function will be skipped.
45+
"propWrapperFunctions": [ "forbidExtraProps" ] // The names of any functions used to wrap the
46+
// propTypes object, e.g. `forbidExtraProps`.
47+
// If this isn't set, any propTypes wrapped in
48+
// a function will be skipped.
4649
}
4750
}
4851
```
4952

50-
If it is not already the case you must also configure `ESLint` to support JSX.
53+
If you do not use a preset you will need to specify individual rules and add extra configuration.
5154

52-
With ESLint 1.x.x:
55+
Add "react" to the plugins section.
5356

5457
```json
5558
{
56-
"ecmaFeatures": {
57-
"jsx": true
58-
}
59+
"plugins": [
60+
"react"
61+
]
5962
}
6063
```
6164

62-
With ESLint 2.x.x or 3.x.x:
65+
Enable JSX support.
66+
67+
With ESLint 2+
6368

6469
```json
6570
{
@@ -71,7 +76,7 @@ With ESLint 2.x.x or 3.x.x:
7176
}
7277
```
7378

74-
Finally, enable all of the rules that you would like to use. Use [our preset](#recommended) to get reasonable defaults quickly, and/or choose your own:
79+
Enable the rules that you would like to use.
7580

7681
```json
7782
"rules": {

0 commit comments

Comments
 (0)