jsx-eslint/eslint-plugin-react

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

Aberta

#2.947 aberto em 16 de mar. de 2021

 (9 comentários) (2 reações) (0 responsável)JavaScript (2.731 forks)batch import
help wanted

Métricas do repositório

Stars
 (9.293 estrelas)
Métricas de merge de PR
 (Métricas PR pendentes)

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