jsx-eslint/eslint-plugin-react

Unexpected errors if Flow types were defined

Open

#2 173 ouverte le 21 févr. 2019

Voir sur GitHub
 (6 commentaires) (4 réactions) (0 assignés)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?

Guide contributeur