GithubHelp home page GithubHelp logo

flow / flow-bin Goto Github PK

View Code? Open in Web Editor NEW
535.0 535.0 44.0 293 KB

Binary wrapper for Flow - A static type checker for JavaScript

Home Page: https://flow.org

License: Other

JavaScript 40.37% Makefile 59.63%

flow-bin's People

Contributors

amilajack avatar arthurvr avatar avikchaudhuri avatar calebmer avatar dsainati1 avatar facebook-github-bot avatar fengmk2 avatar floatdrop avatar flow-bot avatar gabelevi avatar gkz avatar jbrown215 avatar jeffmo avatar kassens avatar kevva avatar mroch avatar mvitousek avatar nmote avatar panagosg7 avatar samchou19815 avatar samwgoldman avatar simenb avatar sindresorhus avatar strml avatar zertosh avatar zpao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flow-bin's Issues

My code may suck; or, possibly a defect in lib install process, or even a tool portability defect

I'm going to tell a programmer joke.

"A novice walks into a bar and says 'It's one in the morning, I've been using your tool for two days, and I think I found a portability problem in your tool in a trivial test case.' "

Most programmer jokes end with Sussman hitting a person with a book, and the person being enlightened, but I'm bad at telling jokes, so Sussman isn't here, and nobody at the bar gave me a beer.

What?

I think I probably screwed up somehow, but there's a small possibility I've found a portability problem in Windows Flow with a trivial test case.

I wouldn't believe me either. Here's a repo you can clone and try.

The code

It's short enough to include wholesale.

types.js

// @flow
export type Suit = "Diamonds" | "Clubs" | "Hearts" | "Spades";

source.js

// @flow

import type { Suit } from './types';

function ex(arg: Suit) { console.log(`suits ${arg}`); }

ex("Hearts");
ex("Harts");

.flowconfig (default empty one from flow init)

[ignore]

[include]

[libs]

[options]

The results

Macintosh: Works

John-Haugeland:JohnIsWrongAboutFlow_TestCase johnhaugeland$ flow
source.js:9
  9: ex("Harts");
        ^^^^^^^ string. This type is incompatible with the expected param type of
  6: function ex(blah: Suit) { console.log('suits'); }
                       ^^^^ string enum

Windows 10 Pro 64 CE git bash MinGW64: broken

User@DESKTOP MINGW64 ~/Local Settings/lxss/home/john/projects/JohnIsWrongAboutFlow_TestCase (master)
$ flow --color=never
source.js:4
  4: import type { Suit } from './types';
                               ^^^^^^^^^ ./types. Required module not found

Windows stock DOS console: broken

C:\Users\User\Local Settings\lxss\home\john\projects\JohnIsWrongAboutFlow_TestCase>flow
source.js:4
  4: import type { Suit } from './types';
                               ^^^^^^^^^ ./types. Required module not found

I am confused

I want to believe I'm just doing it wrongly somehow.

Please help me understand how. Thank you

High memory usage (possible memory leak)

This seems to happen regulary... and unfortunately I can't provide much information (mostly because I don't know where to start)

Still I'm trying to attach as much information as I can gather:

screen shot 2017-04-13 at 18 23 33

screen shot 2017-04-13 at 18 24 26

screen shot 2017-04-13 at 18 24 49

screen shot 2017-04-13 at 18 25 21

I'm also attaching a sample taken with the OSX dialog.
Sample of flow.txt

By the end of writing this post flow is now consuming >9Gb of memory:

screen shot 2017-04-13 at 18 29 00

Windows: 32-bit NodeJS - No binary found matching your system.

Windows 10 64-bit, NodeJS 6.3.1 32-bit

$ node --version && npm --version && npm install flow-bin
v6.3.1
3.10.5

> [email protected] postinstall D:\dev\test\node_modules\flow-bin
> node lib/install.js

  × No binary found matching your system. It's probably not supported.
  × flow binary test failed

If there's no 32-bit build of Flow for Windows, can it at least try to download and execute the 64-bit one?

How correctly update flow?

Hello,

updated flow-bin with yarn global add flow-bin@latest. yarn global ls shows "[email protected]". flow version shows Flow, a static type checker for JavaScript, version 0.37.4. How update flow to latest version?

OS: Linux Ubuntu 16.04
Yarn: latest

P.S. I also did reboot several times...

Thanks for any help!

