Skip to content

Commit

Permalink
[Docs] improve readme
Browse files Browse the repository at this point in the history
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?
  • Loading branch information
briandipalma authored and ljharb committed Nov 23, 2017
1 parent e5e4536 commit e632628
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,50 @@ $ npm install eslint-plugin-react --save-dev

# Configuration

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

```json
{
"plugins": [
"react"
"extends": [
"eslint:recommended",
"plugin:react/recommended"
]
}
```

You can also specify some settings that will be shared across all the plugin rules.
You should also specify settings that will be shared across all the plugin rules.

```json5
{
"settings": {
"react": {
"createClass": "createReactClass", // Regex for Component Factory to use, default to "createReactClass"
"createClass": "createReactClass", // Regex for Component Factory to use,
// default to "createReactClass"
"pragma": "React", // Pragma to use, default to "React"
"version": "15.0", // React version, default to the latest React stable release
"flowVersion": "0.53" // Flow version
},
"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.
"propWrapperFunctions": [ "forbidExtraProps" ] // The names of any functions used to wrap the
// propTypes object, e.g. `forbidExtraProps`.
// If this isn't set, any propTypes wrapped in
// a function will be skipped.
}
}
```

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

With ESLint 1.x.x:
Add "react" to the plugins section.

```json
{
"ecmaFeatures": {
"jsx": true
}
"plugins": [
"react"
]
}
```

With ESLint 2.x.x or 3.x.x:
Enable JSX support.

With ESLint 2+

```json
{
Expand All @@ -71,7 +76,7 @@ With ESLint 2.x.x or 3.x.x:
}
```

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:
Enable the rules that you would like to use.

```json
"rules": {
Expand Down

0 comments on commit e632628

Please sign in to comment.