jsx-eslint/eslint-plugin-react

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

Open

#2947 aperta il 16 mar 2021

Vedi su GitHub
 (9 commenti) (2 reazioni) (0 assegnatari)JavaScript (2797 fork)batch import
help wanted

Metriche repository

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

Descrizione

👋

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

Guida contributor