Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eslint reports Flow Types as syntax error

In cases where I'm using flow.. https://flowtype.org/

// @flow
var foo = (str: string) => {
  return str;
};

and Eslint together, Eslint reports unexpected token on str: string.

Is there a way to make Eslint ignore (or recognize) flow types and not report them as errors?

like image 683
GN. Avatar asked Aug 08 '16 00:08

GN.


1 Answers

As Hamlet mentioned there is eslint-plugin-flowtype which will do a couple of things:

  • Add syntax support for flow (and future JavaScript syntax) via babel-eslint
  • Add additional eslint rules for linting flow syntax

Here are the Installation Instructions and Configuration docs.

like image 77
James Kyle Avatar answered Oct 13 '22 00:10

James Kyle