jsx-eslint/eslint-plugin-react

Deconstructing function arguments violates no-unused-prop-types rule

Open

#2 947 ouverte le 16 mars 2021

Voir sur GitHub
 (9 commentaires) (2 réactions) (0 assignés)JavaScript (2 797 forks)batch import
help wanted

Métriques du dépôt

Stars
 (8 630 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

👋

A similar issue has been reported and got fixed. I stumbled across a variation of https://github.com/yannickcr/eslint-plugin-react/issues/2689 that still does not seem to work.

Versions eslint 7.22.0 eslint-plugin-react 7.21.5

    const DeactivatePackage = React.useCallback(
        ({context, reloadData}: {context: {id: number; is_active: number}; reloadData: () => Promise<void>}) => {
            if (context.is_active === 0) {
                return <Box />;
            }
            return (
                <Box display="flex" justifyContent="center" color="red">
                    <Button
                        key="release"
                        size="small"
                        aria-label={i18n("deactivate")}
                        onClick={openConfirm(context.id, reloadData)}
                    >
                        <Typography variant="caption">
                            <FormattedMessage id="deactivate" />
                        </Typography>
                    </Button>
                </Box>
            );
        },
        [openConfirm, i18n],
    );
  65:34  warning  'context' PropType is defined but prop is never used     react/no-unused-prop-types
  65:76  warning  'reloadData' PropType is defined but prop is never used  react/no-unused-prop-types

Guide contributeur