Reputation: 11
As I have already installed babel-eslint
,eslint-plugin-react
and eslint-plugin-es
in my project and config them in .eslintrc
, it seems like most of the strange problems eslint output before has been gone.But here is still one problem which makes me very confused. Here is a function in one of my React component:
mouseMove = (e) => {
window.onmousemove = (e) => {
// ...
};
}
'e' is declared but never used(no-unuesd-vars)
Upvotes: 0
Views: 2254
Reputation: 313
The above e
has been shadowed by declaring a function in mouseMove
scope using an argument named e
again. There's no way to access the outer e
inside onmouseover
so eslint will complain.
You can fix this by removing the argument e
of mouseMove
or rename it.
Hope this can help.
Upvotes: 1
Reputation: 2438
If you dont use e
variable, you should remove it:
mouseMove = () => {
window.onmousemove = () => {
// ...
};
}
Upvotes: 2