jsx-eslint/eslint-plugin-react

Unexpected errors if Flow types were defined

Open

#2173 opened on Feb 21, 2019

View on GitHub
 (6 comments) (4 reactions) (0 assignees)JavaScript (8,630 stars) (2,797 forks)batch import
bugflowhelp wanted

Description

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?

Contributor guide