jsx-eslint/eslint-plugin-react

Unexpected errors if Flow types were defined

Open

#2173 aperta il 21 feb 2019

Vedi su GitHub
 (6 commenti) (4 reazioni) (0 assegnatari)JavaScript (2797 fork)batch import
bugflowhelp wanted

Metriche repository

Star
 (8630 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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?

Guida contributor