Giter Site home page Giter Site logo

Comments (21)

jeroencranendonk-wf avatar jeroencranendonk-wf commented on August 19, 2024

Same for generator comprehensions.

from babel-eslint.

zdychacek avatar zdychacek commented on August 19, 2024

Is there any plan to implement support for array/generator comprehensions?

It would be great ;)

Thanks for reply.

from babel-eslint.

sebmck avatar sebmck commented on August 19, 2024

Not sure if it's possible because it'd require patching too much of escope
and I'm not sure if it'd be possible. Patches are welcome :)

On Tuesday, 14 April 2015, Ondřej Ždych [email protected] wrote:

Is there any plan to implement support for array/generator comprehensions?

It would be great ;)

Thanks for reply.


Reply to this email directly or view it on GitHub
#9 (comment).

Sebastian McKenzie

from babel-eslint.

hzoo avatar hzoo commented on August 19, 2024

I guess this won't be too different from #72?

from babel-eslint.

KylePDavis avatar KylePDavis commented on August 19, 2024

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

from babel-eslint.

callumlocke avatar callumlocke commented on August 19, 2024

@KylePDavis that helps, thanks

from babel-eslint.

hzoo avatar hzoo commented on August 19, 2024

Hey everyone, does #114 fix your issues?

from babel-eslint.

KylePDavis avatar KylePDavis commented on August 19, 2024

Thanks, @hzoo, that does seem to fix the no-undef rule complaints but it also seems to trigger block-scoped-var complaints.

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

from babel-eslint.

hzoo avatar hzoo commented on August 19, 2024

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.

from babel-eslint.

hzoo avatar hzoo commented on August 19, 2024

@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 (block-scoped-var) anymore right? Or is there something else that it catches?

from babel-eslint.

gaearon avatar gaearon commented on August 19, 2024

f921efa works great for me, only no-unused-vars false-triggering now in my comprehensions code.

from babel-eslint.

hzoo avatar hzoo commented on August 19, 2024

@gaearon Can you give me a code snippet that is failing for you? I can add no-unused-vars to the tests now.

from babel-eslint.

gaearon avatar gaearon commented on August 19, 2024
function getFirstAtom(stores) {
  return new Map([
    for (store of stores)
      [store, undefined]
  ]);
}

getFirstAtom();

stores parameter is reported to be unused.

Thanks a lot for the effort! Your work saved me a lot of headache in the past few weeks.

from babel-eslint.

hzoo avatar hzoo commented on August 19, 2024

Ah ok I didn't visit the node.right (stores in your case). Shouldn't be too hard to fix.

Awesome! It's be fun contributing and learning all this stuff (btw react-hot-loader has been great).

from babel-eslint.

hzoo avatar hzoo commented on August 19, 2024

@gaearon See if the next commit fixes it hzoo@8e254b7.

from babel-eslint.

gaearon avatar gaearon commented on August 19, 2024

@hzoo Works great. Thanks again.

from babel-eslint.

zspecza avatar zspecza commented on August 19, 2024

Still getting this issue with the below snippet, more specifically the block-scoped-var

function entries(obj) {
  return (for (key of Object.keys(obj)) [key, obj[key]])
}

from babel-eslint.

callumlocke avatar callumlocke commented on August 19, 2024

Are you sure you're on the latest version? I don't get this problem any
more.
On Tue, 14 Jul 2015 at 22:27, Declan de Wet [email protected]
wrote:

Still getting this issue with the below snippet

function entries(obj) {
return (for (key of Object.keys(obj)) [key, obj[key]])
}


Reply to this email directly or view it on GitHub
#9 (comment).

from babel-eslint.

zspecza avatar zspecza commented on August 19, 2024

@callumlocke yep:

from babel-eslint.

hzoo avatar hzoo commented on August 19, 2024

@declandewet can you make a seperate issue for this? The original issue was for no-undef and this is for block-scoped-var/

from babel-eslint.

zspecza avatar zspecza commented on August 19, 2024

@hzoo #148 😄

from babel-eslint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.