Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

standard js, flow type defintions always undefined

I have a small issue with a boilerplate I'm setting up currently, I'm using Flow JS to type define my javascript for my react application, in the bacground i have a standard js running, but it is not playing nicely with my type notations

I keep getting the following warning on this type definition:

type NavItem = {
  name: string;
  link: string;
}

The warning

frontend/src/Components/Sidebar/Navigation.react.js:5:6: 'NavItem' is not defined.

what am i doing wrong, this is my config for standard js

"standard": {
    "parser": "babel-eslint",
    "plugins": [ "flowtype" ],
    "rules": {
      "use-flow-type": 1
    },
    "ignore": [
      "flow-typed/**/*.js",
      "src/registerServiceWorker.js"
    ]
  },

If any one has any suggestions i would love them, im based out of the create-react-app cli tool if it makes any diffrence for you aswell :)

like image 660
Nopzen Avatar asked Sep 14 '17 19:09

Nopzen


1 Answers

There is an open ticket in standardjs repo: #984 - it is related to that issue.

As a workaround you can downgrade to [email protected] and wait for the fix. The downgrade worked for me with the exact same problem.

You can also try to edit standardjs rules - see: babel-eslint#known-issues and eslint-config-standard.

like image 193
morganfree Avatar answered Nov 16 '22 20:11

morganfree