jsx-eslint/eslint-plugin-react

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

Open

#2.947 geöffnet am 16. März 2021

Auf GitHub ansehen
 (9 Kommentare) (2 Reaktionen) (0 zugewiesene Personen)JavaScript (2.797 Forks)batch import
help wanted

Repository-Metriken

Stars
 (8.630 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

👋

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

Contributor Guide