jsx-eslint / eslint-plugin-react

React-specific linting rules for ESLint
MIT License
8.86k stars 2.76k forks source link

Rule Proposal: `jsx-max-props-per-component` #3716

Closed makotot closed 3 months ago

makotot commented 3 months ago

Hi 👋 How about limiting the maximum number of props in a component to avoid Apropcalypse? Similar to jsx-max-props-per-line, but per-component rather than per-line and excludes native html elements.

Example of incorrect code when the maximum number is set to 5:

<Button
  a='a'
  b='b'
  c='c'
  d='d'
  e='e'
  f='f'
/>

Example of correct code when the maximum number is set to 5:

<Button
  a='a'
/>
ljharb commented 3 months ago

what is the benefit? that talk is from 2018 and i haven't heard of any similar complaints since.

makotot commented 3 months ago

In terms of frequency of looking, it does not seem to be a useful rule in general. Thank you for your quick response. Understood. I'll make it personal if necessary.