Release 0.33?

Would submit a PR but it appears it's now 100% require(package.json).version - so should be nothing to do but increment the minor & publish.

Exit status isn't failing build using command from docs

I'm running flow via the command recommended on the getting started docs:

flow; test $? -eq 0 -o $? -eq 2

This appears to be marking exit status 2 as success in addition to exit status 0. However, flow is reporting issues with our code, but the exit status ends up as success:

$ npm run -s flow
app/assets/js/doc_editor/doc_editor.js:57
 57:       this.doc = new Doc(this.find('#doc'), doc_params).init();
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructor call. Constructor cannot be called on
 57:       this.doc = new Doc(this.find('#doc'), doc_params).init();
                          ^^^ exports


Found 1 error
$ echo $?
0

It appears that flow is returning status 2. Why are we trying to filter that out as a success status?

use `LF` as eol on windows

flow uses cr+lf as eol on windows. this cause problem with cmd and git-bash
can we make it using lf instead? or make it configurable?

image

server_root/client_root check is case-sensitive on case-insensitive filesystems

When using flow on a Windows 10 system, under the right circumstances, if I try to use the flow command from a console window, I get the following error:

PS C:\Users\Gordon\dev\chango> yarn flow
yarn flow v0.21.3
$ flow
flow is running on a different directory.
server_root: c:\Users\Gordon\dev\chango, client_root: C:\Users\Gordon\dev\chango
Unhandled exception: CommandExceptions.Server_directory_mismatch
error Command failed with exit code 110.

The server_root and client_root differ only by the case of the drive letter, which on Windows actually makes no difference since the filesystem is case-insensitive.

Support for `flow --all`

This works:

flow start --all
flow check --all

This does not work (however doing a status without all flag against a server started with flow start --all still gives the desired result):

flow --all
flow status --all

Would it be possible to add support for that? I would create a PR if I knew where to look.

Docker container - libelf.so.1 not found

When I try to run "flow check" in a Docker container (build server), I run into this error:

/opt/buildAgent/work/3c70a0ec877e6008/node_modules/flow-bin/vendor/flow: error while loading shared libraries: libelf.so.1: cannot open shared object file: No such file or directory

postinstall hook causes issues

Every time I npm install an unrelated package into my project, flow-bin re-downloads it's binary and does a bunch of stuff that takes time. This is related to the postinstall hook in flow-bin.

Flowtype hangs for linux starting from v.0.39.0

Sorry if a dup.

STR:

  • update flow-bin to any version starting from 0.39.0
  • run flow for the project

When comes to local[inference] after about 5 mins system resources are all eaten by flow process.

ENV:
This was reproduced on linux (ubuntu 16) and mac.

Project config:
We're having quite some node_modules but exclude them and are using flow-typed stubs.

Any other details should i supply ?

npm install for flow-bin frozen

Upon trying to run
$ npm install --global flow-bin OR npm install --save flow-bin the process freezes at..

[email protected] postinstall ../.../flow-bin

node lib/install.js

and does not let the npm install finish.

On launch, spawns servers infinitely.

me ~/git $ uname -a
Linux - 4.2.0-34-generic #39-Ubuntu SMP - x86_64 x86_64 x86_64 GNU/Linux
Launching Flow server for /home/kir
Spawned flow server (child pid=10243)
Logs will go to /tmp/flow/zShomezSkir.log
Launching Flow server for /home/kir
Spawned flow server (child pid=10254)
Logs will go to /tmp/flow/zShomezSkir.log
Launching Flow server for /home/kir
Spawned flow server (child pid=10265)
Logs will go to /tmp/flow/zShomezSkir.log
Launching Flow server for /home/kir
Spawned flow server (child pid=10276)
Logs will go to /tmp/flow/zShomezSkir.log
Launching Flow server for /home/kir
Spawned flow server (child pid=10287)
Logs will go to /tmp/flow/zShomezSkir.log
Launching Flow server for /home/kir
Spawned flow server (child pid=10298)
Logs will go to /tmp/flow/zShomezSkir.log
Launching Flow server for /home/kir
Spawned flow server (child pid=10309)
Logs will go to /tmp/flow/zShomezSkir.log
Launching Flow server for /home/kir
...

Why does flow needs to open a http connection during post install?

I'm trying to use flow in a corporate setting. NPM packages are proxied thru Nexus, because most of our machines (more importantly, our CI server) isn't connected to the internet.

