GN.
GN.

Reputation: 9829

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?

Upvotes: 8

Views: 5314

Answers (1)

James Kyle
James Kyle

Reputation: 4178

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.

Upvotes: 8

Related Questions