Skip to content

Unexpected errors if Flow types were defined #2173

Open
@ifedyukin

Description

@ifedyukin

Hello!
I've updated from eslint-plugin-react@7.7.0 to eslint-plugin-react@7.12.4 and I got some new specific errors. I got unexpected react/no-unused-prop-types error on 5 and 6 lines in the next code listing.

// @flow
import React from 'react';

export type ChildComponentProps = {
    value: string,
    name: string
};

export const ParentComponent = ({arrayOfSmth}: Object) => {
    return (
        <div>
            {arrayOfSmth.map(({value, name}: ChildComponentProps) => {
                return (
                    <span>
                        {name ? value : <Text>{name}</Text>}
                    </span>
                );
            })}
        </div>
    );
};
5:12  error    'value' PropType is defined but prop is never used  react/no-unused-prop-types
6:11  error    'name' PropType is defined but prop is never used   react/no-unused-prop-types

Is it expected behavior for my case?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions