jsx-eslint/eslint-plugin-react

react/no-unused-prop-types false positive when using memo

Open

#3.403 aberto em 5 de set. de 2022

Ver no GitHub
 (6 comments) (4 reactions) (0 assignees)JavaScript (2.797 forks)batch import
bughelp wanted

Métricas do repositório

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

Description

Here's an example using CRA

Expected: No warning

Actual:

  • npm run lint
eslint-example/src/App.js
  23:3  warning  'showFirst' PropType is defined but prop is never used  react/no-unused-prop-types

This started when going from version 7.30.0 to 7.30.1.

  • If I remove memo the warning goes away
  • If I wrap the ternary in the return with a fragment the warning goes away but then I'd have to silence react/jsx-no-useless-fragment so not helpful either.

Guia do colaborador