jsx-eslint/eslint-plugin-react

[Bug]: `react/prop-types` false positive when component is a value of capitalized property in class

Open

#3534 aperta il 21 feb 2023

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

Metriche repository

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

Descrizione

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

Weird error: image

import React from 'react';

class SomeComponent {
	column = {
		Cell: ({ original }: { original: string }) => <span>{original === 'bla' ? 'bla' : 'bla'}</span>,
	};
}
error    'original' is missing in props validation  react/prop-types

eslint myfile.tsx

Expected Behavior

Not to throw error

When I change Cell to cell - the error is gone. When I avoid using destructuring - the error is also gone.

eslint-plugin-react version

v7.32.2

eslint version

v8.34.0

node version

v18.14.1

Guida contributor