-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
jsx-uses-vars breaks eslint prefer-const #716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I created a repro repo.. |
Thanks for the issue, but if I'm right there is nothing we can do on our side to prevent this, since the issue seems to come from ESLint itself (eslint/eslint#5837), right? |
It sounds like with |
But:
This will solve the case described by @lukeapage but we'll still have the problem with let App = <div />; // should warn "'App' is never reassigned. Use 'const' instead" but will not
<App />
|
Yeah sorry for not updating after tracking down. I left this open until a solution is found, in case something needs to be done here as welll. |
I hit this today. A minimal repro: function foo() {
let iCouldBeConst = 6;
return <th colSpan={iCouldBeConst}></th>;
} and eslint config: {
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"rules": {
"react/jsx-uses-vars": 2,
"prefer-const": 2
},
"plugins": [
"react"
]
} Sounds like removing |
Yes, I will remove this. It does not fix the whole issue with |
Keep it open for now due to #716 (comment) |
Thanks :) |
Fixed in ESLint 3.4.0 |
I have code like this
but with prefer-const on, the prefer const error on
filters
is removed when I switch onjsx-uses-vars
The text was updated successfully, but these errors were encountered: