Skip to content

tricky behaviour of define-flow-type rule #508

@petersolopov

Description

@petersolopov

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!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions