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
# Prevent variables used in JSX to be marked as unused (jsx-uses-vars)
2
+
3
+
Since 0.17.0 the ESLint `no-unused-vars` rule does not detect variables used in JSX ([see details](http://eslint.org/blog/2015/03/eslint-0.17.0-released#changes-to-jsxreact-handling)).
4
+
This rule will find variables used in JSX and mark them as used.
5
+
6
+
This rule only has an effect when the `no-unused-vars` rule is enabled.
7
+
8
+
## Rule Details
9
+
10
+
Without this rule this code triggers warning:
11
+
12
+
```js
13
+
importHellofrom'./Hello';
14
+
15
+
exportdefault {
16
+
render () {
17
+
return (
18
+
<Hello msg="world"></Hello>
19
+
)
20
+
},
21
+
};
22
+
```
23
+
24
+
After turning on, `Hello` is being marked as used and `no-unused-vars` rule doesn't report an issue.
25
+
26
+
## When Not To Use It
27
+
28
+
If you are not using JSX or if you do not use the `no-unused-vars` rule then you can disable this rule.
0 commit comments