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
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