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

tricky behaviour of define-flow-type rule #508

Open
petersolopov opened this issue Oct 19, 2021 · 1 comment
Open

tricky behaviour of define-flow-type rule #508

petersolopov opened this issue Oct 19, 2021 · 1 comment

Comments

@petersolopov
Copy link

petersolopov commented Oct 19, 2021

Hi there! I found some tricky behaviour with define-flow-type rule:

type A = {foo: Foo};
Foo();

no-undef with define-flow-type rules will not pay attention to Foo variable. It starts to be global. Yeah, Flow checks it, but see real code that cause of issue:

type Props = {children: React.Node};

export default React.memo(({ children }: Props) => children)

Flow and eslint were not give the error. But in runtime error was thrown "React is not defined" because it does have react import.

I suggest making the option for this rule like ignoreTypes. It will be array with all types that will not were global.

What do you think about it? Thanks!

@petersolopov
Copy link
Author

petersolopov commented Oct 19, 2021

adding ignoreTypes option in #509 as PoC. It has tests as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants