Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
`prefer-const` and `init-declarations:never` conflict? #4474
The two rules
however, when this setting is active, it pretty much never triggers
Essentially what is happening is that prefer-const doesnt throw an error when
ideally, i'd like to be able to have them both active, where
Thanks for the issue! If you're reporting a bug, please be sure to include:
Requesting a new rule? Please see Proposing a New Rule for instructions.
It's pretty tricky to track assignments for all declared variables, so I don't see us doing that.
When you say "doesn't work", what does that mean?
As the previous comment states, please paste the exact output from ESLint when discussing what you are expecting or not expecting.
i put the output from eslint in the comments of example 1 and 2. also edited the OP. when i say it doesnt work, i mean that the
so for a recap:
this is shown by example 2 where the function is rewritten with an initialized declaration and eslint correctly throws an
I thought variables which satisfies the following conditions can be replaced with
If there is a read reference outside of the scope which has the write reference, the read reference cannot access the variable after the declaration was moved to the location of the write reference.
To check scope's parent‐child relationship is easy.