Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event is not defined with flow type, any way to fix this without ejecting from standard? #984

Closed
kellyrmilligan opened this issue Sep 13, 2017 · 13 comments

Comments

@kellyrmilligan
Copy link

I'd prefer not to eject, but the current setup with flow seems to be incomplete.

these two rules should be enabled to fully support the flow definitions:

https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-define-flow-type
and
https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-use-flow-type

I was lead to these by:

https://github.com/babel/babel-eslint#known-issues

in my setup, I am using latest babel-eslint as the parser, and built in flow stuff works. but if I try and do

function handleEvent(evt: Event) {

then I seem to be out of luck.

thoughts?

"standard": {
    "parser": "babel-eslint",
    "globals": [
      "jest",
      "it",
      "expect",
      "describe"
    ],
    "ignore": [
      "/src/**/*.test.js"
    ],
    "plugins": [
      "flowtype",
      "react"
    ]
  }
@cgestes
Copy link

cgestes commented Oct 5, 2017

Same issue here.

A lot of undefined because of those rules.

Any PR in the pipe?

@seanng
Copy link

seanng commented Oct 19, 2017

I'm facing the same problem :(

@ematipico
Copy link
Member

ematipico commented Oct 19, 2017

What are the versions of your packages? eslint, flowtype plugin, standard, etc.? It would be great to have a small repo where we could reproduce the issue

@fbaiodias
Copy link

I was having a similar issue, getting a lot of '<Type>' is not defined., but using babel-eslint@7.2.1 fixed it for me.

@mcchrish
Copy link

mcchrish commented Nov 7, 2017

@fbaiodias your solution works. Thanks

@doughsay
Copy link

doughsay commented Nov 18, 2017

Downgrading to babel-eslint@7.2.1 fixed some types not being defined but not others. (It fixed my custom types from not being recognized later in the file). But it didn't fix Event and HTMLInputElement from being undefined. Upgrading to the latest version again fixes Event, but breaks the others...

What's going on here...?

EDIT: scratch that... downgrading fixes the problems, the other problems I was having was not prefixing browser globals with window., which is clearly stated at the top of standardjs.com

@CoenWarmer
Copy link

Downgrading to babel-eslint@7.2.1 indeed fixed this for us. Would be ideal however if we could upgrade to 8.0.2 (currently the latest and greatest).

Just for my understanding, is this flow type undef behavior due to an an issue with babel-eslint or with standard?

@borismacias
Copy link

Also work for us with babel-eslint@7.2.1, tried to upgrade to babel-eslint@7.2.3 and it breaks again.

petemill added a commit to brave/browser-laptop that referenced this issue Dec 21, 2017
Uses babel-eslint and the flowtype plugin - https://standardjs.com/index.html#flow.
babel-eslint must be kept at v.7.2.1 as later versions do not correctly identify flow types with the flowtype plugin and standard (see standard/standard#984)
petemill added a commit to petemill/browser-laptop that referenced this issue Dec 22, 2017
Uses babel-eslint and the flowtype plugin - https://standardjs.com/index.html#flow.
babel-eslint must be kept at v.7.2.1 as later versions do not correctly identify flow types with the flowtype plugin and standard (see standard/standard#984)
petemill added a commit to petemill/browser-laptop that referenced this issue Dec 22, 2017
Uses babel-eslint and the flowtype plugin - https://standardjs.com/index.html#flow.
babel-eslint must be kept at v.7.2.1 as later versions do not correctly identify flow types with the flowtype plugin and standard (see standard/standard#984)
petemill added a commit to petemill/browser-laptop that referenced this issue Dec 22, 2017
Uses babel-eslint and the flowtype plugin - https://standardjs.com/index.html#flow.
babel-eslint must be kept at v.7.2.1 as later versions do not correctly identify flow types with the flowtype plugin and standard (see standard/standard#984)
petemill added a commit to petemill/browser-laptop that referenced this issue Dec 22, 2017
Uses babel-eslint and the flowtype plugin - https://standardjs.com/index.html#flow.
babel-eslint must be kept at v.7.2.1 as later versions do not correctly identify flow types with the flowtype plugin and standard (see standard/standard#984)
petemill added a commit to petemill/browser-laptop that referenced this issue Dec 27, 2017
Uses babel-eslint and the flowtype plugin - https://standardjs.com/index.html#flow.
babel-eslint must be kept at v.7.2.1 as later versions do not correctly identify flow types with the flowtype plugin and standard (see standard/standard#984)
petemill added a commit to petemill/browser-laptop that referenced this issue Jan 4, 2018
Uses babel-eslint and the flowtype plugin - https://standardjs.com/index.html#flow.
babel-eslint must be kept at v.7.2.1 as later versions do not correctly identify flow types with the flowtype plugin and standard (see standard/standard#984)
@pietrofxq
Copy link

Is there a better workaround than downgrading babel-eslint?

@stale
Copy link

stale bot commented May 10, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label May 10, 2018
@feross
Copy link
Member

feross commented May 11, 2018

I'm happy to do some digging on this issue. But I'm not a Flow user.

Can you share a repo with a minimal setup that exhibits the issue so I can see it in action? Thanks!

@stale stale bot removed the stale label May 11, 2018
@feross
Copy link
Member

feross commented May 11, 2018

Related to: #1045

@no-response no-response bot closed this as completed May 18, 2018
@no-response
Copy link

no-response bot commented May 18, 2018

This issue has been automatically closed because there was no response to the maintainer's request for more information from the issue opener. With only the information that is currently in the issue, we don't have enough information to take action. Please leave a comment or open a new issue if you have the additional information we need to investigate further.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests