Flow: Running `flow status` when files change

Created on 1 Feb 2019  Â·  10Comments  Â·  Source: facebook/flow

Is there a way to do flow status --watch, which runs flow on a file change. Since it already watches files itself, this would be useful to avoid having to watch separately for file changes using nodemon -q -x 'flow status || exit 1' or something. (NOTE: nodemon ignores node_modules by default)

This is for running flow in the terminal and seeing errors as you edit files.

question

Most helpful comment

I think a watch mode should be integrated into Flow in any case, we can't assume every possible editor out there (or use case) will have a Flow integration available.

All 10 comments

Can I ask what he use case is? fwiw, yarn status shouldn't need to do a full check, so you can ping it frequently, if you'd like. watch -n 1 "yarn flow status"

Edit some code. Have watcher running in terminal. See errors appear in terminal.

@vjpr Can I ask why you'd prefer to see the errors in the terminal vs the editor you're using?

I'm using IntelliJ IDEA. The integration is flaky, and sometimes it would slow down the IDE, or I couldn't figure out why it wasn't working. I prefer to keep my IDE fast and then see the errors in a terminal.

With the new language server protocol support, the plugin really should be fast. Maybe it's worth following up with the owners of the Flow plugin for IntelliJ?

JetBrains (makers of IntelliJ) maintain the Flow plugin.

Seems they still adding features here and there: https://blog.jetbrains.com/webstorm/2018/05/webstorm-2018-1-4/

On Fri, 1 Feb 2019 at 22:40, Victor notifications@github.com wrote:

With the new language server protocol support, the plugin really should be
fast. Maybe it's worth following up with the owners of the Flow plugin for
IntelliJ?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/flow/issues/7432#issuecomment-459877155, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AARLRQp67zQw2xauc_9aEsTBp3Q01df6ks5vJLRigaJpZM4ae4Jf
.

I think a watch mode should be integrated into Flow in any case, we can't assume every possible editor out there (or use case) will have a Flow integration available.

Flow's process should be IDE agnostic, as IDE's vary and this kind of coupling isn't something you can rely on.

If you're using webpack, consider this plugin:
https://github.com/zhirzh/flow-babel-webpack-plugin/

It's inefficient since it uses sync child process and makes the whole thing extremely slow.
I've been thinking about an implementation similar to a TS equivalent that could be found here:
https://github.com/Realytics/fork-ts-checker-webpack-plugin/blob/4537c161e26a4961663236e208644ddd3d84a9ca/src/index.ts

However I'm very new to flow and it seems like it's already spawns numerous processes on its own.

@vicapow
Use case is that the CLI shows all errors across my codebase, as opposed to just the current file being edited. This is particularly useful when I'm refactoring, change an interface in one lib, and then go through to clean up the type errors.

I'm not sure how various editor plugins handle this, but I use ALE in neovim and it only scans open buffers. I'm sure I could probably make vim do this, but my workflow already has an existing terminal open to watch for webpack compilation errors/stats. Flow CLI output is colored and nicely formatted, so it would be great to run flow in watch mode, maybe with concurrently in the existing webpack window.

Resolved my particular use case with flow-webpack-plugin. It has a hook to fail the build and not emit to the dev-server on flow errors, which I would highly recommended for anybody with a similar workflow.

Was this page helpful?
0 / 5 - 0 ratings