jsx-eslint/eslint-plugin-react

Ignore nested components in no-multi-comp

Open

#2842 aperta il 24 ott 2020

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

Metriche repository

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

Descrizione

I don’t think react/no-multi-comp should trigger on nested components or should have an option to disable it. A practical example:

import { FormattedMessage } from 'react-intl';

export function App() {
  return (
    <FormattedMessage
      values={{
        link:
          // The next line triggers react/no-multi-comp
          (text: string) => <a>{text}</a>,
      }}
    />
  );
}

I suggest to add an option ignoreNested which ignores any components that aren’t declared as part of the Program node body.

Guida contributor