Jake Trent

Spacemacs Flowtype Integration

This is a way to integrate flow with Spacemacs.

Install Flow

First, put flow somewhere in your PATH so that Spacemacs can find and use the binary no matter what project you’re editing. The best option I’ve found so far is flow-bin, installed globally:

npm install -g flow-bin

Spacemacs File Watcher

Preinstalled in Spacemacs, you’ll find flycheck, which forms the foundation of the syntax-checking Spacemacs layer.

The syntax-checking layer is not installed by default, but you can easily add it to your .spacemacs config:

(defun dotspacemacs/layers ()
  (setq-default
   dotspacemacs-configuration-layers
   '(
     syntax-checking
     )
  ))

syntax-checking allows files that you’re editing to be parsed for correctness as you edit, providing realtime feedback of any errors that you’ve written.

Flowtype Watcher

Now we need something that can plug into flycheck and do the flowtype checks for us. That package is flycheck-flow.

Type SPC : and run the command package-install. The find and select flycheck-flow.

Flowtype Feedback

Once you’re installed, you can get feedback from Flow within Spacemacs.

Some of this will happen inline. You’ll get red dots in the gutter with red underlines in your code. If you move your cursor to that point, you will get tooltips describing the problem.

There are also a set of commands for opening a list of flycheck errors.

This is the best flowtype integration with Spacemacs that I know of. What other ways have you found to make this integration better?