When I try to install flow on such an environment, the install timeouts with a connection error. If I set the proxy, it succeeds, but I won't have the luxury of a internet connection on the CI server. Why is that required? If it's to download binaries, couldn't them be bundled with the NPM package?

image

Flow only using one thread

Using the version 0.23.0 flow only uses a single thread. The compiled standalone version of Flow works fine for me so it's an issue in flow-bin.

I did a complete node_modules wipe and reinstalled all node modules. Didn't work.

Support for glob/ocaml in libs config

Hi,

I have several private NPM modules which contain their own Type definitions which I'm trying to include to libs dynamically.

Currently to include the private NPM module type defs I need to change .flowconfig like:

[libs]
node_modules/@namespace/my-module/src/interfaces

This adds a lot of manual process every time a new module is added and although I could move all the interfaces into a common types module that creates challenges around versioning of the definitions.

If libs supported patter matching (glob/ocaml) I could do something like:

[libs]
node_modules/@namespace/**/src/interfaces

Am I missing something? Happy to look into implementing and submit a PR if it's valuable.

Error: Cannot find module './' after upgrading to flow 0.31.0

After upgrading to flow 0.31.0 (npm install -g flow-bin), running any flow command throws the following error:

➜  flow version
module.js:457
    throw err;
    ^

Error: Cannot find module './'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/brendan/.nvm/versions/node/v6.4.0/lib/node_modules/flow-bin/cli.js:14:11)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)

https://github.com/flowtype/flow-bin/blob/master/cli.js#L14

index.js doesn't exist in the directory above:

➜  cd /Users/brendan/.nvm/versions/node/v6.4.0/lib/node_modules/flow-bin
➜  ls
cli.js       lib          license      node_modules package.json readme.md    vendor

Flow 0.38.0 doesn't work on Linux (NixOS)

I installed flow by typing npm i flow and ran from node_modules/.bin.flow but I got an error saying:

events.js:160
      throw er; // Unhandled 'error' event
      ^
                                                                                                                                                                                                                                    
Error: spawn /path/to/node_modules/flow-bin/flow-linux64-v0.38.0/flow ENOENT
    at exports._errnoException (util.js:1026:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:359:16)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

Digging deeper, I got this:

$ ls -l /path/to/node_modules/flow-bin/flow-linux64-v0.38.0/flow                               
-rwxr-xr-x 1 fatih users 5979098 Jan 18 17:29 /path/to/node_modules/flow-bin/flow-linux64-v0.38.0/flow
 
$  /path/to/node_modules/flow-bin/flow-linux64-v0.38.0/flow                                                                                                                                                       
-bash: /path/to/node_modules/flow-bin/flow-linux64-v0.38.0/flow: No such file or directory                                                                                                                                       
                                                                                                                                                                                                                                    
$ du -h /path/to/node_modules/flow-bin/flow-linux64-v0.38.0/flow                               
5.8M    /path/to/node_modules/flow-bin/flow-linux64-v0.38.0/flow

The file is definitely there, but npm can't find it, and I can't run it manually.

Here's my uname -a output: Linux godel 4.8.12 #1-NixOS SMP Fri Dec 2 08:11:45 UTC 2016 x86_64 GNU/Linux

--

I also tried the binary from official repo and it doesn't seem to work either:

$ ./flow 
-bash: ./flow: No such file or directory

Should I move the issues there?

Missing libelf.so.1

When installing the flow npm package flow-bin on a system without libelf.so.1 and you run e.g. flow check, you get the following error:

/project-path/node_modules/flow-bin/flow-linux64-v0.34.0/flow: error while loading shared libraries: libelf.so.1: cannot open shared object file: No such file or directory

This is especially a problem in CI systems wich use flow inside the docker image node:latest.

The issues #27 and #26 proof that this is something people regularly run into.

This was also already mentioned in the comments of facebook/flow#210 and there is a solution proposed there:

apt-get update -qq
apt-get install -qy libelf1 

This at least works for Ubuntu, Debian etc. Most non-Docker systems probably have libelf installed.

So why do I open a new issue for this? I think we should do one of the following:

  • libelf is nowhere even mentioned. A bit of documentation on this dependency would not be bad.
  • Ideally, libelf should be available as npm module, a bit like fsevents and be installed when necessary in the process of doing a npm install --global flow-bin. I don't know if this is feasible.
  • Kindly ask the guys from the docker images nodejs/docker-node or docker-library/buildpack-deps to include the library.
  • Maybe there is another solution that I did not think of.

