-
-
Notifications
You must be signed in to change notification settings - Fork 208
Variable of array comprehension not defined #9
Comments
Same for generator comprehensions. |
Is there any plan to implement support for array/generator comprehensions? It would be great ;) Thanks for reply. |
Not sure if it's possible because it'd require patching too much of escope On Tuesday, 14 April 2015, Ondřej Ždych notifications@github.com wrote:
Sebastian McKenzie |
I guess this won't be too different from #72? |
For what it's worth, I've used this as a hack to work around this for now: /*global cVar*///NOTE: "fix" linter errs for comprehension vars |
@KylePDavis that helps, thanks |
Hey everyone, does #114 fix your issues? |
Thanks, @hzoo, that does seem to fix the Example: "use strict";
export default [for (i of global) String(i)];
//OR: (for (i of global) String(i)); Errors: 2:21 error "i" used outside of binding context block-scoped-var
2:41 error "i" used outside of binding context block-scoped-var |
Ah dang I probably added the variable in the wrong scope.. (most likely just need to move it up a level?) or it's not that straightforward haha. |
@KylePDavis yeah I'm not sure at the moment =/. I guess this is besides the point but if you are using babel (with let/const) which are already block scope then you wouldn't need the rule ( |
f921efa works great for me, only |
@gaearon Can you give me a code snippet that is failing for you? I can add |
function getFirstAtom(stores) {
return new Map([
for (store of stores)
[store, undefined]
]);
}
getFirstAtom();
Thanks a lot for the effort! Your work saved me a lot of headache in the past few weeks. |
Ah ok I didn't visit the Awesome! It's be fun contributing and learning all this stuff (btw |
@gaearon See if the next commit fixes it hzoo@8e254b7. |
@hzoo Works great. Thanks again. |
support comprehensions (no-undef) - fixes #9
Still getting this issue with the below snippet, more specifically the function entries(obj) {
return (for (key of Object.keys(obj)) [key, obj[key]])
} |
Are you sure you're on the latest version? I don't get this problem any
|
@callumlocke yep: |
@declandewet can you make a seperate issue for this? The original issue was for |
support comprehensions (no-undef) - fixes babel/babel-eslint#9
results in:
The text was updated successfully, but these errors were encountered: