GithubHelp home page GithubHelp logo

Global variables about flow HOT 25 CLOSED

facebook avatar facebook commented on April 27, 2024
Global variables

from flow.

Comments (25)

josebalius avatar josebalius commented on April 27, 2024 3

So if i add declare var Meteor: any; to the files that contain the globals, the error goes away, is there anyway to do this globally for all files?

from flow.

josebalius avatar josebalius commented on April 27, 2024 1

@avikchaudhuri I tried putting it in the same folder as the other files (that reference the global), created a file called globals.js with the following:

/* @flow */
declare var Meteor: any;

But still got the same error, the other thing i was thinking, should I set the --lib property with an absolute path like we have to do .flowconfig for ignore / include ? I haven't tried that, I will now just in case.

from flow.

briandipalma avatar briandipalma commented on April 27, 2024

It seems to me that the solution is not to rely on globals but to use modules instead? Unless Meteor is being imported via a module loader?

from flow.

josebalius avatar josebalius commented on April 27, 2024

@briandipalma Well Meteor doesn't quite work that way (the environment provides a Meteor object on the client/server), but flow needs to have a way to define globals for it, while they may not be best practice it's something that a lot of applications are going to have.

from flow.

avikchaudhuri avatar avikchaudhuri commented on April 27, 2024

@josebalius Could you try again putting lib outside .? Maybe putting it in the same directory as source files is making Flow clobber the information that it is a global? :/ Will investigate, also let us know if the workaround doesn't work.

from flow.

avikchaudhuri avatar avikchaudhuri commented on April 27, 2024

No, what I mean is, put globals.js somewhere outside the folder which contains your regular files.

from flow.

josebalius avatar josebalius commented on April 27, 2024

@avikchaudhuri okay just tried that as well and no luck :(

from flow.

Eric-Wright avatar Eric-Wright commented on April 27, 2024

@josebalius I ran into the same problem, then saw in the documentation that you need to specify the --lib argument even when running the check command. For example:

flow start --lib ../lib
flow check --lib ../lib

from flow.

josebalius avatar josebalius commented on April 27, 2024

@Eric-Wright thank you! that definitely fixed it :)

I think we can close this issue now, but it should be documented that you have to keep specifying the --lib argument when running flow check

from flow.

josebalius avatar josebalius commented on April 27, 2024

It would be nice if flow allowed you to run flow --lib ./lib without having to do a full flow check it's so slow....

from flow.

tcoopman avatar tcoopman commented on April 27, 2024

@josebalius if you run flow start --lib ./lib and then run flow it will use the lib.

from flow.

josebalius avatar josebalius commented on April 27, 2024

@tcoopman you sure? if I run it like that, i get the global errors, it does not have the same result as flow check --lib ./lib

from flow.

tcoopman avatar tcoopman commented on April 27, 2024

@josebalius just tested it with 0.1.1 and this works.

Are you sure the lib file get parsed correctly?

from flow.

josebalius avatar josebalius commented on April 27, 2024

@tcoopman It worked for you :( you don't get global errors? I think it is, i mean it works with flow check and i thought lib was supposed to be a folder?

from flow.

tcoopman avatar tcoopman commented on April 27, 2024

Yeah it has to be a folder. So you first run flow start --lib lib/ and
then flow?

Maybe try again on a test directory to see that there is nothing wrong with
something else?

On Fri, 21 Nov 2014 21:59 Jose Garcia [email protected] wrote:

@tcoopman https://github.com/tcoopman It worked for you :( you don't
get global errors? I think it is, i mean it works with flow check and i
thought lib was supposed to be a folder?


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

from flow.

josebalius avatar josebalius commented on April 27, 2024

@tcoopman just verified it. Also verified I had version 0.1.1 just to double check and i do. Here is what i did:

File structure:

drwxr-xr-x  3 jgarcia  staff  102 Nov 22 20:08 lib
-rw-r--r--  1 jgarcia  staff   30 Nov 22 20:08 test.js

test.js

TestGlobal.run();

lib

-rw-r--r--  1 jgarcia  staff  29 Nov 22 20:08 global.js

global.js

declare var TestGlobal: any;

Test:

flow init

------------
flow start --lib ./lib
flow

/Users/jgarcia/Sites/flow-test/test.js:2:1,10: identifier TestGlobal
Unknown global name

Found 1 error

---------

flow start lib ./lib
flow check --lib ./lib

Found 0 errors

Let me know if you can reproduce.

from flow.

tcoopman avatar tcoopman commented on April 27, 2024

I've taken your exact example and cannot reproduce:

flow init
flow start --lib ./lib
flow

No errors!

(Running it like without --lib does give an error)

I'm on Linux, maybe that could be the problem?

Also can you test this:

flow start --lib ./lib
flow status

What's the full output of flow status?

from flow.

josebalius avatar josebalius commented on April 27, 2024

@tcoopman

~/Sites/flow-test                                                                                                                                                                           
▶ flow start --lib ./lib
Spawned flow server (child pid=22957)
Logs will go to /var/folders/9k/tr3kf4zn70d5cbp8kzzdzjqw0000gp/T/flow_jgarcia/jgarcia-zSUserszSjgarciazSSiteszSflow-test.log

~/Sites/flow-test                                                                                                                                                                             
▶ flow status

/Users/jgarcia/Sites/flow-test/test.js:2:1,10: identifier TestGlobal
Unknown global name

Found 1 error

from flow.

tcoopman avatar tcoopman commented on April 27, 2024

I thought that maybe the server stopped, I've had this happen once, but it looks like it is still running.

Maybe someone else on a Mac can check if they have the same problem?

from flow.

josebalius avatar josebalius commented on April 27, 2024

Anyone else? :/

from flow.

pizana68 avatar pizana68 commented on April 27, 2024

Mayb
On Nov 25, 2014 9:46 AM, "Jose Garcia" [email protected] wrote:

Anyone else? :/


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

from flow.

josebalius avatar josebalius commented on April 27, 2024

@pizana68 are you having the same problem?

from flow.

josebalius avatar josebalius commented on April 27, 2024

@avikchaudhuri @tcoopman so I tried setting the --lib option in flow start with an absolute path instead of relative, and it works!

from flow.

tcoopman avatar tcoopman commented on April 27, 2024

@josebalius can this issue be closed?

from flow.

josebalius avatar josebalius commented on April 27, 2024

@tcoopman yes sir :)

from flow.

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.