jsx-eslint/eslint-plugin-react

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

Open

#2.947 aberto em 16 de mar. de 2021

Ver no GitHub
 (9 comments) (2 reactions) (0 assignees)JavaScript (2.797 forks)batch import
help wanted

Métricas do repositório

Stars
 (8.630 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

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

Guia do colaborador