javascriptstandardjs

How to setup standardjs to work with flow?


I am using standardjs.com ("standard": "10.0.3") and flow ("flow-bin": "0.54.1")

I need to make sure standardjs recognizie as valid code with flow annotation example:

export const find = (query: string):string => `${apiUrl}find?q=${query}&APPID=${apiKey}`

Currently I am reeving error:

 Parsing error: Unexpected token :

I have tried to use this package:

"standard-flow":"1.0.0"

with no success.

I would like to know how to setup standardjs properly to work with flow.


Solution

  • I was able to solve this issue using two different dependencies:

    "eslint-config-standard":"10.2.1",
    "eslint-config-standard-flow": "1.0.1"
    

    and configure standard ad:

    "standard": {
        "env": [
          "jest"
        ],
        "globals": [
          "fetch",
          "test",
          "expect"
        ],
        "ignore":[
          "flow-typed"
        ],
        "plugins": [
          "flowtype"
        ],
        "parser": "babel-eslint"
      },