If you think the current situation is okay, feel free to just close this issue.

module not found since v0.46.0 (with 0.45.0 it works)

.flowconfig

[options]
module.system.node.resolve_dirname=javascripts/src/react/common/actions
module.system.node.resolve_dirname=javascripts/src/react/common
module.system.node.resolve_dirname=javascripts/src/react/pages
module.system.node.resolve_dirname=javascripts/src/react/

With v0.46.0...

yarn global add [email protected] ; flow stop ; flow ; flow version

I have multiple errors:

javascripts/src/react/pages/usuario/default/components/ProductsForSale.jsx:6
  6: import LoteGrid from 'components/LoteGrid';
                          ^^^^^^^^^^^^^^^^^^^^^ components/LoteGrid. Required module not found

javascripts/src/react/pages/usuario/default/components/ProductsForSale.jsx:7
  7: import type { LoteType } from 'components/Lote';
                                   ^^^^^^^^^^^^^^^^^ components/Lote. Required module not found

javascripts/src/react/pages/usuario/default/components/ProductsForSale.spec.jsx:7
  7: import IconLoadingAJAX from 'components/IconLoadingAJAX';
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ components/IconLoadingAJAX. Required module not found

... 46 more errors (only 50 out of 96 errors displayed)
To see all errors, re-run Flow with --show-all-errors
Flow, a static type checker for JavaScript, version 0.46.0

But with 0.45.0...

yarn global add [email protected] ; flow stop ; flow ; flow version

I have no errors (current system).

New version of flow

There's a new version of flow out (0.1.1). Will you bump the version number of flow-bin so that users see that they can get the update or what's the recommended way of handling this?

rip version number off from the os specific bins

Version number is already defined in package.json so no need to duplicate it separately in the folder names. When flow updates it's always a breaking change considering editor support where the flow executable path is defined.

Unable to install

Every attempt to install results in:

...>npm install -g flow-bin
...\AppData\Roaming\npm\flow -> ...\AppData\Roaming\npm\node_modules\flow-bin\cli.js

> [email protected] postinstall ...\AppData\Roaming\npm\node_modules\flow-bin
> node lib/install.js


     warn : ENOENT, stat '...\AppData\Roaming\npm\node_modules\flow-bin\vendor\flow'
     warn : flow binary test failed
[email protected] ...\AppData\Roaming\npm\node_modules\flow-bin
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

Any help would be appreciated.

Thanks.

/lib64/libc.so.6: version `GLIBC_2.15' not found

Trying to run flow on a CI server with a locked down version of Linux I'm running into the following issue:

... /lib64/libc.so.6: version `GLIBC_2.15' not found (required by /app/build/teamcity/buildAgent/work/80d783801ddcf26/node_modules/flow-bin/flow-linux64-v0.32.0/flow)

... /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /app/build/teamcity/buildAgent/work/80d783801ddcf26/node_modules/flow-bin/flow-linux64-v0.32.0/flow)

It seems that the highest we can support is GLIBC_2.12 - does anyone know what is depending on this and if it really is required to have GLIBC_2.14 or GLIBC_2.15?

postinstall script fails (Debian Squeeze)

Hi I'm trying to use flow-bin to run flow during a verification build on jenkins. (Running Debian Squeeze)
The postinstall script fails, and so running flow check fails as well.

14:36:09 > node lib/install.js
14:36:09 
14:36:12   ✖ The `flow` binary doesn't seem to work correctly
14:36:12   ✖ flow binary test failed

14:36:22 > flow check
14:36:22 
14:36:23 /jenkins/Verification/node_modules/flow-bin/vendor/flow: error while loading shared libraries: libelf.so.1: cannot open shared object file: No such file or directory

This script runs as expected on OSX.

Let me know if you need more information. Thank you!

Unable to launch binary in docker image

I'm trying to launch the flow-bin wrapper in a docker image (based on alpine)
The binary is available in node_modules (and seems to have the proper size), but spawn always throws a ENOENT.

