Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions docs/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
In order to use the react eslint plugin do the following...

1. At the root of your project type <code>npm install --save-dev eslint-plugin-react</code>
2. Check your package.json 'devDependencies' for the following entries (version numbers may vary, but it's important that **the eslint version matches the peerDependency version in eslint-plugin-react**)...
<pre>
"devDependencies": {
"eslint": "^7.3.1",
"eslint-plugin-react": "^7.10.3"
}
</pre>
Comment on lines +3 to +10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3. If configuring using package.json add the following under 'eslintConfig'...
<pre>
"eslintConfig": {
"plugins": [
"react"
]
}
</pre>
Else, in your eslint configuration file (.eslintrc) add the following...
<pre>
{
"plugins": [
"react"
]
}
</pre>
4. Configure the rules you want to use according to the [rules docs](/docs/rules). Here's a sample of some of mine...
<pre>
"eslintConfig": {
"rules": {
"no-unused-vars": 2,
"react/jsx-uses-vars": 2,
"react/require-extensions": 0,
"react/jsx-sort-prop-types": 0,
"react/prop-types": [2, {
Comment on lines +31 to +35
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"no-unused-vars": 2,
"react/jsx-uses-vars": 2,
"react/require-extensions": 0,
"react/jsx-sort-prop-types": 0,
"react/prop-types": [2, {
"no-unused-vars": "error",
"react/jsx-uses-vars": "error",
"react/require-extensions": "off",
"react/jsx-sort-prop-types": "off",
"react/prop-types": ["error", {

"ignore": ["children"],
"skipUndeclared": false
}]
}
}
</pre>

<i>You can read more about configuring ESLint plugins at http://eslint.org/docs/user-guide/configuring#configuring-plugins</i>