Skip to content

Commit 119b8b0

Browse files
tieflingljharb
authored andcommitted
[Docs] create setup.md
Root file for the docs directory to help newbies find info on setting up the plugin.
1 parent 997a99f commit 119b8b0

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

docs/setup.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
In order to use the react eslint plugin do the following...
2+
3+
1. At the root of your project type <code>npm install --save-dev eslint-plugin-react</code>
4+
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**)...
5+
<pre>
6+
"devDependencies": {
7+
"eslint": "^7.3.1",
8+
"eslint-plugin-react": "^7.10.3"
9+
}
10+
</pre>
11+
3. If configuring using package.json add the following under 'eslintConfig'...
12+
<pre>
13+
"eslintConfig": {
14+
"plugins": [
15+
"react"
16+
]
17+
}
18+
</pre>
19+
Else, in your eslint configuration file (.eslintrc) add the following...
20+
<pre>
21+
{
22+
"plugins": [
23+
"react"
24+
]
25+
}
26+
</pre>
27+
4. Configure the rules you want to use according to the [rules docs](/docs/rules). Here's a sample of some of mine...
28+
<pre>
29+
"eslintConfig": {
30+
"rules": {
31+
"no-unused-vars": 2,
32+
"react/jsx-uses-vars": 2,
33+
"react/require-extensions": 0,
34+
"react/jsx-sort-prop-types": 0,
35+
"react/prop-types": [2, {
36+
"ignore": ["children"],
37+
"skipUndeclared": false
38+
}]
39+
}
40+
}
41+
</pre>
42+
43+
<i>You can read more about configuring ESLint plugins at http://eslint.org/docs/user-guide/configuring#configuring-plugins</i>

0 commit comments

Comments
 (0)