Error: spawn /build/source/xxxx/node_modules/flow-bin/flow-linux64-v0.44.2/flow ENOENT
    at exports._errnoException (util.js:1022:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:359:16)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn /build/source/xxx/node_modules/flow-bin/flow-linux64-v0.44.2/flow',
  path: '/build/source/xxx/node_modules/flow-bin/flow-linux64-v0.44.2/flow'

Could it be related to a missing library in my image (as in #58 ?) How could I find which file is not found ?

0.44.2 "release" confuses tooling

We have tooling that assumes that the flow version will match the NPM package version. The 0.44.2 release breaks this because NPM package 0.44.2 includes Flow 0.44.1. (The latest: https://flow.org/ )

In the future if there's an update release, could it be a suffix on the actual Flow version? (In this case, 0.44.1.1.)

A union of an array of two sealed objects is producing cryptic error

// @flow

export type VenueResultType = {|
  +subjectData: 'venue'
|};

export type MovieResultType = {|
  +subjectData: 'movie'
|};

type ResultType =
  VenueResultType |
  MovieResultType;

const getVenues = async (): Promise<Array<VenueResultType>> => {
  return [];
};

const getMovies = async (): Promise<Array<MovieResultType>> => {
  return [];
};

export const test = async (): Promise<Array<ResultType>> => {
  let result;

  if (Math.random() > 0.5) {
    result = await getVenues();
  } else {
    result = await getMovies();
  }

  return result;
};
src/bin/commands/work.js:32
 32:   return result;
              ^^^^^^ array type. This type is incompatible with
649: declare function $await<T>(p: Promise<T> | T): T;
                                   ^^^^^^^^^^^^^^ union: type application of class `Promise` | type parameter `T` of async return. See lib: /private/tmp/flow/flowlib_4077e3d/core.js:649
  Member 1:
  649: declare function $await<T>(p: Promise<T> | T): T;
                                     ^^^^^^^^^^ type application of class `Promise`. See lib: /private/tmp/flow/flowlib_4077e3d/core.js:649
  Error:
   32:   return result;
                ^^^^^^ array type. This type is incompatible with
  649: declare function $await<T>(p: Promise<T> | T): T;
                                     ^^^^^^^^^^ Promise. See lib: /private/tmp/flow/flowlib_4077e3d/core.js:649
  Member 2:
   32:   return result;
                ^^^^^^ type parameter `T` of async return
  Error:
    4:   +subjectData: 'venue'
                       ^^^^^^^ string literal `venue`. Expected string literal `movie`, got `venue` instead
    8:   +subjectData: 'movie'
                       ^^^^^^^ string literal `movie`

src/bin/commands/work.js:32
 32:   return result;
              ^^^^^^ array type. This type is incompatible with
649: declare function $await<T>(p: Promise<T> | T): T;
                                   ^^^^^^^^^^^^^^ union: type application of class `Promise` | type parameter `T` of async return. See lib: /private/tmp/flow/flowlib_4077e3d/core.js:649
  Member 1:
  649: declare function $await<T>(p: Promise<T> | T): T;
                                     ^^^^^^^^^^ type application of class `Promise`. See lib: /private/tmp/flow/flowlib_4077e3d/core.js:649
  Error:
   32:   return result;
                ^^^^^^ array type. This type is incompatible with
  649: declare function $await<T>(p: Promise<T> | T): T;
                                     ^^^^^^^^^^ Promise. See lib: /private/tmp/flow/flowlib_4077e3d/core.js:649
  Member 2:
   32:   return result;
                ^^^^^^ type parameter `T` of async return
  Error:
    8:   +subjectData: 'movie'
                       ^^^^^^^ string literal `movie`. Expected string literal `venue`, got `movie` instead
    4:   +subjectData: 'venue'
                       ^^^^^^^ string literal `venue`


Found 2 errors

https://flow.org/try/#0PTAEAEDMBsHsHcBQiCmAPADrATgF1LgJ4YqgBqKAdgK4oBKKAztdLgCrGkC8oA3gD6JQoANTMARgCsUAY1wARAIa5FALlAByAG5VaGxPwC+AbmToseAp1ABZWFoCW9Ji3bWeAoaInS5SleoaALb2TvpGpohEJKAMzKwcMVxeFDTO8W4xgsJ2jumuiSiRMrCUjPgA5ii4qbSMoDyKjISUMqAAFACU6gAK2LBBDowoADwAgtjYioQjtfkJnAB8iw0rvF7Y1dTYlKAA2gC6pibIJWWV1blO9Y3NrR3doH0DQ6MTUzNX85koy6t8Gy2O32R0QJ1QmBw+DO5QITHwtxabS6vX6g2G40m0xGcQKSxWXDWXmg1VAmwykWEDkgHRsygAFgA6KaUAAmAy6oBWAAZGQBWToA4TCcmuBqgRTwRQOC41XRMLqmYSGUAoaDDIXC0WscWS6Wyr6MRVeQzIEVA3ba3DHUxAA

Yarn disallows installing on node 8

Running yarn global add flow-bin returns

error [email protected]: The engine "node" is incompatible with this module. Expected version "^4.5 || 6.* || 7.*".
error Found incompatible module

This is technically an issue with ember-cli and I believe is being addressed in ember-cli/ember-cli#7076

I was able to still get what I needed using npm i -g flow-bin.

Off the top of my head I can't think of a good fix for flow-bin to implement, but wanted to raise the issue just in case someone smarter knows what can be done in the mean time. I also wanted to document the "workaround" (use npm, not yarn) for others who are searching for a fix, feel free to close if this won't be addressed by flow-bin.

Problems with flow-bin on TravisCI

Hey there,

I'm having a problem with flow-bin on TravisCI. During npm install the binary checks fail:

screen shot 2015-02-12 at 11 13 11 am

Then later running flow check:

screen shot 2015-02-12 at 11 17 44 am

I was seeing the same problem on OS X. I upgraded to v0.2.0 and everything is working locally, but it's still failing on travis.

Any idea what's going on?

using external files and libraries while globally declaring type definitions flowtype

I made a stackoverflow post for this, but I think this might actually be an issue worth looking into.

So, I'm trying to declare a global $ListOf type that looks like this:

decls/immutable.js

import {List} from 'immutable'
declare type $ListOf<X> = List<X>

.flowconfig

[libs]
decls/

but when I check flowtype of $ListOf I get undefined. Is there anyway to use external libraries while creating global types? This would be really really useful if there was

Flow server crashes on Windows when there are other wathing processes

Flow 0.37.4
Node 6.2.0
Windows 10

After finishing some feature/bugfix in my project I manually execute command flow via yarn run flow (to don't have to add npm' .bin directory to %PATH%) and it starts Flow server. I see what errors I've made, fix them and re-run yarn run flow. Sometimes it just need to merge changes and more often Flow server crashes and needs to start from scratch.

I'm not sure if it's Windows' fault or IntelliJ's or karma+mocha+webpack's which is running in second console. I turned off IntelliJ's "safe write" option (writing to temporary file, deleting original and renaming temporary), but it didn't help.

From logs:

Sys_error("Invalid argument")
Raised by primitive operation at file "hack\utils\daemon.ml", line 30, characters 25-33
Called from file "hack\dfind\dfindLib.ml", line 22, characters 2-25
Called from file "hack\dfind\dfindLib.ml", line 28, characters 12-43
Called from file "src\server\serverFunctors.ml", line 173, characters 22-48
Called from file "src\server\serverFunctors.ml", line 197, characters 13-35
Called from file "hack\utils\daemon.ml", line 145, characters 6-22

Could you please tell me what can I do with this?

Property cannot be assigned on possibly undefined value

With version 0.45.0, I am running into an issue with regards to setting a field on a nested object.
The comment below indicates where the error is occuring (cannot set 'authorization' on possibly undefined value 'params.headers')

function myFunction() {
return {
        request(params: Object) {
            return new Promise((resolve) => {
                params.headers = params.headers || {};
                params.headers.authorization = 'Bearer <token>'; // error here
                resolve(params);
            });
        },
    };
}

This error can be avoided by changing the two assignment lines inside the promise to be the following:

params.headers = params.headers || {};
const modifiedHeaders = params.headers;
modifiedHeaders.authorization = 'Bearer <token>';
params.headers = modifiedHeaders;

This should not be the case, as it doesn't change the structure of the object, it just prevents us referencing a field 3 levels deep.

Unexpected behaviour with disjunctive type

I'm on 0.23.0 and getting an order effect I don't understand with a disjunctive type:

// @flow

type OptionAnswer = {
    kind           : 'OptionAnswer',
    currentAnswer? : {},
}

type TextAnswer = {
    kind           : 'TextAnswer',
    currentAnswer? : string,
}

type Answer
    = TextAnswer
    | OptionAnswer

////////////////////////////////////////////

// fine
const exampleOptionAnswer: OptionAnswer = {
    kind: 'OptionAnswer',
}

// fine
const exampleTextAnswer: TextAnswer = {
    kind: 'TextAnswer',
}

const exampleAnswer1: Answer = {
    kind: 'OptionAnswer',
}

const exampleAnswer2: Answer = {
    kind: 'TextAnswer',
}

This gives the following error:

29: const exampleAnswer1: Answer = {
                                    ^ object literal. This type is incompatible with
 29: const exampleAnswer1: Answer = {
                           ^^^^^^ union: TextAnswer | OptionAnswer
  Member 1:
   14:     = TextAnswer
             ^^^^^^^^^^ TextAnswer
  Error:
   30:     kind: 'OptionAnswer',
                 ^^^^^^^^^^^^^^ string. Expected string literal `TextAnswer`, got `OptionAnswer` instead
    9:     kind           : 'TextAnswer',
                            ^^^^^^^^^^^^ string literal `TextAnswer`
  Member 2:
   15:     | OptionAnswer
             ^^^^^^^^^^^^ OptionAnswer
  Error:
   10:     currentAnswer? : string,
                            ^^^^^^ string. This type is incompatible with
    5:     currentAnswer? : {},
                            ^^ object type

If I switch the union type definition to type Answer = OptionAnswer | TextAnswer I get this instead:

33: const exampleAnswer2: Answer = {
                                    ^ object literal. This type is incompatible with
 33: const exampleAnswer2: Answer = {
                           ^^^^^^ union: OptionAnswer | TextAnswer
  Member 1:
   14:     = OptionAnswer
             ^^^^^^^^^^^^ OptionAnswer
  Error:
   34:     kind: 'TextAnswer',
                 ^^^^^^^^^^^^ string. Expected string literal `OptionAnswer`, got `TextAnswer` instead
    4:     kind           : 'OptionAnswer',
                            ^^^^^^^^^^^^^^ string literal `OptionAnswer`
  Member 2:
   15:     | TextAnswer
             ^^^^^^^^^^ TextAnswer
  Error:
    5:     currentAnswer? : {},
                            ^^ object type. This type is incompatible with
   10:     currentAnswer? : string,
                            ^^^^^^ string

I'm pretty new to flow so maybe I'm doing something stupid, but it looks like the literal from the first disjunct is somehow infecting the object that is compared to the second disjunct?

flow hanging on specific file change in v0.53

I have a specific line that I can change in my project to get flow to hang 100% of the time (it jumps to 100% CPU and does nothing, I've let it sit for 30 min). I'd be happy to share any info I can, but the last thing the logs show are just:

[2017-08-17 00:33:47] Merging
[2017-08-17 00:33:47] sending (2 errors) and (warnings from 0 files) to 0 subscribed clients (of 0 total)

Is there a way to turn on more verbose logging so that I can put up a proper issue without sharing my entire project? I've tried trimming it down to a smaller use case but can't figure out what's actually causing it

Windows 64: Platform not supported

Hi there,

when starting flow-bin, I get a "Platform not supported" error, although I have a Windows 64.

Any idea?

$ node node_modules/flow-bin/cli.js                                                                                                                            
C:\Users\foo\foo\node_modules\flow-bin\cli.js:20                                                                                                                              
 throw new Error('Platform not supported.');                                                                                                                                                  
 ^                                                                                                                                                                                            
                                                                                                                                                                                             
Error: Platform not supported.                                                                                                                                                                
   at Object.<anonymous> (C:\Users\foo\foo\node_modules\flow-bin\cli.js:20:9)                                                                                                
   at Module._compile (module.js:570:32)                                                                                                                                                      
   at Object.Module._extensions..js (module.js:579:10)                                                                                                                                        
   at Module.load (module.js:487:32)                                                                                                                                                          
   at tryModuleLoad (module.js:446:12)                                                                                                                                                        
   at Function.Module._load (module.js:438:3)                                                                                                                                                
   at Module.runMain (module.js:604:10)                                                                                                                                                      
   at run (bootstrap_node.js:394:7)                                                                                                                                                          
   at startup (bootstrap_node.js:149:9)                                                                                                                                                      
   at bootstrap_node.js:509:3```

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.