jsonecho

Flow Formatter

Format JavaScript code that uses Flow type annotations.

Loading the tool...

How to use Flow Formatter

  1. Paste your code. The formatter engine loads in a moment the first time.
  2. Adjust the options if you need to.
  3. Copy the formatted result.

About Flow Formatter

Flow is Facebook's static type checker for JavaScript. Its annotations, such as type User = {| name: string |} and function f(x: ?number), are not valid in plain JavaScript, so a regular formatter fails on them. This one parses Flow syntax with the Babel Flow parser.

The code is reprinted with consistent indentation and spacing.

Frequently asked questions

Do I need the @flow comment?

No, the annotations are parsed whether or not the file has the pragma.

Does it type-check?

No, it only formats.

Is Flow still maintained?

Yes, Flow is still developed, though many projects now use TypeScript. For TypeScript use the TypeScript Formatter.

Why did the first run take a second?

The formatting engine for this language is downloaded the first time you use it, then cached by your browser. After that, formatting is instant and nothing leaves your machine.

More in Code Formatters

All tools →