最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Eslint reports Flow Types as syntax error - Stack Overflow

programmeradmin1浏览0评论

In cases where I'm using flow.. /

// @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?

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

// @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?

Share Improve this question edited Mar 29, 2017 at 18:08 Nat Mote 4,08619 silver badges30 bronze badges asked Aug 8, 2016 at 0:42 GN.GN. 9,90914 gold badges71 silver badges141 bronze badges 2
  • 3 Look at this – Hamlet Hakobyan Commented Aug 8, 2016 at 0:47
  • @HamletHakobyan - spot on! Can you post this as an answer? – Gabe Levi Commented Aug 8, 2016 at 15:38
Add a ment  | 

1 Answer 1

Reset to default 8

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.

发布评论

评论列表(0)

  1. 暂无评论